Automating Head and Shoulders Reversal Patterns in MQL5
Summary
This article outlines an MQL5 Expert Advisor for trading standard and inverse head and shoulders formations. The bearish setup identifies three peaks, with a higher head and shoulders of similar height, plus a neckline drawn through the intervening troughs. A break below the neckline triggers a short entry; the inverse pattern uses three troughs and a break above the neckline for a long entry. Stops are placed beyond the right shoulder, while profit targets project the head-to-neckline distance from the breakout.
The implementation describes configurable lookback and tolerance rules, spacing and breakout validation, tracking previously traded patterns to avoid duplicates, chart visualization, and optional trailing stops. It processes market data and pattern checks in an Expert Advisor and includes a backtesting section. However, the supplied text gives no readable backtest figures or report details, so it offers no evidence of profitability or robustness. Pattern thresholds and tolerances are configurable choices, and the article describes the pattern as rare. The system is presented as an educational starting point that would need further testing and risk controls before practical use.
Key ideas
- The standard pattern signals a possible bearish reversal after price breaks below its neckline.
- The inverse pattern signals a possible bullish reversal after price breaks above its neckline.
- The example places stops beyond the right shoulder and projects targets using the head-to-neckline distance.
- Configurable tolerances, spacing checks, and breakout validation help define which formations qualify.
- The article describes an implementation, but its text provides no interpretable backtest results.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.