Decycler

The Decycler of John Ehlers (2013) is the price minus its one-pole High-Pass Filter: what is left when the cycles shorter than the cutoff period n are taken out, the trend, with almost no lag. Angles are in degrees.

The formula for the Decycler first sets the coefficient alpha of the High-Pass Filter from the cutoff period n:

\[\alpha = \frac{\cos\left(\frac{360}{n}\right) + \sin\left(\frac{360}{n}\right) - 1}{\cos\left(\frac{360}{n}\right)}\]

The High-Pass Filter takes the change of the price over one period and adds its own last value:

\[\text{High Pass} = \left(1 - \frac{\alpha}{2}\right) \cdot (\text{Price} - \text{Price}_{t-1}) + (1 - \alpha) \cdot \text{High Pass}_{t-1}\]

The Decycler is the price without those cycles:

\[\text{Decycler} = \text{Price} - \text{High Pass}\]

Where Price is the median price or the close and Price(t-1) the price of the period before. It follows the price like a moving average with almost no lag: a rising Decycler shows an uptrend and a falling one a downtrend.

A filter in the sense of digital signal processing separates the movements of the price by their length: a high-pass filter keeps the short cycles and removes the trend, a low-pass filter keeps the trend and removes the short cycles (the noise), and a band-pass filter keeps only the cycles around one length. John Ehlers’ Swiss Army Knife indicator (2006) writes them all as one second-order recursive filter, a weighted sum of the latest prices and the filter’s own last two values, whose coefficients select its response; his decycler and roofing filter (2013) combine such filters. Each takes a cutoff period n: the cycle length that separates what the filter keeps from what it removes. Unlike a moving average, these filters remove what they are designed to remove with little lag, which is why Ehlers builds his cycle indicators on them.

Also known as: Ehlers decycler, simple decycler.

In the Finance Toolkit this is get_swiss_army_knife_filter with method="decycler", the same function as Swiss Army Knife Filter.

Example · AAPL, MSFT · 2021 to 2025

Install the Finance Toolkit with pip install financetoolkit -U, then call get_swiss_army_knife_filter:

from financetoolkit import Toolkit

toolkit = Toolkit(
    tickers=["AAPL", "MSFT"],
    api_key="FINANCIAL_MODELING_PREP_KEY",
    start_date="2021-01-01",
    end_date="2025-12-31",
)

toolkit.technicals.get_swiss_army_knife_filter(method="decycler")

Which returns:

References

  • Paper Ehlers, J.F. (2013). “Cycle Analytics for Traders: Advanced Technical Trading Concepts.” John Wiley & Sons, chapters 4 (the decycler) and 7 (the roofing filter).
Share