Skip to content
All library documents

Enumerating Candlestick Sequences with Permutations

Article MQL5 articles

Summary

The document treats encoded candlestick types as symbols in an ordered sequence, then explains how permutations can enumerate possible multi-candle patterns. It distinguishes arrangements without repetition, counted by selecting and ordering distinct symbols, from arrangements with repetition, where each position can use any symbol. MQL5 tools are described for calculating these counts and generating the corresponding sequences. This approach can provide a complete candidate set for later comparison with historical market outcomes rather than restricting analysis to familiar named formations.

The examples show how quickly the search space grows as the alphabet or pattern length increases, especially when repetition is allowed. Enumeration can support systematic pattern research, but generating every sequence does not show that any sequence predicts returns or will remain useful. The article provides a framework for counting and organizing patterns, not reported trading results. Any discovered association would still need statistical validation and controls against overfitting, and larger searches may become computationally demanding.

Key ideas

  • Candlestick categories can be encoded as symbols and analyzed as ordered sequences.
  • Without repetition, sequence counts use ordered selections of distinct symbols; with repetition, the count grows as the alphabet size raised to the sequence length.
  • A calculator can estimate the search space before a generator creates candidate patterns.
  • Exhaustive enumeration can broaden pattern research beyond conventional named formations.
  • Generated patterns require validation; enumeration alone does not demonstrate predictive value.

Tags

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