OPEN-SOURCE SCRIPT
Ehlers Dominant Cycle Stochastic RSI

Ehlers Enhanced Cycle Stochastic RSI
OVERVIEW
The Ehlers Enhanced Cycle Stochastic RSI is a momentum oscillator that automatically adjusts its lookback periods based on the dominant market cycle. Unlike traditional Stochastic RSI which uses fixed periods, this indicator detects the current cycle length and scales its calculations—making it responsive in fast markets and stable in slow ones.
The indicator combines John Ehlers' digital signal processing research with the classic Stochastic RSI indicator, then adds a confirmation system to ensure cycle measurements are reliable.
THE THEORY
Traditional oscillators use fixed lookback periods (ie, 14-bar RSI). This creates a fundamental problem: markets don't move in fixed cycles. A 14-period RSI might capture the rhythm perfectly during one market phase, then completely miss it when conditions change.
Ehlers' research demonstrated that price data contains measurable cyclical components. If you can detect the dominant cycle length, you can tune your indicators to match it—like tuning a radio to the right frequency.
This indicator takes that concept further by using three independent cycle detection methods and only trusting the measurement when they agree:
When all three methods converge on similar period estimates, confidence is high. When they disagree, the market may be in a non-cyclical or in transition.
HOW IT CHANGES THE STOCHASTIC RSI
Standard Stochastic RSI:
1. Calculate RSI with fixed period (14 bars)
2. Apply Stochastic formula over fixed period (14 bars)
3. Smooth with fixed periods
Ehlers Enhanced Cycle Stochastic RSI:
1. Detect dominant cycle using three methods
2. Confirm cycle measurement (methods must agree)
3. Calculate RSI with period scaled to the detected cycle
4. Apply Stochastic formula with cycle-scaled lookback
5. Smooth adaptively
The result: when the market is cycling quickly (say, 15-bar cycles), the indicator uses shorter periods and responds faster. When the market stretches into longer cycles (such as 40-bar cycles), it automatically extends its lookback to avoid whipsaws.
The Period Multipliers let you fine-tune this relationship:
• 1.0 = Use the full detected cycle (smoother, fewer signals)
• 0.5 = Use half the cycle (more responsive, catches turns earlier)
INTERPRETATION
Reading the Oscillator:
• K Line (Blue) — The main signal line. Moves between 0 and 100.
• D Line (Orange) — Smoothed version of K. Use for confirmation.
• Above 80 — Overbought. Momentum stretched to upside.
• Below 20 — Oversold. Momentum stretched to downside.
• Crossovers — K crossing above D suggests bullish momentum shift; K crossing below D suggests bearish.
Spectral Dilation (optional):
When enabled, applies a bandpass filter before cycle detection. This isolates the frequency band of interest and reduces noise. Useful for:
• Very noisy instruments
• Lower timeframes
• When confidence stays persistently low
OVERVIEW
The Ehlers Enhanced Cycle Stochastic RSI is a momentum oscillator that automatically adjusts its lookback periods based on the dominant market cycle. Unlike traditional Stochastic RSI which uses fixed periods, this indicator detects the current cycle length and scales its calculations—making it responsive in fast markets and stable in slow ones.
The indicator combines John Ehlers' digital signal processing research with the classic Stochastic RSI indicator, then adds a confirmation system to ensure cycle measurements are reliable.
THE THEORY
Traditional oscillators use fixed lookback periods (ie, 14-bar RSI). This creates a fundamental problem: markets don't move in fixed cycles. A 14-period RSI might capture the rhythm perfectly during one market phase, then completely miss it when conditions change.
Ehlers' research demonstrated that price data contains measurable cyclical components. If you can detect the dominant cycle length, you can tune your indicators to match it—like tuning a radio to the right frequency.
This indicator takes that concept further by using three independent cycle detection methods and only trusting the measurement when they agree:
- Hilbert Transform — A mathematical technique from signal processing that extracts cycle period from the phase relationship between price and its derivative. It is fast but can be noisy.
- Autocorrelation Periodogram — Measures how similar the price series is to lagged versions of itself. The lag with highest correlation reveals the dominant cycle. More stable than Hilbert, but slightly slower to adapt.
- Goertzel Algorithm (DFT) — A frequency-domain approach that calculates spectral power at each candidate period. Identifies which frequencies contain the most energy.
When all three methods converge on similar period estimates, confidence is high. When they disagree, the market may be in a non-cyclical or in transition.
HOW IT CHANGES THE STOCHASTIC RSI
Standard Stochastic RSI:
1. Calculate RSI with fixed period (14 bars)
2. Apply Stochastic formula over fixed period (14 bars)
3. Smooth with fixed periods
Ehlers Enhanced Cycle Stochastic RSI:
1. Detect dominant cycle using three methods
2. Confirm cycle measurement (methods must agree)
3. Calculate RSI with period scaled to the detected cycle
4. Apply Stochastic formula with cycle-scaled lookback
5. Smooth adaptively
The result: when the market is cycling quickly (say, 15-bar cycles), the indicator uses shorter periods and responds faster. When the market stretches into longer cycles (such as 40-bar cycles), it automatically extends its lookback to avoid whipsaws.
The Period Multipliers let you fine-tune this relationship:
• 1.0 = Use the full detected cycle (smoother, fewer signals)
• 0.5 = Use half the cycle (more responsive, catches turns earlier)
INTERPRETATION
Reading the Oscillator:
• K Line (Blue) — The main signal line. Moves between 0 and 100.
• D Line (Orange) — Smoothed version of K. Use for confirmation.
• Above 80 — Overbought. Momentum stretched to upside.
• Below 20 — Oversold. Momentum stretched to downside.
• Crossovers — K crossing above D suggests bullish momentum shift; K crossing below D suggests bearish.
Spectral Dilation (optional):
When enabled, applies a bandpass filter before cycle detection. This isolates the frequency band of interest and reduces noise. Useful for:
• Very noisy instruments
• Lower timeframes
• When confidence stays persistently low
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
discord.gg/REapC6SGtz
b3artrades@gmail.com
b3artrades@gmail.com
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
discord.gg/REapC6SGtz
b3artrades@gmail.com
b3artrades@gmail.com
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.