Discussing the article: "Encoding Candlestick Patterns (Part 5): Expanding Taxonomy of Candlestick for General Pattern Frequency Analysis"

 

Check out the new article: Encoding Candlestick Patterns (Part 5): Expanding Taxonomy of Candlestick for General Pattern Frequency Analysis.

This article extends the candlestick encoding framework by separating previously unclassified bullish and bearish candlesticks into distinct symbols. Using an MQL5 script, historical data were automatically encoded, sequential patterns were extracted, and frequency statistics were generated. The results show that these newly identified candles represent a significant portion of market activity, revealing structural information previously hidden by the generic underscore notation. The expanded taxonomy improves the completeness of the symbolic representation while preserving an objective, quantitative framework for large-scale market structure analysis.

The primary objective of this article is to expand the candlestick encoding alphabet introduced in Part 1 so that unclassified candlesticks are separated into directional categories, and to re-evaluate the single- and double-candlestick frequency profiles established in Parts 3 and 4 under this expanded scheme.

Specifically, we will:

  1. Extend the CandleType() classification function so that any candle failing the existing shape rules is assigned N (unclassified bullish) or n (unclassified bearish) instead of a single neutral symbol.
  2. Re-encode 1,500-candle samples of GBPUSD and gold (XAUUSD) on the M15 and H1 timeframes using the expanded 11-symbol alphabet (A, a, G, g, H, h, E, e, D, N, n).
  3. Compute single- and double-candlestick frequency and percentage statistics, sorted in descending order, under the new taxonomy.
  4. Compare the resulting distributions across instruments and timeframes to determine whether the expanded taxonomy reveals structure that the collapsed '_' symbol had obscured.
  5. Test the expanded system on diverse assets, including BTCUSD, OilCash, and GBPJPY, to observe how pattern uniqueness increases with sequence length.

The resulting script is designed to be flexible: the user can choose to output either the full encoded series together with its frequency analysis, or the frequency analysis alone, and can adjust the pattern length being extracted without modifying the underlying logic.


Author: Daniel Opoku