Skip to content
All library documents

Flat Trend EA: Trading Flat and Trending Market States

Article MQL5 code base

Summary

This Expert Advisor uses the FlatTrend indicator to classify market conditions as flat or trending. With the signal timeframe set to the current chart period, the EA checks the indicator's histogram buffers on the current bar and opens a buy or sell position when it detects a signal. A configurable hour window can limit when signals are acted upon.

Stop loss and take profit levels are optional, and trailing stop behavior can be enabled with a nonzero setting. The document mentions a test on EURUSD at the 15-minute timeframe, but does not give the parameter values, performance results, test period, or risk statistics. It is a brief description of EA behavior, not enough information to assess profitability or reproduce the reported test.

Key ideas

  • The EA uses the FlatTrend indicator to distinguish flat conditions from trends.
  • It opens buy or sell trades when the indicator signals on the selected timeframe.
  • An optional hour window can restrict signal handling.
  • Stop loss, take profit, and trailing stop settings are configurable.
  • The stated EURUSD 15-minute test lacks parameters and performance details.

Tags

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