Skip to content
All library documents

Price Channel Signals for Breakouts and Range Trading

Article MQL5 code base

Summary

This Expert Advisor uses a price-extreme channel to generate trades. By default, a close above the upper channel boundary opens a long position, while a close below the lower boundary opens a short position. It checks signals on each new bar, closes opposing positions when a reverse signal appears, and offers configurable direction, signal-bar, volume, slippage, stop-loss, take-profit, and spread-based stop-distance settings. The indicator file is required for the EA to operate.

The document reports a test on M5 data from January 2017 to January 2018: the default breakout approach lost the deposit early, while reversing the signals produced behavior that varied with market conditions. The author describes the reversed approach as profitable in flat periods and unprofitable when trends began, and proposes adapting between range trading and trend-direction breakouts. These findings are specific to the stated test and settings; they do not establish robust performance across instruments or periods. The EA is presented for training and strategy testing.

Key ideas

  • The EA opens trades when a bar closes beyond the corresponding price channel boundary.
  • A signal in the opposite direction closes existing positions and opens a trade in the new direction.
  • Users can configure trade direction, volume, signal bar, and protective order settings.
  • The reported test lost money with the default breakout signals and showed market-dependent results after reversing them.
  • The document proposes switching between range trading and trend-following according to market conditions.

Tags

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