A Proxy HMM Regime Filter Using Trend and Order-Flow Signals
Summary
This Pine Script excerpt presents a persistent market-regime state machine labeled as an HMM and stationarity detector. It estimates a Hurst-like value from a chop calculation, then combines that proxy with ADX to identify trending conditions. RSI, directional indicators, cumulative volume delta from a lower timeframe, and price relative to an EMA gate bullish or bearish states. In weaker or less trending conditions, the non-binary mode can reset the state to neutral; a structural check also neutralizes a state when price crosses the EMA against it.
The implementation is explicitly an approximation rather than a fitted hidden Markov model or formal stationarity test. A one-bar neutral transition is intended to delay execution of regime changes. The supplied document cuts off during the regime-box logic, so the remaining strategy rules and any resulting trades cannot be assessed. It includes no performance results or validation, and the indicator proxies and thresholds may be sensitive to market and timeframe.
Key ideas
- A chop-derived Hurst proxy and ADX threshold classify whether conditions appear to be trending.
- RSI, directional indicators, lower-timeframe volume delta, and EMA position gate directional regimes.
- The state machine can preserve a directional regime, reset to neutral, and insert a neutral transition bar.
- The script labels the detector as an HMM, but the shown method is a rule-based approximation.
- The excerpt is incomplete and provides no backtest evidence.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.