OPEN-SOURCE SCRIPT
Diupdate Auction Regime Router Entropy Gate & Hurst Memory

Auction Regime Router — Entropy Gate & Hurst Memory
What it is
Every structure playbook fails in the wrong regime. Fading the value-area edge works when price is anti-persistent (stretches snap back); riding a breakout works when price is persistent (moves feed on themselves); and nothing structural works when the tape is noise. This tool measures two things — how much structure exists, and what kind it is — and routes to a plain-language answer: FADES VIABLE / BREAKOUTS VIABLE / STAND ASIDE. It decides which of your tools to trust, never buy or sell.
The two measurements (and how they work together)
Permutation entropy (Bandt–Pompe 2002) — the gate. It measures how disordered the recent price sequence is from the frequencies of ordinal patterns (which of the 6 orderings each price triplet takes). High entropy = all patterns equally likely = noise = no structural edge. The gate is self-calibrated: entropy is ranked against its own recent history, so "noisy" means noisy for this symbol and timeframe.
Hurst exponent (Hurst 1951; Mandelbrot) — the router. Memory via diffusion scaling: how the dispersion of K-bar returns grows with K. H > 0.5 = persistent → continuation regime; H < 0.5 = anti-persistent → reversion regime. Research supports the routing: mean reversion is empirically more probable and faster during anti-persistent periods.
The mashup logic is a hierarchy, not a mixture: the entropy gate overrides the Hurst read. If the tape is noise, the router says STAND ASIDE regardless of what H says — because a memory estimate on noise is meaningless.
The honesty steps
A dead zone around H = 0.5 (default 0.45–0.55): near a random walk the memory read is unreliable, so the router says MIXED rather than pretending. Practitioners commonly require a margin before activating a playbook; both thresholds are inputs.
A minimum-dwell filter (the standard anti-chattering design from switched-systems control): a new regime is announced only after it survives a set number of confirmed bars, so the read doesn't flip-flop bar to bar. The cost is that many bars of lag — stated, and adjustable.
Estimates are proxies from bar data with overlapping windows — descriptive of the recent past, not a prediction. The dashboard shows the state, how long it has persisted (regime age), how dominant it has been recently (stability %), and any pending regime with a countdown — nothing more.
How to use it
Add to any liquid symbol/timeframe; defaults suit intraday index futures. The script requests no external data of any kind, so it runs on every plan and every symbol.
Glance at the regime lane — the thin colored strip at the bottom of the pane: blue = continuation, violet = reversion, amber = noise, gray = mixed. The palette is deliberately direction-neutral — no green or red anywhere in regime coding, so nothing can be misread as a buy or sell.
The HTF STACK row shows the raw regime on three higher timeframes derived as multiples of the chart (defaults 3×, 5×, 15× — so a 5m chart reads 15m/25m/75m automatically, adapting to any chart). A ✓ in green = every timeframe agrees on the same actionable regime (strongest context). A ⚠ in amber = a higher timeframe reads NOISE or the opposite regime while the chart claims a playbook (weakest — reduce or wait).
Read the dashboard for detail: REVERSION → your value-area fade / band-reversion tools are in their element; CONTINUATION → your breakout / drive tools are; NOISE → the gate is closed, stand aside; MIXED → no clear routing, reduce. STABILITY shows how settled the read is; PENDING shows a forming regime with a countdown.
Regime-change tags print only on announced (dwell-confirmed) changes; alerts fire on entering each state.
Best used as the selector above your structure toolkit rather than as a standalone display.
What makes it original
Hurst and entropy oscillators exist. What this adds: (1) the hierarchy — a self-calibrated entropy gate that can veto the memory read, instead of two numbers side by side; (2) routing to auction playbooks in plain language (fade vs breakout viability), not a raw statistic; (3) honest dead zones, a minimum-dwell announcement filter, and stability/pending context instead of a binary flip at H = 0.500. It is a decision-hygiene tool for structure traders.
Concept credits
Ordinal-pattern (permutation) entropy — C. Bandt & B. Pompe (2002). Long-memory / rescaled-range analysis — H. E. Hurst (1951); fractal market framing — B. Mandelbrot. Regime-gated strategy selection — standard quantitative practice. Implementation and charting design are the author's own.
Important disclaimer
Research and education only. Not financial advice, not a signal service, not a guarantee of future results. Regime labels are descriptive statistics of recent bars; regimes change without warning and estimates are proxies. Validate independently and manage your own risk.
What it is
Every structure playbook fails in the wrong regime. Fading the value-area edge works when price is anti-persistent (stretches snap back); riding a breakout works when price is persistent (moves feed on themselves); and nothing structural works when the tape is noise. This tool measures two things — how much structure exists, and what kind it is — and routes to a plain-language answer: FADES VIABLE / BREAKOUTS VIABLE / STAND ASIDE. It decides which of your tools to trust, never buy or sell.
The two measurements (and how they work together)
Permutation entropy (Bandt–Pompe 2002) — the gate. It measures how disordered the recent price sequence is from the frequencies of ordinal patterns (which of the 6 orderings each price triplet takes). High entropy = all patterns equally likely = noise = no structural edge. The gate is self-calibrated: entropy is ranked against its own recent history, so "noisy" means noisy for this symbol and timeframe.
Hurst exponent (Hurst 1951; Mandelbrot) — the router. Memory via diffusion scaling: how the dispersion of K-bar returns grows with K. H > 0.5 = persistent → continuation regime; H < 0.5 = anti-persistent → reversion regime. Research supports the routing: mean reversion is empirically more probable and faster during anti-persistent periods.
The mashup logic is a hierarchy, not a mixture: the entropy gate overrides the Hurst read. If the tape is noise, the router says STAND ASIDE regardless of what H says — because a memory estimate on noise is meaningless.
The honesty steps
A dead zone around H = 0.5 (default 0.45–0.55): near a random walk the memory read is unreliable, so the router says MIXED rather than pretending. Practitioners commonly require a margin before activating a playbook; both thresholds are inputs.
A minimum-dwell filter (the standard anti-chattering design from switched-systems control): a new regime is announced only after it survives a set number of confirmed bars, so the read doesn't flip-flop bar to bar. The cost is that many bars of lag — stated, and adjustable.
Estimates are proxies from bar data with overlapping windows — descriptive of the recent past, not a prediction. The dashboard shows the state, how long it has persisted (regime age), how dominant it has been recently (stability %), and any pending regime with a countdown — nothing more.
How to use it
Add to any liquid symbol/timeframe; defaults suit intraday index futures. The script requests no external data of any kind, so it runs on every plan and every symbol.
Glance at the regime lane — the thin colored strip at the bottom of the pane: blue = continuation, violet = reversion, amber = noise, gray = mixed. The palette is deliberately direction-neutral — no green or red anywhere in regime coding, so nothing can be misread as a buy or sell.
The HTF STACK row shows the raw regime on three higher timeframes derived as multiples of the chart (defaults 3×, 5×, 15× — so a 5m chart reads 15m/25m/75m automatically, adapting to any chart). A ✓ in green = every timeframe agrees on the same actionable regime (strongest context). A ⚠ in amber = a higher timeframe reads NOISE or the opposite regime while the chart claims a playbook (weakest — reduce or wait).
Read the dashboard for detail: REVERSION → your value-area fade / band-reversion tools are in their element; CONTINUATION → your breakout / drive tools are; NOISE → the gate is closed, stand aside; MIXED → no clear routing, reduce. STABILITY shows how settled the read is; PENDING shows a forming regime with a countdown.
Regime-change tags print only on announced (dwell-confirmed) changes; alerts fire on entering each state.
Best used as the selector above your structure toolkit rather than as a standalone display.
What makes it original
Hurst and entropy oscillators exist. What this adds: (1) the hierarchy — a self-calibrated entropy gate that can veto the memory read, instead of two numbers side by side; (2) routing to auction playbooks in plain language (fade vs breakout viability), not a raw statistic; (3) honest dead zones, a minimum-dwell announcement filter, and stability/pending context instead of a binary flip at H = 0.500. It is a decision-hygiene tool for structure traders.
Concept credits
Ordinal-pattern (permutation) entropy — C. Bandt & B. Pompe (2002). Long-memory / rescaled-range analysis — H. E. Hurst (1951); fractal market framing — B. Mandelbrot. Regime-gated strategy selection — standard quantitative practice. Implementation and charting design are the author's own.
Important disclaimer
Research and education only. Not financial advice, not a signal service, not a guarantee of future results. Regime labels are descriptive statistics of recent bars; regimes change without warning and estimates are proxies. Validate independently and manage your own risk.
Catatan Rilis
Minor changeCatatan Rilis
v1.1 — Finishing pass (no engine change)- Cleared a Pine warning (CW10004): the smoothed Hurst read called ta.ema from inside a "skip while
warming up" check (chart and higher-timeframe). It now runs every bar via a seed-on-first-valid
EMA that reproduces the exact same output after warm-up — only the warning is gone.
- Added a Data Window (EXP_) export bus so the entropy rank, Hurst exponent and regime state can
feed other scripts via input.source().
- Added the MPL-2.0 licence header.
- No change to the entropy gate, the Hurst memory, the regime routing, the multi-timeframe reads or
the dashboard — everyday behaviour is identical.
Descriptive regime-gating tool, not investment advice.
Skrip open-source
Dengan semangat TradingView yang sesungguhnya, pembuat skrip ini telah menjadikannya sebagai sumber terbuka, sehingga para trader dapat meninjau dan memverifikasi fungsinya. Salut untuk penulisnya! Meskipun Anda dapat menggunakannya secara gratis, perlu diingat bahwa penerbitan ulang kode ini tunduk pada Tata Tertib kami.
Pernyataan Penyangkalan
Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.
Skrip open-source
Dengan semangat TradingView yang sesungguhnya, pembuat skrip ini telah menjadikannya sebagai sumber terbuka, sehingga para trader dapat meninjau dan memverifikasi fungsinya. Salut untuk penulisnya! Meskipun Anda dapat menggunakannya secara gratis, perlu diingat bahwa penerbitan ulang kode ini tunduk pada Tata Tertib kami.
Pernyataan Penyangkalan
Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.