OPEN-SOURCE SCRIPT
Ehlers Decycler Oscillator [NovaLens]

Adaptive momentum oscillator built to separate two things most oscillators blur together: cycle rotation and distribution extremes. Auto-detects the dominant cycle, grades the oscillator against its own rolling history, and highlights confluence when both channels align.
Most oscillators conflate "the swing is high" with "the swing is reversing." They use the same colour, the same arrow, the same alert for both. The Decycler Oscillator separates them by design:
A reading at the upper extreme of the distribution is not a sell signal. It is the market saying "this is rare for me." Whether it actually reverses depends on the cycle channel. When both channels agree (a cycle turn happening right at a distribution extreme), that is the confluence event. Everything else is partial information, and the indicator says so.
════════════════════════════════════════════
◉ HOW IT WORKS
The filter. The core is John Ehlers' Decycler Oscillator (Cycle Analytics for Traders, 2013): a two-stage high-pass filter that strips the slow trend out of price and leaves the swing component. We run two of them in parallel (Fast at the dominant period, Slow at 1.25x) and read crossovers as cycle turns.
The adaptive period. The dominant period itself is detected, not assumed. On the Adaptive profile, an Autocorrelation Periodogram (Ehlers, 2016) scans a timeframe-derived range every bar, pulls the strongest cycle by power-weighted centre of gravity, and feeds that period into the filter. Scan range auto-tunes to the chart timeframe: 8-30 bars on intraday, 20-60 on daily and above. Fixed profiles (Reactive / Balanced / Smooth) skip the scan and lock the period for traders who already know the rhythm of their asset.
The rank window. The output is percentile-ranked over a rolling window (about 2x cycle period) to produce the four-tier distribution grade.
The window LOCKS on confirmed zero-line crosses. A mid-swing period shift cannot silently shrink the window and produce phantom Upper Extreme reads. That single lock helps keep the percentile grade more stable across regime transitions.
════════════════════════════════════════════
◈ HOW TO READ IT
The pane shows two lines (Fast and Slow) wrapped in a ribbon coloured by the current distribution tier:
Markers, in order of conviction:
The info panel (top right by default) synthesises all five channels into one Setup line: Strong Bull/Bear Setup, Continuation Forming, Topping/Bottoming, Trend Running Up/Down, Stretched, Drift, or Quiet, in priority order.
════════════════════════════════════════════
✦ HOW WE USE IT: CONFLUENCE OVER CROSSES
A common pattern on a liquid futures or crypto chart, Adaptive profile: ribbon goes Lower Extreme as price drops into a support zone. Lower Exhaustion fires (green circle, candle border tints orange). Within 2 bars, Fast crosses up through Slow, and a Reversal Confluence triangle prints below the ribbon. The Setup row reads "Strong bull setup." Tier transitions back through Lower into Upper on the next leg up.
That is the indicator doing its job: telling you the cycle and the distribution channels both agreed, in the same direction, within the same 2-bar window. Without confluence, the same cycle cross can appear frequently in choppy conditions and often carries less value on its own. Confluence is designed to reduce low-quality cycle flips by gating on the distribution extreme.
The Continuation pill addresses a different problem: spotting possible trend resumption. On a pullback within an uptrend, price holds a higher low while the oscillator prints a lower trough. That is hidden bullish divergence, which can support a continuation read rather than a reversal read. The indicator draws a small Bull pill below the ribbon. Built to be read quickly.
════════════════════════════════════════════
✦ OTHER APPLICATIONS
════════════════════════════════════════════
⚙ GETTING STARTED
The Ehlers Decycler Oscillator ships with practical starting profiles:
Core settings:
Continuation settings:
Marker settings:
Display:
════════════════════════════════════════════
△ LIMITATIONS
════════════════════════════════════════════
🔔 ALERTS
Ten alert conditions are built in so you can monitor without checking every bar manually:
All ten alerts fire on bar close (gated on barstate.isconfirmed). Each alert message includes ticker, price, timeframe, and timestamp placeholders for webhook routing.
════════════════════════════════════════════
⌁ NOTES
NovaLens
Most oscillators conflate "the swing is high" with "the swing is reversing." They use the same colour, the same arrow, the same alert for both. The Decycler Oscillator separates them by design:
- Cycle channel tracks WHERE the swing is in its rotation (Rising / Topping / Falling / Bottoming).
- Distribution channel tracks WHERE the value sits in its own rolling history (Upper Extreme / Upper / Lower / Lower Extreme).
A reading at the upper extreme of the distribution is not a sell signal. It is the market saying "this is rare for me." Whether it actually reverses depends on the cycle channel. When both channels agree (a cycle turn happening right at a distribution extreme), that is the confluence event. Everything else is partial information, and the indicator says so.
════════════════════════════════════════════
◉ HOW IT WORKS
The filter. The core is John Ehlers' Decycler Oscillator (Cycle Analytics for Traders, 2013): a two-stage high-pass filter that strips the slow trend out of price and leaves the swing component. We run two of them in parallel (Fast at the dominant period, Slow at 1.25x) and read crossovers as cycle turns.
The adaptive period. The dominant period itself is detected, not assumed. On the Adaptive profile, an Autocorrelation Periodogram (Ehlers, 2016) scans a timeframe-derived range every bar, pulls the strongest cycle by power-weighted centre of gravity, and feeds that period into the filter. Scan range auto-tunes to the chart timeframe: 8-30 bars on intraday, 20-60 on daily and above. Fixed profiles (Reactive / Balanced / Smooth) skip the scan and lock the period for traders who already know the rhythm of their asset.
The rank window. The output is percentile-ranked over a rolling window (about 2x cycle period) to produce the four-tier distribution grade.
The window LOCKS on confirmed zero-line crosses. A mid-swing period shift cannot silently shrink the window and produce phantom Upper Extreme reads. That single lock helps keep the percentile grade more stable across regime transitions.
════════════════════════════════════════════
◈ HOW TO READ IT
The pane shows two lines (Fast and Slow) wrapped in a ribbon coloured by the current distribution tier:
- Teal: Upper Extreme
- Dark teal: Upper
- Burgundy: Lower
- Red: Lower Extreme
Markers, in order of conviction:
- Cycle Cross (small triangle): Fast crossed Slow in a tier-aligned direction. "Cycle just flipped." Mid-tier crosses are filtered out as chop noise.
- Reversal Confluence (large triangle): a cycle cross within 0-2 bars of a same-side exhaustion signal. Both channels agreed. This is the primary event the indicator is built around.
- Exhaustion (small circle, colour inverted): oscillator peaked or troughed at the extreme of its rolling distribution. Colour is inverted by design to make exhaustion easier to read. A RED peak means upside pressure may be cooling. A GREEN trough means downside pressure may be fading. Distribution extremes are non-directional information.
- Continuation (Bull/Bear pill, small rounded label "Bull" / "Bear"): hidden divergence. Oscillator made a lower trough while close made a higher close (Bull), or oscillator made a higher peak while close made a lower close (Bear). This can support a continuation read rather than a reversal read.
The info panel (top right by default) synthesises all five channels into one Setup line: Strong Bull/Bear Setup, Continuation Forming, Topping/Bottoming, Trend Running Up/Down, Stretched, Drift, or Quiet, in priority order.
════════════════════════════════════════════
✦ HOW WE USE IT: CONFLUENCE OVER CROSSES
A common pattern on a liquid futures or crypto chart, Adaptive profile: ribbon goes Lower Extreme as price drops into a support zone. Lower Exhaustion fires (green circle, candle border tints orange). Within 2 bars, Fast crosses up through Slow, and a Reversal Confluence triangle prints below the ribbon. The Setup row reads "Strong bull setup." Tier transitions back through Lower into Upper on the next leg up.
That is the indicator doing its job: telling you the cycle and the distribution channels both agreed, in the same direction, within the same 2-bar window. Without confluence, the same cycle cross can appear frequently in choppy conditions and often carries less value on its own. Confluence is designed to reduce low-quality cycle flips by gating on the distribution extreme.
The Continuation pill addresses a different problem: spotting possible trend resumption. On a pullback within an uptrend, price holds a higher low while the oscillator prints a lower trough. That is hidden bullish divergence, which can support a continuation read rather than a reversal read. The indicator draws a small Bull pill below the ribbon. Built to be read quickly.
════════════════════════════════════════════
✦ OTHER APPLICATIONS
- Reversal context: confluence triangles after a cycle turn at the distribution extreme, optionally combined with the Setup row reading Strong Bull/Bear Setup
- Trend continuation: Bull/Bear pills inside a clean directional move, used as continuation context inside an existing trend plan
- Distribution awareness: Upper Extreme / Lower Extreme tier reads as a "rare for this market" cue, layered on top of any external trade plan
- Cycle phase tracking: the info-panel Phase row (Rising / Topping / Falling / Bottoming) as a regime descriptor for higher-timeframe positioning
- Alert-driven workflow: subscribe to confluence and exhaustion alerts to reduce chart-watching and focus only on higher-priority events
════════════════════════════════════════════
⚙ GETTING STARTED
The Ehlers Decycler Oscillator ships with practical starting profiles:
- Adaptive (default): Autocorrelation Periodogram detects the dominant cycle every bar. Useful when the asset's typical cycle is unclear.
- Reactive: HP Period 40, faster turns. Use on shorter timeframes or fast-moving instruments.
- Balanced: HP Period 80, middle ground. A reasonable starting point on most assets if you want a fixed period.
- Smooth: HP Period 125, slower turns. Use on higher timeframes or when you want only larger-scale rotations.
- Custom: full manual control of HP Period and Rank Window.
Core settings:
- Profile: selects the tuning bundle above. Start with Adaptive.
- HP Period (Custom): dominant cycle the filter targets, in BARS. 80 means 80 candles. The calendar time depends on the market and timeframe. Longer = smoother, fewer turns; shorter = more reactive.
- Rank Window (Custom): rolling lookback for the 4-tier percentile grade. Rule of thumb: about 2x HP Period.
- Min/Max Period Override (Adaptive): clamp the cycle scan range. 0 = auto-derive from chart timeframe.
Continuation settings:
- Show Bull/Bear (Continuation): toggle the hidden-divergence pills.
- Max Lookback (Continuation): bars between the two extremes that define a continuation pattern. 0 = auto: 2x average cycle once 3 cycles confirm, else 40.
Marker settings:
- Show Cycle Crosses / Show Confluence Crosses: independent toggles. Turn cycle crosses OFF and confluence ON to see only primary confluence events.
- Show Exhaustion: distribution-extreme circles on the ribbon. Colour INVERTED by design.
- Show Price Chart Markers: mirrors confluence and exhaustion onto the price chart.
Display:
- Show Info Panel: 5-row panel (Tier / Phase / Exhaustion / Setup / Cycle). On by default.
- Light Theme Mode: swap info-panel colours for light chart backgrounds.
════════════════════════════════════════════
△ LIMITATIONS
- Warm-up: Adaptive needs a brief warm-up period (typically 40-80 bars depending on timeframe) before the cycle scan returns confident readings. Until then, the info panel shows "warming up..." and signals are suppressed.
- Choppy markets: when the autocorrelation power drops below 0.5, the cycle confidence is "Low" and the indicator says so. Weak signal tends to produce noisy reads.
- Adaptive period drift: fast HP-period changes can make the oscillator amplitude jump. The alpha-smoothing pass softens this, but in extreme regime shifts the first 5-10 bars after a shift may read noisier.
- Fixed profiles bypass cycle confidence: Reactive / Balanced / Smooth do not run the cycle scan, so they cannot tell you when the rhythm is unclear. Adaptive can.
- Continuation needs at least 8 bars between extremes: pivots closer than that are filtered as noise. On very fast intraday timeframes this can suppress otherwise-valid patterns.
- Continuation in parabolic moves: hidden divergence can chain-fire on blow-off legs because momentum stays pinned at the extreme while price continues to expand, marking same-direction pills back-to-back when momentum is overstretched. They remain continuation reads, not exhaustion warnings.
════════════════════════════════════════════
🔔 ALERTS
Ten alert conditions are built in so you can monitor without checking every bar manually:
- Upper Exhaustion / Lower Exhaustion: oscillator peaked or troughed at the extreme of its rolling distribution. The RED-at-top, GREEN-at-bottom inversion still applies.
- Topping / Bottoming: cycle phase transitioned (Rising to Topping, or Falling to Bottoming).
- Bull Cross / Bear Cross: Fast crossed Slow in a tier-aligned direction without a same-side exhaustion in the prior 2 bars.
- Bull Cross Confluence / Bear Cross Confluence: Fast crossed Slow within 2 bars of a same-side exhaustion signal. The main confluence event.
- Bull Continuation / Bear Continuation: hidden-divergence pattern confirmed (oscillator and price disagreement in the trend direction).
All ten alerts fire on bar close (gated on barstate.isconfirmed). Each alert message includes ticker, price, timeframe, and timestamp placeholders for webhook routing.
════════════════════════════════════════════
⌁ NOTES
- The original Decycler Oscillator construction was developed against a Python reference implementation under PyneCore.
- Repaint: intrabar-only. Closed-bar alerts are confirmed; current-bar visuals may update until the bar closes. All alert conditions are gated on barstate.isconfirmed.
- References: John F. Ehlers, Cycle Analytics for Traders (2013), Wiley; Ehlers, Autocorrelation Periodogram (Stocks & Commodities, 2016).
- Open-source under MPL 2.0. Free to use, fork, study.
NovaLens
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.
NovaLens builds systematic indicators from real quant research - designed for a cleaner market view.
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.
NovaLens builds systematic indicators from real quant research - designed for a cleaner market view.
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.