TradingView
MarcoValente
6 ott 2018 18:00

Deviation Scaled Moving Average  

S&P 500 index of US listed sharesFXCM

Descrizione

The" Deviation-Scaled Moving Average” developped by the 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. He suggest to combine 2 dsma with different period (40 and 100) to buy/sell at the cross.
Commenti
Heroturk
Working very well in Turkish , German markets .thanks
imam9825
V5 Convertion:
Tested.

//@version=5
//Deviation Scaled Moving Average by John Ehlers
indicator('Deviation Scaled Moving Average ', shorttitle='DSMA', overlay=true)
Period = input(40)
PI = 3.1415926
a1 = math.exp(-1.414 * PI / (0.5 * Period))
b1 = 2 * a1 * math.cos(1.414 * PI / (0.5 * Period))
c2 = b1
c3 = -a1 * a1
c1 = 1 - c2 - c3

Zeros = close - close[2]
// SuperSmoother Filter
Filt = 0.0
Filt := c1 * (Zeros + Zeros[1]) / 2 + c2 * nz(Filt[1]) + c3 * nz(Filt[2])
// Compute Standard Deviation
RM = math.sum(Filt * Filt, Period)
RMS = math.sqrt(RM / Period)
// Rescale Filt in terms of Standard Deviations
ScaledFilt = Filt / RMS
alpha1 = math.abs(ScaledFilt) * 5 / Period
DSMA = 0.0
DSMA := alpha1 * close + (1 - alpha1) * nz(DSMA[1])
plot(DSMA, color=color.new(color.blue, 0))

// 2 moving average

Period2 = input(100)
a12 = math.exp(-1.414 * PI / (0.5 * Period2))
b12 = 2 * a12 * math.cos(1.414 * PI / (0.5 * Period2))
c22 = b12
c32 = -a12 * a12
c12 = 1 - c22 - c32

//Zeros = close - close[2]
// SuperSmoother Filter
Filt2 = 0.0
Filt2 := c12 * (Zeros + Zeros[1]) / 2 + c22 * nz(Filt2[1]) + c32 * nz(Filt2[2])
// Compute Standard Deviation
RM2 = math.sum(Filt2 * Filt2, Period2)
RMS2 = math.sqrt(RM2 / Period2)
// Rescale Filt in terms of Standard Deviations
ScaledFilt2 = Filt2 / RMS2
alpha12 = math.abs(ScaledFilt2) * 5 / Period2
DSMA2 = 0.0
DSMA2 := alpha12 * close + (1 - alpha12) * nz(DSMA2[1])
plot(DSMA2, color=color.new(color.red, 0))
devil_machine
Upgrade to V5!

//@version=5
indicator('Deviation Scaled Moving Average ', shorttitle='DSMA', overlay=true)
Period = input(40)
PI = 3.1415926
a1 = math.exp(-1.414 * PI / (0.5 * Period))
b1 = 2 * a1 * math.cos(1.414 * PI / (0.5 * Period))
c2 = b1
c3 = -a1 * a1
c1 = 1 - c2 - c3

Zeros = close - close[2]
// SuperSmoother Filter
Filt = 0.0
Filt := c1 * (Zeros + Zeros[1]) / 2 + c2 * nz(Filt[1]) + c3 * nz(Filt[2])
// Compute Standard Deviation
RM = math.sum(Filt * Filt, Period)
RMS = math.sqrt(RM / Period)
// Rescale Filt in terms of Standard Deviations
ScaledFilt = Filt / RMS
alpha1 = math.abs(ScaledFilt) * 5 / Period
DSMA = 0.0
DSMA := alpha1 * close + (1 - alpha1) * nz(DSMA[1])
plot(DSMA, color=color.new(color.blue, 0))

// 2 moving average

Period2 = input(100)
a12 = math.exp(-1.414 * PI / (0.5 * Period2))
b12 = 2 * a12 * math.cos(1.414 * PI / (0.5 * Period2))
c22 = b12
c32 = -a12 * a12
c12 = 1 - c22 - c32

//Zeros = close - close[2]
// SuperSmoother Filter
Filt2 = 0.0
Filt2 := c12 * (Zeros + Zeros[1]) / 2 + c22 * nz(Filt2[1]) + c32 * nz(Filt2[2])
// Compute Standard Deviation
RM2 = math.sum(Filt2 * Filt2, Period2)
RMS2 = math.sqrt(RM2 / Period2)
// Rescale Filt in terms of Standard Deviations
ScaledFilt2 = Filt2 / RMS2
alpha12 = math.abs(ScaledFilt2) * 5 / Period2
DSMA2 = 0.0
DSMA2 := alpha12 * close + (1 - alpha12) * nz(DSMA2[1])
plot(DSMA2, color=color.new(color.red, 0))
dpanday
CAn't see a line is displayed
vaicru
Any timeframe ?
vaicru
Hi Marco
I follow you.
MarcoValente
@vaicru, nice to hear about you again...yes i guess any timeframe..
check yourself at: traders.com/Documentation/FEEDbk_docs/2018/07/TradersTips.html
Altro