Cyber Cycle

Calculate Ehlers’ Cyber Cycle: the cycle of the prices with the trend taken out by a two-pole high-pass filter, and its trigger line, whose crossings mark the turns of the cycle.

The Cyber Cycle of Ehlers (2004) first smooths the prices with a four-period triangular filter, which removes the two- and three-period cycles, and then takes out the trend with a two-pole high-pass filter. What is left is the cycle component, centred on zero, which turns with little lag. The trigger is the cycle one period before: the cycle crossing above its trigger is a turn up, crossing below a turn down.

The first seven periods (t counted from 1) use the second difference of the price itself.

The formula is as follows:

\[\text{Smooth} = \frac{\text{Price} + 2 \cdot \text{Price}_{t-1} + 2 \cdot \text{Price}_{t-2} + \text{Price}_{t-3}}{6}\] \[\text{Cycle} = \left(1 - \frac{\text{Alpha}}{2}\right)^{2} \cdot (\text{Smooth} - 2 \cdot \text{Smooth}_{t-1} + \text{Smooth}_{t-2}) + 2 \cdot (1 - \text{Alpha}) \cdot \text{Cycle}_{t-1} - (1 - \text{Alpha})^{2} \cdot \text{Cycle}_{t-2}\] \[\text{Cycle} = \frac{\text{Price} - 2 \cdot \text{Price}_{t-1} + \text{Price}_{t-2}}{4} \quad \text{if } t \leq 7\] \[\text{Trigger} = \text{Cycle}_{t-1}\]

Also known as: Cyber Cycle, Ehlers Cyber Cycle, cybernetic cycle.

Example · AAPL · 2021 to 2025

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

from financetoolkit import Toolkit

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

toolkit.technicals.get_cyber_cycle().xs("AAPL", level=1, axis="columns")

Or, with the Finance Toolkit MCP set up, ask an AI assistant such as Claude or ChatGPT:

What were Ehlers' Cyber Cycle of Apple's share price and its trigger line over the last five trading days of 2025, with data from 2021?

Which returns:

Parameters

get_cyber_cycle accepts the following parameters.

ParameterTypeDescriptionExample
periodstrThe time period to consider for historical data. Options are: “intraday” (intraday prices), “daily” (daily prices), “weekly” (weekly prices), “monthly” (monthly prices), “quarterly” (quarterly prices), “yearly” (yearly prices). Defaults to “daily”."weekly"
close_columnstrThe column name for closing prices in the historical data. Defaults to “Adj Close”, in which case the high and low prices are adjusted for dividends in the same way."Close"
median_priceboolWhether to filter the median price (High + Low) / 2, as Ehlers does, or the close of close_column. Defaults to True.True
alphafloatThe smoothing factor of the high-pass filter, above 0 and below 1: a lower value keeps longer cycles. Defaults to 0.07, as in Ehlers’ listing.0.01
roundingint | NoneThe number of decimals to round the results to. Defaults to None, which uses the rounding of the Toolkit (4 unless set otherwise).2
growthboolWhether to calculate the growth of the Cyber Cycle. Defaults to False.True
lagint | list[int]The lag to use for the growth calculation. Defaults to 1.4
standardizeboolWhether to standardize (Z-Score) the result. When combined with growth=True, standardizes the growth values instead of the raw values. Defaults to False.True
transformstr | list[str] | NoneTime series steps applied in order, such as “sma:12” (moving average), “ema:12”, “std:12”, “zscore:60”, “percentile:120”, “yoy”, “pct_change:3,annualize:3”, “log”, “diff”, “cumsum” or “hp_trend” and “hp_cycle” (Hodrick-Prescott), before growth. A window needs that many periods of history, so the first periods can be empty. Defaults to None.None
show_columnsstr | list[str] | NoneThe columns to keep, a name or a list of names, matched on every column level, or the rows when no column has those names (such as the line items of a financial statement). Names that do not exist are logged, and when none exist the result is returned in full. Defaults to None, which keeps every column.None, which keeps every column

References

  • Paper Ehlers, J.F. (2004). “Cybernetic Analysis for Stocks and Futures.” John Wiley & Sons, chapter 4, “Trading the Cycle.”
Share