I don't know why but I have in some trades (not all) the error 130 when I'm doing a backtest. The error 130 is invalid StopLoss but here is my OrderSend:
SellTicket= OrderSend(Symbol(),OP_SELLSTOP,Units,SellPrice,SlipPage,0,0, comment,MagicNumber,TimeCurrent()+expiration,clrBlue);
Where is the error?
Thank you very much
sometimes it's OP_BUYLIMIT/OP_SELLLIMIT intead of OP_BUYSTOP/OP_SELLSTOP
Check this table for minimum price distances for pending orders: https://book.mql4.com/appendix/limits
You have to take into account stop level - minimum number of points your buy/sell price must be from current Bid/Ask price.
You will need MarketInfo() function:
Print("Stop level in points=",MarketInfo(Symbol(),MODE_STOPLEVEL));
To add comments, please log in or register