This is the latest John Ehlers indicator featured in the July 2018 edition of Traders’ Tip.
In “The Deviation-Scaled Moving Average” in this issue, author John Ehlers introduces a new adaptive moving average that has the ability to rapidly adapt to volatility in price movement. The author explains that due to its design, it has minimal lag yet is able to provide considerable smoothing.
//Smooth with a Super Smoother
if barindex>Period then
a1 = Exp( -1.414 * 3.14159 / ( .5 * Period ) )
b1 = 2 * a1 * Cos( 1.414 * 180 / ( .5 * Period ) )
c2 = b1
c3 = -square(a1)
c1 = 1 - c2 - c3
//Produce Nominal zero mean with zeros in the transfer
//response at DC and Nyquist with no spectral distortion
//Nominally whitens the spectrum because of 6 dB
//per octave rolloff
Zeros = Close - Close[2]
//SuperSmoother Filter
Filt = c1 * ( Zeros + Zeros[1] ) / 2 + c2 * Filt[1] + c3 * Filt[2]
//Compute Standard Deviation
RMS = 0
For count = 0 to Period - 1
RMS = RMS + square(Filt[count])
Next
RMS = Sqrt( RMS / Period )
//Rescale Filt in terms of Standard Deviations
If RMS <> 0 then
ScaledFilt = Filt / RMS
else
ScaledFilt = 0
endif
alpha1 = Abs( ScaledFilt ) * 5 / Period
DSMA = alpha1 * Close + ( 1 - alpha1 ) * DSMA[1]
endif
return DSMA as "EhlersDSMA"
Thank you, but I moved your code submission to forum, because the DSMA has already been published: Deviation-Scaled Moving Average DSMA
Now we have 2 versions 🙂
I saw your version after I already submitted mine. Sorry for this double submission. 🙂