Skip to content
All library documents

Programming Candlestick Patterns with Volatility-Adjusted Rules

Article MQL5 articles

Summary

This article shows how to express candlestick patterns as explicit rules in MQL5 and organize those rules into reusable detection functions. It introduces price comparisons for bullish and bearish bars, time-series indexing for accessing recent and historical candles, and arithmetic for measuring candle bodies and wicks. Examples include single-bar patterns such as the Doji and multi-bar patterns such as bullish engulfing. For patterns whose definitions use relative size thresholds, it proposes ATR-based limits so the rules can adapt to different volatility levels and instruments.

The article describes an indicator that marks detected patterns on a chart and reports observing its output on a Volatility 75 (1s) Index chart. It does not provide a quantitative backtest, false-positive rates, or evidence that the highlighted patterns predict profitable trades. The author notes that pattern signals may need additional filters. The rules therefore serve as an automation and analysis framework, not a validated standalone strategy.

Key ideas

  • Candlestick patterns can be represented as comparisons and measurements of open, high, low, and close values.
  • Time-series indices allow rules to compare a candle with earlier bars.
  • Absolute body size and wick lengths help define single-candle patterns.
  • ATR can scale size thresholds to recent volatility instead of using fixed price distances.
  • Chart markers demonstrate detection, but profitability and predictive value are not established.

Tags

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