The Onset Trend strategy is based upon the Onset Trend Detector study, a zero-lag trend analyzing oscillator. This oscillator incorporates two filters, the Super Smoother Filter and the Roofing Filter, both developed by John F. Ehlers. Data derived from these two filters is processed by automatic gain control algorithm and then subjected to the quotient transform. The quotient transform, controlled by the K coefficient, collapses small oscillator values while keeping higher values high.

The strategy uses the oscillator twice, with different values of K coefficient. This ensures more precise trend detection. Suggested values for the coefficient are 0.8 and 0.4, customizable via input parameters. The strategy adds a simulated Buy order when the first oscillator crosses above zero (which corresponds to uptrend detection) and a Sell to close order when the second oscillator crosses below zero (which signifies that the uptrend is over).

Input Parameters


Defines the price to which the oscillator is applied.

cutoff length

Defines the minimum cycle length in bars. Cycles with lesser lengths will be considered noise and eliminated.

roof cutoff length

Defines the maximum cycle length in bars. Cycles with greater lengths will be considered spectral dilation and eliminated.


The K coefficient used in quotient transform for the first oscillator.


The K coefficient used in quotient transform for the second oscillator.

Further Reading

1. "The Quotient Transform" by John F. Ehlers. Technical Analysis of Stocks & Commodities, August 2014.