Files
QuanTAlib/lib/oscillators/deco/Deco.md
T
Miha Kralj 3dd05f23e4 Refactor indicators to include "Ehlers" in names and descriptions for clarity
- Updated the name and description of the Hilbert Trendline (HTIT) to "Ehlers Hilbert Transform Instantaneous Trend (HTIT)".
- Changed the name and description of the MESA Adaptive Moving Average (MAMA) to "Ehlers MESA Adaptive Moving Average".
- Modified the Center of Gravity (CG) indicator to "Ehlers Center of Gravity (CG)".
- Renamed the Detrended Synthetic Price (DSP) to "Ehlers Detrended Synthetic Price (DSP)".
- Updated the Autocorrelation Periodogram (EACP) to "Ehlers Autocorrelation Periodogram (EACP)".
- Changed the Homodyne Discriminator (HOMOD) to "Ehlers Homodyne Discriminator (HOMOD)".
- Updated the Hilbert Transform Dominant Cycle Period and Phase indicators to include "Ehlers" in their names.
- Renamed the Hilbert Transform Phasor Components to "Ehlers Hilbert Transform Phasor Components (HT_PHASOR)".
- Updated the SineWave indicator to "Ehlers Hilbert Transform SineWave (HT_SINE)".
- Changed the Phasor Analysis indicator to "Ehlers Hilbert Transform Phasor Components (HT_PHASOR)".
- Updated the SSF-Based Detrended Synthetic Price to "Ehlers SSF Detrended Synthetic Price (SSFDSP)".
- Renamed the Ultimate Channel to "Ehlers Ultimate Channel (UCHANNEL)".
- Added new indicators: Moving Average Variable Period (MAVP), Ehlers Predictive Moving Average (PMA), Ehlers Reverse EMA (REVERSEEMA), and Ehlers Trendflex Indicator (TRENDFLEX).
- Updated various SVG badges to reflect changes in classes, comments, source files, lines of code, methods, and public types.
2026-02-18 19:08:15 -08:00

87 lines
3.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# DECO: Ehlers Decycler Oscillator
## Overview
The Decycler Oscillator (DECO) is a DSP-based oscillator developed by John F. Ehlers that isolates intermediate-frequency market cycles. It computes the difference between two 2-pole Butterworth high-pass filters with different cutoff periods, revealing the spectral band between the two cutoff frequencies.
## Origin
- **Author:** John F. Ehlers
- **Source:** "Decyclers", Technical Analysis of Stocks & Commodities, September 2015
- **Category:** Oscillator / Digital Signal Processing
## Formula
The DECO uses two 2-pole Butterworth high-pass filters:
```
α = (cos(0.707 × 2π/period) + sin(0.707 × 2π/period) - 1) / cos(0.707 × 2π/period)
HP[n] = (1 - α/2)² × (x[n] - 2×x[n-1] + x[n-2]) + 2×(1-α) × HP[n-1] - (1-α× HP[n-2]
DECO = HP_long - HP_short
```
The 0.707 factor (1/√2) places the filter response at the -3 dB Butterworth design point.
### Transfer Function
Each HP filter has the z-domain transfer function:
```
H(z) = (1-α/2)² × (1 - 2z⁻¹ + z⁻²) / (1 - 2(1-α)z⁻¹ + (1-α)²z⁻²)
```
The DECO output is the difference H_long(z) - H_short(z), which forms a bandpass response isolating cycles between the short and long cutoff periods.
## Parameters
| Parameter | Type | Default | Range | Description |
|-----------|------|---------|-------|-------------|
| shortPeriod | int | 30 | > 0 | Short HP cutoff period (bars) |
| longPeriod | int | 60 | > shortPeriod | Long HP cutoff period (bars) |
## Interpretation
The Decycler Oscillator provides several analytical perspectives:
- **Zero-Line Crossovers:**
- Crossing above zero indicates bullish cycle momentum
- Crossing below zero indicates bearish cycle momentum
- The zero-crossing timing is relatively lag-free
- **Band Isolation:**
- The oscillator extracts only cycles within the frequency band defined by the two cutoff periods
- Shorter cycles and longer trends are both rejected
- This makes the oscillator highly selective
- **Divergence Analysis:**
- Bullish divergence: price makes lower lows while DECO makes higher lows
- Bearish divergence: price makes higher highs while DECO makes lower highs
- Indicates potential trend reversal
- **Multiple Instance Analysis:**
- Ehlers recommends using multiple DECO instances with different period pairs
- Crossovers between instances with different coefficients can identify trend reversals
## Warmup Period
The indicator requires `longPeriod` bars before producing reliable output. The first two bars always output zero (insufficient price history for the 2-pole HP filter).
## Properties
- **Range:** Unbounded (oscillates around zero)
- **Complexity:** O(1) per bar (pure IIR filter, no lookback buffer needed)
- **Memory:** O(1) — only stores filter state variables
## Related Indicators
- **Decycler (DECYCLER):** The low-pass complement — removes cycles, keeps trend
- **SSF-DSP:** Similar concept using Super Smooth Filters instead of HP filters
- **Roofing Filter:** HP + SSF combination for cycle isolation
- **BandPass Filter:** Ehlers' direct bandpass approach
## References
1. Ehlers, J. F. (2015). "Decyclers." *Technical Analysis of Stocks & Commodities*, September 2015.
2. Ehlers, J. F. (2013). *Cycle Analytics for Traders*. Wiley. Chapter 4.