OrderModify Error 4108 from Trailing Stop + Scaling-In Trade System
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()
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.
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!