if(OrderCloseTime() == 0 && OrderType() == OP_BUY && Bid-OrderOpenPrice()>TSPoint && OrderStopLoss()<Bid-TSPoint) { OrderModify(Ticket,OrderOpenPrice(),Bid-TSPoint,OrderTakeProfit(),0,Blue); };
You should be modifying OrderTicket()
Although not causing a problem here, using unnecessary ; are probably not good practice, especially if you place them after if()
Keith Watford:
You should be modifying OrderTicket()
Although not causing a problem here, using unnecessary ; are probably not good practice, especially if you place them after if()
Awesome! OrderTicket() did the job. My EA is error-free now. Thank you! Also thanks for the coding tip. I will keep that in mind.

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi coders,
I need help on fixing OrderModify Error 4108.
I am trying to develop EA that buys incrementally (Scaling In) with trailing stop on each order. Error happens when particular order hit the stoploss and later EA tries to modify the same order for trailing stop but, of course, EA cannot find that order and spits out OrderModify Error 4108.
Here is my code:
Here is the excerpt of log:
If you could advice me how to avoid the error, I am very grateful. Thank you in advance!