Classifying Market States from Closed-Candle Price Action in MQL5
Summary
This article describes a non-trading MQL5 module that labels market behavior as compression, transition, or expansion, while assessing trend separately. The states are descriptive: compression reflects narrow, overlapping ranges; transition indicates loosening containment and uneven movement; expansion denotes broader, more volatile swings. A trend label comes from sequences of higher highs and lows or lower highs and lows, together with directional bias in candle closes.
The classifier samples only completed candles and recalculates when the latest closed-bar timestamp changes, aiming to avoid repainting and reduce repeated computation. It combines relative candle-range measurements, close-location values, and swing structure, then displays the result on the chart. The article outlines configurable lookback and sensitivity settings and claims intended behavior in testing, but this excerpt gives no detailed performance statistics or evidence that the labels predict returns. The framework is explicitly contextual rather than a signal generator; its thresholds and usefulness across instruments and timeframes require separate evaluation.
Key ideas
- Compression, transition, and expansion describe volatility and structural constraint rather than market direction.
- Trend is evaluated independently using swing sequences and directional behavior in candle closes.
- The module bases classifications on closed candles and gates recalculation on a new completed bar.
- Relative range, close-location, and swing features contribute to a hierarchical classification process.
- The output is contextual analysis, not a forecast or trade signal.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.