OPEN-SOURCE SCRIPT
Entropic Regime Field [JOAT]

Entropic Regime Field is an open-source market state classifier that uses three quantitative measures — Fractal Efficiency Ratio, a synthetic Hurst Exponent approximation, and a Garman-Klass volatility estimator — to classify each bar into one of three entropy states: LOW (predictable, directional structure present), TRANSITION (regime shift underway), and HIGH (chaotic, low-predictability environment). Directional signals from an Adaptive Momentum Oscillator are filtered to fire only during LOW entropy states, where momentum signals have historically more reliable edge than during random or chaotic market behavior.
The foundational premise is that markets alternate between periods of organized directional behavior and periods of disorganized random movement. Trading momentum signals indiscriminately across both environments degrades overall performance because the same signal that has edge in a trending market produces random outcomes in a chaotic one. By measuring the structural organization of price movement directly — rather than relying on ADX alone, which is a lagging momentum derivative — Entropic Regime Field attempts to identify when the market's behavior is organized enough for directional signals to have context.
Core Concepts
1. Fractal Efficiency Ratio (FER)
The FER measures how efficiently price has moved over a lookback period — the ratio of the net directional distance to the total path length of individual bar-to-bar changes. A value near 1.0 indicates straight-line directional movement; a value near 0.0 indicates constant reversals:
Pine Script®
2. Synthetic Hurst Exponent
The Hurst Exponent characterizes the memory of a time series. Values above 0.5 indicate persistence (trending), values near 0.5 indicate randomness, and values below 0.5 indicate anti-persistence (mean-reversion). A simplified Hurst estimate is computed using the variance ratio method:
Pine Script®
3. Garman-Klass Volatility Estimator
Standard ATR uses only the prior close and current high/low. The Garman-Klass estimator uses all four OHLC prices, producing a more statistically efficient estimate of true volatility:
Pine Script®
The GK estimate is averaged over a configurable period and normalized to a 0-100 percentile rank over the trailing 100 bars.
4. Three-Factor Entropy Classification
LOW entropy requires FER above a threshold AND ADX above a minimum AND Hurst estimate above 0.52. HIGH entropy is triggered when FER falls below a lower threshold OR ADX falls below a minimum. TRANSITION is the state between the two.
5. Adaptive Momentum Oscillator (AMO)
The AMO blends three momentum inputs with fixed weights: RSI(14) centered at 50 (40%), Stochastic(14) centered at 50 (35%), and Williams Percent Range(14) centered at -50 (25%). Directional signals fire only in LOW entropy when AMO crosses zero and KAMA confirms via crossover/under.
Features
Input Parameters
Fractal Efficiency:
Hurst Exponent:
Garman-Klass Volatility:
ADX Gate:
Signal:
How to Use This Indicator
Step 1: Read the Entropy State
Check the dashboard. LOW entropy means the market is behaving in an organized, directional way — this is when momentum signals carry more weight. HIGH entropy means the market is chaotic — avoid directional signals.
Step 2: Watch FER and Hurst Together
FER and Hurst are independent measures of market organization. When both agree (high FER AND Hurst > 0.52 simultaneously), the LOW entropy classification is more reliable.
Step 3: Enter on AMO + KAMA Confirmation
Signals fire only when the AMO crosses zero in the signal direction AND price crosses the KAMA level simultaneously. Both conditions must occur on the same confirmed bar in a LOW entropy environment.
Indicator Limitations
Originality Statement
Disclaimer
This indicator is provided for educational and informational purposes only. It is not financial advice. Trading involves substantial risk of loss. Entropy classifications are approximations based on historical price data and do not guarantee future market behavior will repeat. The Hurst approximation used is a simplified estimate, not a statistically rigorous computation. Past win rates do not predict future performance. The author accepts no responsibility for trading losses resulting from use of this indicator.
Made with passion by jackofalltrades
The foundational premise is that markets alternate between periods of organized directional behavior and periods of disorganized random movement. Trading momentum signals indiscriminately across both environments degrades overall performance because the same signal that has edge in a trending market produces random outcomes in a chaotic one. By measuring the structural organization of price movement directly — rather than relying on ADX alone, which is a lagging momentum derivative — Entropic Regime Field attempts to identify when the market's behavior is organized enough for directional signals to have context.
Core Concepts
1. Fractal Efficiency Ratio (FER)
The FER measures how efficiently price has moved over a lookback period — the ratio of the net directional distance to the total path length of individual bar-to-bar changes. A value near 1.0 indicates straight-line directional movement; a value near 0.0 indicates constant reversals:
float ferNet = math.abs(close - close[ferLen])
float ferPath = math.sum(math.abs(ta.change(close)), ferLen)
float ferVal = ferPath > 0.0 ? ferNet / ferPath : 0.0
2. Synthetic Hurst Exponent
The Hurst Exponent characterizes the memory of a time series. Values above 0.5 indicate persistence (trending), values near 0.5 indicate randomness, and values below 0.5 indicate anti-persistence (mean-reversion). A simplified Hurst estimate is computed using the variance ratio method:
float var1 = ta.variance(ta.change(close, 1), hurstWindow)
float var5 = ta.variance(ta.change(close, 5) / 5, hurstWindow)
float hurstEst= 0.5 * math.log(var1 / var5) / math.log(5) + 0.5
3. Garman-Klass Volatility Estimator
Standard ATR uses only the prior close and current high/low. The Garman-Klass estimator uses all four OHLC prices, producing a more statistically efficient estimate of true volatility:
gkBar = 0.5 * math.pow(math.log(high / math.max(low, syminfo.mintick)), 2.0)
- (2.0 * math.log(2.0) - 1.0) * math.pow(math.log(close / math.max(open, syminfo.mintick)), 2.0)
The GK estimate is averaged over a configurable period and normalized to a 0-100 percentile rank over the trailing 100 bars.
4. Three-Factor Entropy Classification
LOW entropy requires FER above a threshold AND ADX above a minimum AND Hurst estimate above 0.52. HIGH entropy is triggered when FER falls below a lower threshold OR ADX falls below a minimum. TRANSITION is the state between the two.
5. Adaptive Momentum Oscillator (AMO)
The AMO blends three momentum inputs with fixed weights: RSI(14) centered at 50 (40%), Stochastic(14) centered at 50 (35%), and Williams Percent Range(14) centered at -50 (25%). Directional signals fire only in LOW entropy when AMO crosses zero and KAMA confirms via crossover/under.
Features
- Fractal Efficiency Ratio: Net directional move divided by total path length, configurable lookback
- Synthetic Hurst Exponent: Variance ratio approximation identifying persistent vs. anti-persistent price behavior
- Garman-Klass volatility: OHLC-based volatility estimator normalized to percentile rank over 100 bars
- Three entropy states: LOW, TRANSITION, HIGH — each with distinct visual treatment
- 10-line entropy ribbon: EMA lines colored by entropy state for visual history of regime transitions
- Adaptive Momentum Oscillator: RSI + Stochastic + WPR composite with fixed optimal weights
- Entropy-gated signals: AMO + KAMA confirmation signals fire only in LOW entropy state
- Regime background tint: Background tinted by entropy state, cleared after 10 bars
- Trade block on signal: ATR-based TP and stop rendered as boxes on signal bars
- 12-row institutional dashboard: FER, Hurst estimate, GK volatility percentile, ADX, AMO, entropy state, signal, win rate, bars in current state
- Non-repainting: All signals gated by barstate.isconfirmed; no future data referenced
- Four color themes: Phantom, Neon, Classic, Solar
Input Parameters
Fractal Efficiency:
- FER Lookback (default: 14)
- LOW Entropy FER Minimum (default: 0.60)
- HIGH Entropy FER Maximum (default: 0.35)
Hurst Exponent:
- Hurst Window (default: 20)
- LOW Entropy Hurst Minimum (default: 0.52)
Garman-Klass Volatility:
- GK Averaging Length (default: 14)
ADX Gate:
- Min ADX for LOW Entropy (default: 22)
Signal:
- AMO Cross Threshold, KAMA Period, Cooldown Bars
- TP ATR Multiple, SL ATR Multiple
How to Use This Indicator
Step 1: Read the Entropy State
Check the dashboard. LOW entropy means the market is behaving in an organized, directional way — this is when momentum signals carry more weight. HIGH entropy means the market is chaotic — avoid directional signals.
Step 2: Watch FER and Hurst Together
FER and Hurst are independent measures of market organization. When both agree (high FER AND Hurst > 0.52 simultaneously), the LOW entropy classification is more reliable.
Step 3: Enter on AMO + KAMA Confirmation
Signals fire only when the AMO crosses zero in the signal direction AND price crosses the KAMA level simultaneously. Both conditions must occur on the same confirmed bar in a LOW entropy environment.
Indicator Limitations
- The Hurst approximation via variance ratio is a simplified estimate. It should be treated as a directional indicator of persistence, not a precise statistical measure
- The FER computation on every bar may affect chart loading performance for very long lookback periods on large datasets
- LOW entropy classifications can persist during slow grinding trends that produce high FER but low volatility. These environments may produce signals with narrower ATR-based targets
- The GK estimator can return unreliable values when open equals close (as occurs on some synthetic instruments or during gaps)
- This indicator classifies entropy state. It does not predict how long the state will persist or when it will change
Originality Statement
- The combination of Fractal Efficiency Ratio, synthetic Hurst Exponent via variance ratio, and Garman-Klass volatility estimator as a three-factor entropy classification system gating AMO momentum signals is not replicated in any existing open-source Pine Script v6 publication as of this writing
- The Garman-Klass estimator as a volatility input provides a more statistically efficient OHLC-based volatility measure that captures intraday range information not available in ATR
- Gating a composite three-input momentum oscillator by an entropy state derived from completely different mathematical principles (efficiency, persistence, and OHLC volatility) rather than using a single lagging derivative like ADX as the sole filter is an original analytical architecture
Disclaimer
This indicator is provided for educational and informational purposes only. It is not financial advice. Trading involves substantial risk of loss. Entropy classifications are approximations based on historical price data and do not guarantee future market behavior will repeat. The Hurst approximation used is a simplified estimate, not a statistically rigorous computation. Past win rates do not predict future performance. The author accepts no responsibility for trading losses resulting from use of this indicator.
Made with passion by jackofalltrades
Скрипт с открытым кодом
В истинном духе TradingView, создатель этого скрипта сделал его открытым исходным кодом, чтобы трейдеры могли проверить и убедиться в его функциональности. Браво автору! Вы можете использовать его бесплатно, но помните, что перепубликация кода подчиняется нашим Правилам поведения.
The AI Trading Ecosystem, Built to win trades 📈
Get Full Access 👇
jackofalltrades.vip 🌐
t.me/jackofalltradesvip 🃏
Get Full Access 👇
jackofalltrades.vip 🌐
t.me/jackofalltradesvip 🃏
Отказ от ответственности
Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.
Скрипт с открытым кодом
В истинном духе TradingView, создатель этого скрипта сделал его открытым исходным кодом, чтобы трейдеры могли проверить и убедиться в его функциональности. Браво автору! Вы можете использовать его бесплатно, но помните, что перепубликация кода подчиняется нашим Правилам поведения.
The AI Trading Ecosystem, Built to win trades 📈
Get Full Access 👇
jackofalltrades.vip 🌐
t.me/jackofalltradesvip 🃏
Get Full Access 👇
jackofalltrades.vip 🌐
t.me/jackofalltradesvip 🃏
Отказ от ответственности
Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.