Editors' picks
OPEN-SOURCE SCRIPT

TASC 2025.04 The Ultimate Oscillator

5 606
█ OVERVIEW

This script implements an alternative, refined version of the Ultimate Oscillator (UO) designed to reduce lag and enhance responsiveness in momentum indicators, as introduced by John F. Ehlers in his article "Less Lag In Momentum Indicators, The Ultimate Oscillator" from the April 2025 edition of TASC's Traders' Tips.


█ CONCEPTS

In his article, Ehlers states that indicators are essentially filters that remove unwanted noise (i.e., unnecessary information) from market data. Simply put, they process a series of data to place focus on specific information, providing a different perspective on price dynamics. Various filter types attenuate different periodic signals within the data. For instance, a lowpass filter allows only low-frequency signals, a highpass filter allows only high-frequency signals, and a bandpass filter allows signals within a specific frequency range.

Ehlers explains that the key to removing indicator lag is to combine filters of different types in such a way that the result preserves necessary, useful signals while minimizing delay (lag). His proposed UltimateOscillator aims to maintain responsiveness to a specific frequency range by measuring the difference between two highpass filters' outputs. The oscillator uses the following formula:

UO = (HP1 - HP2) / RMS

Where:
  • HP1 is the first highpass filter.
  • HP2 is another highpass filter that allows only shorter wavelengths than the critical period of HP1.
  • RMS is the root mean square of the highpass filter difference, used as a scaling factor to standardize the output.


The resulting oscillator is similar to a bandpass filter, because it emphasizes wavelengths between the critical periods of the two highpass filters. Ehlers' UO responds quickly to value changes in a series, providing a responsive view of momentum with little to no lag.


█ USAGE

Ehlers' UltimateOscillator sets the critical periods of its highpass filters using two parameters: BandEdge and Bandwidth:
  • The BandEdge sets the critical period of the second highpass filter, which determines the shortest wavelengths in the response.
  • The Bandwidth is a multiple of the BandEdge used for the critical period of the first highpass filter, which determines the longest wavelengths in the response. Ehlers suggests that a Bandwidth value of 2 works well for most applications. However, traders can use any value above or equal to 1.4.


Users can customize these parameters with the "Bandwidth" and "BandEdge" inputs in the "Settings/Inputs" tab.

The script plots the UO calculated for the specified "Source" series in a separate pane, with a color based on the chart's foreground color. Positive UO values indicate upward momentum or trends, and negative UO values indicate the opposite.

Additionally, this indicator provides the option to display a "cloud" from 10 additional UO series with different settings for an aggregate view of momentum. The "Cloud" input offers four display choices: "Bandwidth", "BandEdge", "Bandwidth + BandEdge", or "None".

The "Bandwidth" option calculates oscillators with different Bandwidth values based on the main oscillator's setting. Likewise, the "BandEdge" option calculates oscillators with varying BandEdge values. The "Bandwidth + BandEdge" option calculates the extra oscillators with different values for both parameters.

When a user selects any of these options, the script plots the maximum and minimum oscillator values and fills their space with a color gradient. The fill color corresponds to the net sum of each UO's sign, indicating whether most of the UOs reflect positive or negative momentum. Green hues mean most oscillators are above zero, signifying stronger upward momentum. Red hues mean most are below zero, indicating stronger downward momentum.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.