Deep State Regime Classifier
- Indicatori
- Versione: 1.1
- Attivazioni: 5
Deep State Regime Classifier paints the candles of your chart according to the market regime detected on each closed bar. It is a deterministic, rule-based classifier built on well-known statistics: a rescaled-range estimate of the Hurst exponent, a fractal dimension index (FDI), the standard deviation of price changes and momentum. The same data always produces the same colors.
How it works
For each closed bar the indicator looks back over a configurable window (default 144 bars) and calculates:
- Hurst exponent (simplified rescaled-range estimate over the whole window)
- Fractal dimension index: ratio between the path length of closes and the high-low range of the window
- Volatility: standard deviation of close-to-close changes over one third of the window
- Momentum: close change over one fifth of the window
The regime is then assigned by fixed rules:
- Chaotic (purple): FDI at or above 1.67
- Trend (blue): Hurst at or above 0.58, FDI at or below 1.45 and momentum larger than twice the volatility
- Mean reversion (silver): Hurst at or below 0.45
- Accumulation / range (gold): any other case
Bars still warming up are gray. Only closed bars are colored; the forming candle is left untouched, so colors do not change after a bar closes.
Main features
- Color candles drawn over the price chart
- Four regimes plus a warm-up state
- Optional canvas panel with the current regime, Hurst, FDI and volatility of the last closed bar
- History limit for fast loading
Inputs
- Lookback bars (minimum 32)
- Max history bars
- Show HUD panel and refresh interval
Notes and limitations
- The thresholds are fixed. The "accumulation" color is a catch-all for bars that do not meet the other rules; it does not confirm that anyone is accumulating positions.
- The Hurst value is a single-window estimate and is noisy on short windows.
- To see the regime colors clearly, you may want to set the chart's own candle colors to match the background or use line chart mode.
- The indicator does not trade and does not send alerts.
Recommended use
Any symbol and timeframe. Typical use is as a context filter: favor trend-following setups on trend bars and avoid or reduce size in chaotic periods. M15 to H4 charts give smoother regimes.
