Detrend Cycle Oscillator [forexobroker]

Detrend Cycle Oscillator [forexobroker] estimates the dominant cycle in price by autocorrelation argmax search, then detrends close by an SMA of half that cycle and rescales the residual by ATR into a volatility-normalized oscillator. The unique angle is letting the data choose the SMA length: instead of guessing "21" or "55", the oscillator's lookback adapts to the cycle the market is actually running, bounded to the lag search range.
🔶 ALGORITHM
1. For each lag k in [min lag, max lag] (defaults 5 to 50), compute the rolling Pearson correlation between close and close[k] over the correlation window (default 30).
2. k_dom = argmax over k of that correlation; the strongest auto-similar lag is the dominant cycle.
3. Detrended price = close minus SMA(close, round(k_dom / 2)).
4. Oscillator = detrended / ATR(14) — volatility-scaled and unitless.
5. Smoothed oscillator = EMA of the oscillator over the oscillator EMA length (default 3).
6. Zero-crossings of the raw oscillator gate the signals; the smoothed oscillator must exceed the threshold (default 0.5) in the same direction.
🔶 SIGNAL LOGIC
- Buy: oscillator crosses up through zero AND smoothed oscillator is greater than +threshold AND position is not already long AND session filter passes AND cooldown bars elapsed AND barstate.isconfirmed.
- Sell: oscillator crosses down through zero AND smoothed oscillator is less than -threshold AND position is not already short AND session filter passes AND cooldown bars elapsed AND barstate.isconfirmed.
The smoothed threshold acts as a regime filter so a single noisy bar cannot trigger the indicator.
🔶 INPUTS
- Cycle Estimation group: min cycle lag default 5, max cycle lag default 50, correlation window default 30, ATR length default 14, oscillator EMA default 3.
- Signal Logic group: smoothed threshold default 0.5, cooldown bars default 15.
- Filters group: session restriction default 0000-2400.
- Visual group: dashboard, 3-layer glow, oscillator and smoothed colors, dashboard background.
🔶 ALERTS
DCO Buy, DCO Sell, DCO Any Signal, DCO Zero Cross Up, DCO Zero Cross Dn, DCO Overbought, DCO Oversold, DCO Cycle Shift, DCO Strong Lock, DCO Weak Lock, DCO Webhook JSON.
🔶 LIMITATIONS
- Autocorrelation argmax is sensitive to the correlation window; very short windows produce unstable cycle estimates.
- The lag search is bounded to [min lag, max lag]; true cycles outside the range will be misreported as the nearest bound.
- During strong directional moves the dominant cycle estimate degrades because autocorrelation is dominated by the trend rather than periodicity.
- The detrend uses an SMA of half the dominant cycle (rounded), introducing the usual SMA lag.
- The threshold filter reduces but does not eliminate whipsaws in low-volatility regimes.
🔶 ALGORITHM
1. For each lag k in [min lag, max lag] (defaults 5 to 50), compute the rolling Pearson correlation between close and close[k] over the correlation window (default 30).
2. k_dom = argmax over k of that correlation; the strongest auto-similar lag is the dominant cycle.
3. Detrended price = close minus SMA(close, round(k_dom / 2)).
4. Oscillator = detrended / ATR(14) — volatility-scaled and unitless.
5. Smoothed oscillator = EMA of the oscillator over the oscillator EMA length (default 3).
6. Zero-crossings of the raw oscillator gate the signals; the smoothed oscillator must exceed the threshold (default 0.5) in the same direction.
🔶 SIGNAL LOGIC
- Buy: oscillator crosses up through zero AND smoothed oscillator is greater than +threshold AND position is not already long AND session filter passes AND cooldown bars elapsed AND barstate.isconfirmed.
- Sell: oscillator crosses down through zero AND smoothed oscillator is less than -threshold AND position is not already short AND session filter passes AND cooldown bars elapsed AND barstate.isconfirmed.
The smoothed threshold acts as a regime filter so a single noisy bar cannot trigger the indicator.
🔶 INPUTS
- Cycle Estimation group: min cycle lag default 5, max cycle lag default 50, correlation window default 30, ATR length default 14, oscillator EMA default 3.
- Signal Logic group: smoothed threshold default 0.5, cooldown bars default 15.
- Filters group: session restriction default 0000-2400.
- Visual group: dashboard, 3-layer glow, oscillator and smoothed colors, dashboard background.
🔶 ALERTS
DCO Buy, DCO Sell, DCO Any Signal, DCO Zero Cross Up, DCO Zero Cross Dn, DCO Overbought, DCO Oversold, DCO Cycle Shift, DCO Strong Lock, DCO Weak Lock, DCO Webhook JSON.
🔶 LIMITATIONS
- Autocorrelation argmax is sensitive to the correlation window; very short windows produce unstable cycle estimates.
- The lag search is bounded to [min lag, max lag]; true cycles outside the range will be misreported as the nearest bound.
- During strong directional moves the dominant cycle estimate degrades because autocorrelation is dominated by the trend rather than periodicity.
- The detrend uses an SMA of half the dominant cycle (rounded), introducing the usual SMA lag.
- The threshold filter reduces but does not eliminate whipsaws in low-volatility regimes.
🔵Gain access to our powerful tools : kestutisbalciunas.com/tradingview/
🔵Join our free telegram for updates : t.me/algotradingedge
All scripts & content provided by Forexobroker are for informational & educational purposes only.
🔵Join our free telegram for updates : t.me/algotradingedge
All scripts & content provided by Forexobroker are for informational & educational purposes only.
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, alım satım veya diğer türden tavsiye veya öneriler anlamına gelmez ve teşkil etmez. Kullanım Koşulları bölümünde daha fazlasını okuyun.
🔵Gain access to our powerful tools : kestutisbalciunas.com/tradingview/
🔵Join our free telegram for updates : t.me/algotradingedge
All scripts & content provided by Forexobroker are for informational & educational purposes only.
🔵Join our free telegram for updates : t.me/algotradingedge
All scripts & content provided by Forexobroker are for informational & educational purposes only.
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, alım satım veya diğer türden tavsiye veya öneriler anlamına gelmez ve teşkil etmez. Kullanım Koşulları bölümünde daha fazlasını okuyun.