Skip to content
All library documents

CCI and Moving Average Rules for a Hedging-Only Expert Advisor

Article MQL5 code base

Summary

This expert advisor combines the Commodity Channel Index with fast and slow moving averages to open and close positions. For a buy, the slow average must have risen between the two referenced bars, the fast average must be rising on the current bar, and the selected CCI reading must be below its lower threshold. A sell uses the corresponding falling-average conditions and a CCI reading above its upper threshold. The slow average’s direction also determines when to close positions.

The CCI and moving averages can use different timeframes, and the user selects the CCI thresholds and the bar from which to read CCI. The document explicitly limits the EA to hedging accounts. It explains the rule structure but supplies no parameter values, backtest results, execution details, or evidence that the conditions are profitable; those choices require independent testing.

Key ideas

  • The EA uses CCI thresholds alongside fast and slow moving average direction to trigger entries.
  • Buy and sell entries apply mirrored conditions to the moving averages and CCI.
  • Positions close when the slow moving average reverses direction according to the stated bar comparison.
  • CCI and moving averages may use different timeframes, and the EA requires a hedging account.

Tags

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