Skip to content
All library documents

Finding Similar Historical Candle Patterns with Dynamic Time Warping

Article MQL5 code base

Summary

This MetaTrader 5 indicator adapts an earlier MetaTrader 4 tool that searches price history for candle sequences resembling a selected recent pattern. It uses dynamic time warping (DTW) to identify candidate matches and presents possible future price paths based on those historical examples. Display options include an average of candidate movements, a forecast average, or the best-matching pattern, along with a range and an on-chart trading tip.

Settings control the pattern length, forecast horizon, search-history age, candidate-length variation, match tolerance, and maximum number of alternatives. These parameters let users define how broadly the indicator searches and how many matches it displays. The document gives no performance evidence, validation method, or detailed trading rules; it points readers to a separate page for the underlying methodology. Historical similarity alone does not establish that a future price path will repeat.

Key ideas

  • The indicator searches price history for candle patterns similar to a selected pattern.
  • Dynamic time warping is used to match candidate sequences.
  • Forecast displays can show average candidate movement or the best matching historical pattern.
  • Users can configure pattern length, forecast horizon, search age, tolerance, and candidate count.
  • The document provides no backtest or evidence that matched patterns predict future prices.

Tags

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