OPEN-SOURCE SCRIPT
Hurst ALMA Tuned Chandelier Exit

Hurst × ALMA Tuned Chandelier Exit (HurstALMA-CE)
Public Description
Hurst × ALMA Tuned Chandelier Exit (HurstALMA-CE) is an adaptive trend‑following stop and exit indicator. It combines a smoothed price input (ALMA), a regime detector based on the Hurst exponent, and a dynamically tuned Chandelier Exit to automatically adjust its behavior between choppy and trending market conditions.
Instead of using a single fixed Chandelier configuration, the indicator continuously measures whether price action is behaving more like noise or a persistent trend. In choppy markets, it becomes more conservative by using shorter lookbacks and wider ATR multiples to reduce whipsaws. In trending markets, it tightens the stop and extends the lookback to better lock in gains while staying aligned with the trend.
The result is a regime‑aware trailing exit that adapts in real time, helping traders stay in strong trends longer while avoiding over‑sensitivity during sideways price action. HurstALMA‑CE can be used as a visual trailing stop, a trend confirmation overlay, or as an exit engine inside discretionary or systematic strategies.
Quantitative Description
1. Input Series
Price is optionally pre‑filtered using an Arnaud Legoux Moving Average (ALMA), defined by length, offset, and sigma parameters. This smoothed series is used as the input to the Hurst estimator to reduce high‑frequency noise.
2. Hurst Exponent Proxy
The indicator estimates the Hurst exponent using a variance‑scaling method. For fixed lags (8, 16, 32, 64), price differences are computed and their variances are measured over a rolling lookback window. A log‑log regression of variance versus lag produces a slope, which is mapped to a Hurst estimate via:
H ≈ 0.5 × slope.
The raw estimate is smoothed using an EMA to improve stability.
3. Regime Weight Mapping
The smoothed Hurst value is linearly mapped into a normalized weight w ∈ [0, 1] using user‑defined low‑H (choppy) and high‑H (trending) thresholds. Values below the low threshold map to w = 0, values above the high threshold map to w = 1.
4. Adaptive Chandelier Parameters
The Chandelier Exit length and ATR multiplier are interpolated between two parameter sets:
• Chop regime (shorter length, wider multiplier)
• Trend regime (longer length, tighter multiplier)
Interpolation is performed as:
CE_len = CE_len_chop + w × (CE_len_trend − CE_len_chop)
CE_mult = CE_mult_chop + w × (CE_mult_trend − CE_mult_chop)
Before sufficient data is available for the Hurst calculation, fallback Chandelier parameters are used.
5. Output
The final output consists of long and short Chandelier Exit levels computed using the dynamically tuned parameters. Optional status values expose the current Hurst estimate, regime weight, and active Chandelier settings for diagnostics and strategy development.
Public Description
Hurst × ALMA Tuned Chandelier Exit (HurstALMA-CE) is an adaptive trend‑following stop and exit indicator. It combines a smoothed price input (ALMA), a regime detector based on the Hurst exponent, and a dynamically tuned Chandelier Exit to automatically adjust its behavior between choppy and trending market conditions.
Instead of using a single fixed Chandelier configuration, the indicator continuously measures whether price action is behaving more like noise or a persistent trend. In choppy markets, it becomes more conservative by using shorter lookbacks and wider ATR multiples to reduce whipsaws. In trending markets, it tightens the stop and extends the lookback to better lock in gains while staying aligned with the trend.
The result is a regime‑aware trailing exit that adapts in real time, helping traders stay in strong trends longer while avoiding over‑sensitivity during sideways price action. HurstALMA‑CE can be used as a visual trailing stop, a trend confirmation overlay, or as an exit engine inside discretionary or systematic strategies.
Quantitative Description
1. Input Series
Price is optionally pre‑filtered using an Arnaud Legoux Moving Average (ALMA), defined by length, offset, and sigma parameters. This smoothed series is used as the input to the Hurst estimator to reduce high‑frequency noise.
2. Hurst Exponent Proxy
The indicator estimates the Hurst exponent using a variance‑scaling method. For fixed lags (8, 16, 32, 64), price differences are computed and their variances are measured over a rolling lookback window. A log‑log regression of variance versus lag produces a slope, which is mapped to a Hurst estimate via:
H ≈ 0.5 × slope.
The raw estimate is smoothed using an EMA to improve stability.
3. Regime Weight Mapping
The smoothed Hurst value is linearly mapped into a normalized weight w ∈ [0, 1] using user‑defined low‑H (choppy) and high‑H (trending) thresholds. Values below the low threshold map to w = 0, values above the high threshold map to w = 1.
4. Adaptive Chandelier Parameters
The Chandelier Exit length and ATR multiplier are interpolated between two parameter sets:
• Chop regime (shorter length, wider multiplier)
• Trend regime (longer length, tighter multiplier)
Interpolation is performed as:
CE_len = CE_len_chop + w × (CE_len_trend − CE_len_chop)
CE_mult = CE_mult_chop + w × (CE_mult_trend − CE_mult_chop)
Before sufficient data is available for the Hurst calculation, fallback Chandelier parameters are used.
5. Output
The final output consists of long and short Chandelier Exit levels computed using the dynamically tuned parameters. Optional status values expose the current Hurst estimate, regime weight, and active Chandelier settings for diagnostics and strategy development.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.