Download MetaTrader 5

Error 130 on OrderSend

To add comments, please log in or register
gobya
14
gobya  

Hello,

 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:

 

BuyTicket=OrderSend(Symbol(),OP_BUYSTOP,Units,BuyPrice,SlipPage,0,0, comment,MagicNumber,TimeCurrent()+expiration,clrYellow); 

 SellTicket=  OrderSend(Symbol(),OP_SELLSTOP,Units,SellPrice,SlipPage,0,0, comment,MagicNumber,TimeCurrent()+expiration,clrBlue);

 

Where is the error?

 Thank you very much 

qjol
3243
qjol  

sometimes it's OP_BUYLIMIT/OP_SELLLIMIT intead of OP_BUYSTOP/OP_SELLSTOP

http://www.metatrader5.com/en/terminal/help/trading/general_concept/order_types

SYED NAUFAL GADDAFI
1401
SYED NAUFAL GADDAFI  
Where is the error?
How BuyPrice & SellPrice calculated ?
Drazen Penic
2579
Drazen Penic  

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