Idea by: Scriptor.
MQL5 code by: Vladimir Karputov.
The EA places pending Buy Limit and Sell Limit orders. The conditions for placing pending orders are checked when a new bar appears, while the possibility to trail the positions is checked on each tick. As soon as any pending order triggers (this event is monitored in OnTradeTransaction), the remaining pending orders will be removed. Every day, at 23:50, all pending orders are removed and all positions are closed, as well.
- Lots - volume of the pending order;
- Stop Loss (in pips) - Stop Loss ("0" means disabling the setting);
- Take Profit (in pips) - Take Profit ("0" means disabling the setting);
- railing Stop (in pips) - trailing ("0" means disabling the setting);
- Trailing Step (in pips) - trailing step;
- magic number - unique identifier for the EA.
Testing for all symbols on D1 from 2018.01.01 to 2018.05.08: