Skip to content
All library documents

Trend-Following EA with Trading Hours and Loss-Based Sizing

Article MQL5 code base

Summary

This Expert Advisor trades when the XAng_Zad_C indicator cloud changes color. It can restrict entries to a configured daily time window and close open positions at the selected end time. If the start time falls later than the end time, closure is scheduled for that end time on the following day. The default window covers nearly the full day, with positions closed at its stated endpoint.

Position size is adjusted separately for buys and sells according to recent outcomes. In the example, if at least three of the last five trades in the same direction lost, the next trade uses the smaller configured lot amount; otherwise it uses the normal amount. The document mentions GBPJPY H4 tests over 2017 and says the displayed tests used default EA inputs without stop loss or take profit. It provides no performance figures or detailed assessment of the results. Running the EA also requires a separate compiled indicator file, and the example alone does not establish robustness across markets or periods.

Key ideas

  • The EA enters when the trend indicator cloud changes color.
  • Trading can be limited to configured start and end times.
  • Recent losses in each trade direction can trigger smaller position sizes.
  • The cited GBPJPY H4 test covers 2017 and omits stop loss and take profit.
  • The EA depends on a separately compiled indicator file.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.