Skip to content
All library documents

Automating Candlestick Pattern Detection and Outcome Tracking

Article MQL5 articles

Summary

This article describes a MetaTrader 5 tool that scans recent bars for pin bars, dojis, engulfing patterns, and marubozu candles. It outlines rule-based detection using candle bodies, shadows, ranges, and direction, with configurable lookback and shape thresholds. Detected patterns are marked on a chart, and the tool records the following bar’s movement and summarizes pattern outcomes as win-rate statistics.

The material explains how these formations are operationalized for consistent scanning, while noting contextual considerations such as trend, support or resistance, volume, and volatility. The displayed approach is a detection and measurement toolkit rather than a complete trading system: the supplied excerpt gives no sufficiently detailed results to establish that any pattern has an edge. A one-bar outcome measure also does not by itself account for execution costs, holding periods, or risk-adjusted performance, so users would need broader validation before relying on the signals.

Key ideas

  • Pin bars are classified by long shadows relative to candle bodies, while dojis have small bodies relative to their full ranges.
  • Engulfing patterns compare the direction and body coverage of two consecutive candles.
  • Marubozu detection looks for a body occupying most of the candle’s total range.
  • The EA scans a configurable history and records the price movement after each detected pattern.
  • Pattern counts or win rates alone do not establish profitability without broader testing and trading costs.

Tags

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