OPEN-SOURCE SCRIPT

Ehlers Stable Dominant Cycle Length [graylange]

111
Stable Dominant Cycle Length – Adaptive Cycle Detection for Market Timing
This script calculates the dominant cycle length of the market using an improved version of John Ehlers' Hilbert Transform approach. Unlike traditional implementations, this version includes advanced smoothing techniques to reduce noise and prevent erratic spikes, making it more reliable for adaptive cycle-based strategies.

🔥 Key Features:
✅ Noise-Reduced Cycle Detection – Uses a Weighted Moving Average (WMA) detrending method instead of raw Hilbert Transform values to enhance stability.
✅ Adaptive Smoothing – Applies an Exponential Moving Average (EMA) to the instantaneous period, reducing excessive volatility in cycle length calculations.
✅ Phase Wrapping & Constraints – Clamps phase changes to prevent unrealistic cycle swings and division errors.
✅ Dynamic Cycle Adjustment – The dominant cycle length updates in real time, constrained within a reasonable range (6 to 50 bars) to avoid extreme peaks.

📌 How to Use It:
Identify Market Cycles – Use the dominant cycle length to determine optimal trend-following vs. mean-reversion strategies.
Enhance MESA Filters – Apply the detected cycle length to adjust Ehlers’ MESA Adaptive Moving Average (MAMA) dynamically.
Fine-Tune Alpha Settings – Reduce overfitting in cycle-based indicators by basing parameters on a stable dominant cycle estimate.

Clause de non-responsabilité

Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.