am trying to send an order from my EA using this statment
int ticket=OrderSend(Symbol(),OP_BUY,1,Ask,6,Ask-25*Point,Ask+25*Point,"My order #2",0,0,Green);
Print("OrderSend failed with error #",ErrorDescription(GetLastError()));
but most of the times i am getting an error of "invalid stops" . can anyone help me ?
tazz90: but most of the times i am getting an error of "invalid stops" .
can anyone help me?
Concerning this issue sometimes I receive [invalid S/L or T/P] messages.
But I use your routine to adjust for 4/5 digit brokers. Why is that keeping happen some times ?
Other issue is what should I use in the code that is follow. pips2point or pips2dbl ?
In extern I want to say what is the distance to open an order. Should this be an int or a double ?
extern double OpenDistance = 0;
In code that's follow something could be incorrect as I'm dealing with the best way to get the order to open at the distance declared in extern as OppositeDistance.
if(Op == OP_BUY && MathAbs ((Bid + Spread) < OrderOpenPrice() - (OppositeDistance*pips2dbl)) && SellAllowed)
SellTicket = OrderSend(Symbol(), OP_SELL, MLots, Bid, Slippage*pips2points, 0, 0, "Open Opposite Sell Order", MagicNumber, 0, Red);
Thank you in advance for any clarification provided.
I do not know the reason, why the question was not clearly answered.
Invalid stops error you would probably receive:
if your broker does not accept anything but zero for the SL and TP arguments (this is why Raptor asks about ECN, but it is not mentioned in any guide)
or the SL or TP is too close to the order price (this is why Raptor asks about STOPLEVEL)
or the SL or TP price is not strictly rounded to fit the price grid (use NormalizeDouble() )
Nevertheless I have no idea how it is related to the digits of a broker.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.