Download MetaTrader 5

Help with OrderModify Function

To add comments, please log in or register
Timerider 2015.04.30 14:17 

Hey guys,

i have a very simple problem and it makes me crazy that i cant solve it. I wrote a small EA which should Modify the Oder every 10 pips to a new SL of 20 pips.  But it always says: "invalid ticket for OrderModify function". Here is the code:

 OrderSend(Symbol(),OP_BUY,0.01,Bid,10,Bid-0.002,Bid+0.01,"My Order");   
    if (Bid==1.000||Bid==1.0010  ||Bid==1.0020   ||Bid==1.0030   ||Bid==1.0040   ||Bid==1.0050   ||Bid==1.0060   ||Bid==1.0070   ||Bid==1.0080 )  //and so on
     OrderSelect(0 ,SELECT_BY_POS);

When I put the OrderTicket() function in an Alert, it alerts the ticket correctly. But it doesnt work in the OrderModify function. 

Dont worry, its just a small part of the ea .

Thanks for your help. 

whroeder1 2015.04.30 15:20  
  1. if (Bid==1.000||Bid==1.0010  ||Bid==1.0020   ||Bid==1.0030 ...
    Will never be true. The == operand. - MQL4 forum
  2. Check your return codes (OrderModify and OrderSelect) What are Function return values ? How do I use them ? - MQL4 forum and Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles
To add comments, please log in or register