EA does not modify trade with TP and SL

 
I am using Alpari UK MT5. I have an EA that should modify trade with TP and SL. WHen I run backtest with the EA it did modify trades with TP and SL. However, it does not set TP and SL in demo forward test. . No error in journal and Exper tab. It did not should EA tried to modify trade with TP and SL. Please help.
 
xlitang:
I am using Alpari UK MT5. I have an EA that should modify trade with TP and SL. WHen I run backtest with the EA it did modify trades with TP and SL. However, it does not set TP and SL in demo forward test. . No error in journal and Exper tab. It did not should EA tried to modify trade with TP and SL. Please help.
Please consider to insert StopLevel value into modify script because Alpari has StopLevel = 0;
 
xlitang:
I am using Alpari UK MT5. I have an EA that should modify trade with TP and SL. WHen I run backtest with the EA it did modify trades with TP and SL. However, it does not set TP and SL in demo forward test. . No error in journal and Exper tab. It did not should EA tried to modify trade with TP and SL. Please help.

This TP/SL not executed has beed asked s lot in the forum.

Since MT5 is position based trading platform (MT4 is ticket based trading platform), you may want to use pending orders with the same amount of lot with opened position as TP and SL.

If you have 1.34 lots of buy position, use 1.34 lots of sell limit as TP and 1.34 lots sell stop as SL, and if you have 1.34 lots of sell position, use 1.34 lots of buy limit as TP and 1.34 lots buy stop as SL.

Delete one of the pendings if your opened position is no longer exist.

Documentation on MQL5: Standard Constants, Enumerations and Structures / Trade Constants / Order Properties
Documentation on MQL5: Standard Constants, Enumerations and Structures / Trade Constants / Order Properties
  • www.mql5.com
Standard Constants, Enumerations and Structures / Trade Constants / Order Properties - Documentation on MQL5
Reason: