Hi,
this EA should close 50% of the position when TP1 is reached and modify the order by placing the stoploss to breakeven and setting TP2 as the take profit for the other 50%.
Unfortunately it doesn't work at all... Maybe somebody could help?
Interesting article, but I think I check the return values...?
if (Bid>=TP1) { if (!TP1_closed) TP1_closed = OrderClose(OrderTicket(), NormalizeDouble((OrderLots()/2),2), Bid, 3, CLR_NONE); if (!STP_modified) STP_modified = OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice(),TP2,0); if (!TP1_closed || !STP_modified) Time0=EMPTY_VALUE; else Time0=Time[0]; }
TP1_closed is a bool which is true, when TP1 is reached and half of the position is closed. STP_modified is true if the order was modified. In case that one of these variables is false, I set Time0 to EMPTY_VALUE so the EA will do everything again at the next tick and doesn't wait for the next bar.
So I am not sure, which possible errors you think about..
Interesting article, but I think I check the return values...?

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
this EA should close 50% of the position when TP1 is reached and modify the order by placing the stoploss to breakeven and setting TP2 as the take profit for the other 50%.
Unfortunately it doesn't work at all... Maybe somebody could help?