Help with OrderModify Function

Back to topics list To post a new topic, please log in or register
avatar
26
Timerider 2015.04.30 16: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);
     OrderModify(OrderTicket(),0,Bid-0.002,0.01,0,);
}   

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. 

avatar
13006
WHRoeder 2015.04.30 17: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
Back to topics list  

To add comments, please log in or register