John Ehler’s Universal oscillator

The universal oscillator introduced in John Ehlers’ article in this issue, “Whiter Is Brighter,” is an evolution of Ehlers’ SuperSmoother filter, which was introduced in his January 2014 STOCKS & COMMODITIES article “Predictive And Successful Indicators”). The new indicator follows the short-term variations in price without introducing extra delay. It is comfortably controlled through just a single input — the bandedge — which basically is frequency. The smaller it is set, the less lag there is, but the smoother the indicator’s outline will be. Built-in automatic gain control normalizes the output to vary between -1 to +1.

As an illustration of its application, a straightforward short-term countertrend system could, for example, use the following rules:

  • Cover your short position and go long when the universal oscillator crosses below zero
  • Sell and go short when the universal oscillator crosses above zero.

Since it is really a universal oscillator, the indicator can power up a trend-trading system just as easily:

  • Buy when the long-term universal oscillator crosses above zero
  • Sell when the long-term universal oscillator crosses below zero.

 

Universal Oscillator:

bandedge:= 20;
whitenoise:= (C - Ref(C,-2))/2;

{super smoother filter}
a1:= Exp(-1.414 * 3.14159 / bandedge);
b1:= 2*a1 * Cos(1.414*180 /bandedge);
c2:= b1;
c3:= -a1 * a1;
c1:= 1 - c2 - c3;
filt:= c1 * (whitenoise + Ref(whitenoise, -1))/2 + c2*PREV + c3*Ref(PREV,-1);
filt1:= If(Cum(1) = 0, 0, If(Cum(1) = 2, c2*PREV,
If(Cum(1) = 3, c2*PREV + c3*Ref(PREV,-1), filt)));

pk:= If(Cum(1) = 2, .0000001,
If(Abs(filt1) > PREV, Abs(filt1), 0.991 * PREV));
denom:= If(pk=0, -1, pk);
If(denom = -1, PREV, filt1/pk)