Here is another adaptive indicator but it uses a different approach.
The universal oscillator has essentially zero lag as an indicator however its implementation in TOS is not adaptive.
The indicator below changes the sensitivity to price moves using the volatility in much the same way as the TOS MovAvgAdaptive indicator. It becomes more sensitive when the price is moving smoothly and less sensitive when the price is volatile.
This is done by calculating the Efficiency Ratio (ER), a measure of relative trend strength, using close price relative to the high-low range. The MovAvgAdaptive gets a variable named ScaledSF. It uses the ScaledSF as an alpha value for an EMA, which is computed using:
EMA = alpha*Price + (1-alpha)*EMA[1].
Since we know that ScaledSF is the alpha value, and since it is known that for an N period SMA, alpha = 2/(N+1), setting ScaledSF = 2/(N+1) and solving for N yields:
N = 2/alpha -1.
This value of N is then used as the period for the Universal Oscillator in order to make it adaptive.
Here is a screenshot. The first indicator on the bottom is the adaptive Universal Oscillator. The second one is the Universal Oscillator that comes with TOS using default settings for comparison. It is evident there are trading opportunities that the adaptive oscillator identifies.
An HMA(34) in yellow was added to each oscillator as well as the zero line for potential use trading cross overs. But it seems that the peaks and valleys of the oscillator identify trading opportunities too.
The universal oscillator has essentially zero lag as an indicator however its implementation in TOS is not adaptive.
The indicator below changes the sensitivity to price moves using the volatility in much the same way as the TOS MovAvgAdaptive indicator. It becomes more sensitive when the price is moving smoothly and less sensitive when the price is volatile.
This is done by calculating the Efficiency Ratio (ER), a measure of relative trend strength, using close price relative to the high-low range. The MovAvgAdaptive gets a variable named ScaledSF. It uses the ScaledSF as an alpha value for an EMA, which is computed using:
EMA = alpha*Price + (1-alpha)*EMA[1].
Since we know that ScaledSF is the alpha value, and since it is known that for an N period SMA, alpha = 2/(N+1), setting ScaledSF = 2/(N+1) and solving for N yields:
N = 2/alpha -1.
This value of N is then used as the period for the Universal Oscillator in order to make it adaptive.
Here is a screenshot. The first indicator on the bottom is the adaptive Universal Oscillator. The second one is the Universal Oscillator that comes with TOS using default settings for comparison. It is evident there are trading opportunities that the adaptive oscillator identifies.
An HMA(34) in yellow was added to each oscillator as well as the zero line for potential use trading cross overs. But it seems that the peaks and valleys of the oscillator identify trading opportunities too.
CSS:
# Adaptive UniversalOsc Oscillator for TOS by Sesqui [18SEP2025]
# This indicator changes its sensitivity to price moves using the volatility.
# It becomes more sensitive during periods when the price is moving smoothly in a certain direction and becomes less sensitive when the price is volatile. In much the same way as the TOS MovAvgAdaptive indicator does.
# This is done by calculating the Efficiency Ratio (ER), a measure of relative trend strength. The ER accounts for the location of the close price relative to the high-low range, which uses ER to then getActualEarnings a paramter called, ScaledSF. The AMA uses ScaledSF as an alpha value for an EMA, which is computed using:
# EMA = alpha*Price + (1-alpha)*EMA[1].
# Since we know that ScaledSF is the alpha value, and since it is known that for an N period SMA,
# alpha = 2/(N+1), setting ScaledSF = 2/(N+1) and solving for N yields: N = 2/alpha -1. This
# value of N is then used as the period for the Universal Oscillator in order to make it adaptive
# to the price action, adapting for the current volatilityStdDev in the market.
#
declare lower;
# *** Computes the Efficiency Ratio ***
def effRatioLength = 10;
def fastLength = 2;
def slowLength = 30;
def ER = AbsValue((close - Lowest(low, effRatioLength)) - (Highest(high, effRatioLength) - close)) / (Highest(high, effRatioLength) - Lowest(low, effRatioLength));
def FastSF = 2 / (fastLength + 1);
def SlowSF = 2 / (slowLength + 1);
def ScaledSF = ER * (FastSF - SlowSF) + SlowSF;
# *** Determines the Period for the Universal Oscillator ***
# for an EMA: alpha = 1/ (L+1); where L is the lag
# Using this expression and solving for Lag:
# L = 2/alpha -1; let ScaledSF = alpha, and solve for the
# value of lag, L, to get: L = 2/scaledSF - 1;
# This lag, L becomes the Bandedge or cutoffLength passed to the
# EhlersSuperSmoother in the Universal Oscillator, making the
# Universal Osciallator adpative
def cutoffLength = 2 / ScaledSF - 1;
# *** Computes the Universal Oscillator in this section ***
def whiteNoise = (close - close[2]) / 2;
def filter = reference EhlersSuperSmootherFilter(price = whiteNoise, "cutoff length" = cutoffLength);
def peak = if IsNaN(filter) then peak[1] * 0.991 else Max(AbsValue(filter), peak[1] * 0.991);
plot UniversalOsc = filter / peak;
UniversalOsc.SetLineWeight(2);
def Diff = UniversalOSC - UniversalOSC[1];
UniversalOsc.AssignValueColor(if Diff >= 0 then if Diff > Diff[1] then Color.Green else Color.Dark_Green else if Diff < Diff[1] then Color.Red else Color.DARK_RED);
# *** Displays an HMA(34) for cross overs ***
input length = 45;
plot HMA = MovingAverage(AverageType.HULL, UniversalOsc, length );
HMA.AssignValueColor(Color.YELLOW);
HMA.SetLineWeight(2);
plot centerLine = 0;
centerLine.AssignValueColor(Color.GRAY);
Last edited: