Nicolas

Deviation-Scaled Moving Average - DSMA

Category: Indicators By: Nicolas Created: June 15, 2018, 1:03 PM
June 15, 2018, 1:03 PM
Indicators
9 Comments
Deviation-Scaled Moving Average - DSMA

Here is the new DSMA moving average made my John Ehlers and featured in the July 2018 issue of TASC magazine.

The DSMA is an adaptive moving average that features rapid adaptation to volatility in price movement.
It accomplishes this adaptation by modifying the alpha term of an EMA byt he amplitude of an oscillator scaled in standard deviations from the mean. The DSMA’s responsiveness can be changed by using different values for the input parameter period.

John Ehlers

//PRC_Deviation Scaled Moving Average | indicator
//15.06.2018
//Nicolas @ www.prorealcode.com
//Sharing ProRealTime knowledge

// --- settings
Period = 40
// --- end of settings

If barindex>Period Then
 //Smooth with a Super Smoother
 a1 = exp(-1.414*3.14159 / (.5*Period))
 b1 = 2*a1*Cos(1.414*180 / (.5*Period))
 c2 = b1
 c3 = -a1*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 do
  RMS = RMS + Filt[count]*Filt[count]
 next
 RMS = SqRt(RMS / Period)
 //Rescale Filt in terms of Standard Deviations
 ScaledFilt = Filt / RMS
 alpha1 = Abs(ScaledFilt)*5 / Period
 DSMA = alpha1*Close + (1 - alpha1)*DSMA[1]
endif

return DSMA

 

Download
Filename: PRC_Deviation-Scaled-MA.itf
Downloads: 296
Nicolas
Nicolas Legend
I created ProRealCode because I believe in the power of shared knowledge. I spend my time coding new tools and helping members solve complex problems. If you are stuck on a code or need a fresh perspective on a strategy, I am always willing to help. Welcome to the community!
Author’s Profile

Comments

Appsoluxions
8 years ago
#

Cool. Thanks for the response.

Appsoluxions
8 years ago
#

Hi Nicolas, do you have the MT4 version of the indicator? I am not sure if these kind of questions are welcome, if not appologies in advance. Thank you.

Nicolas
8 years ago
#

Hi, don't have one sorry. But you can still ask for private coding through our programming services: https://www.prorealcode.com/trading-programming-services/

Domenec
8 years ago
#

No esta mal yo utilizo la ema 8 y la wilder8 y la banda que generan con muy buenos resultados sin embargo le he visto algun detalle interesante a esta nueva media me la estudiare con cariño y ya comentare los resultados

juanj
8 years ago
#

@JohnScher, with regards to your question of can a strategy be derived from this, that is an open-ended question. Obviously, a strategy can be derived from this as with anything else?! And with regards to is this just another MA, yes it is. And just like any other MA it has it's place among all the others SMA, EMA, Wilders, DEMA, ZEMA, etc. Perhaps you can read the article in TASC, where the merits of the indicator is explained? I personally use and experiment with all different kinds of indicators and methods to create strategies. I love concepts such as 'zero lag' indicators or exponentially calculated Bollinger Bands or in this case std deviation calculated MA's! I am actually planning to use this to create deviation scaled exponentially calculated bollinger band.

JohnScher
8 years ago
#

Hello, Nicolas. Nice work from you! Thank you very much. Really! Is there a strategy that can be derived from this? e.g. buying at crosses over selling at crosses under the yellow line? Are there any results for such a strategy - possibly in combination with other strategies? cause I think it's just another average more on the tableau. What can he do more than other averages? Has Ehlers tested that? Are there any results? Published? I'm sorry, the criticism, sometimes I'm just tired of "always the same thing". Friendly greetings

juanj
8 years ago
#

@Nicolas, what would be the code if I want to use this as a Band calculated using true exponential deviation bands; https://www.prorealcode.com/prorealtime-indicators/exponential-volatility-bands/ I have tried combining them already but my math skills fail me

juanj
8 years ago
#

That was actually the first thing I tried, but the result didn't look right to me. So I started experimenting with replacing some variables of the EWMA (i.e. Dev, alpha) band with those of the DSMA (i.e. RMA, alpha1). Produces interesting results but unsure of their correctness.

Nicolas
8 years ago
#

You only have to replace the "EWMA" calculation from this indicator with the DSMA variable made in this one. Please let me know if you have still trouble making this.

ProRealCode ProRealCode
Loading...