JSParticipant
Senior
Moving averages are excellent filters for reducing noise and maintaining a good step response.
When calculating a simple moving average, only the input values on one side of the output value are used.
Alternatively, the group of input values can be chosen symmetrically around the output value, this prevents a relative shift between the input and output values.
In the screenshot the difference between a simple moving average (red) and a symmetrical moving average (green).
N=500
Period = 10
For i = Period/2 to N
$SyMA[i]=0
For j= -Period/2 to Period/2
$SyMA[i] = $SyMA[i] + Close[i + j]
Next
$AvgSyMA[i] = $SyMA[i] / (Period+1)
DrawSegment(BarIndex[i], $AvgSyMA[i], BarIndex[i+1], $AvgSyMA[i+1]) Coloured(0,255,0)
Next
Return
why do you make it so it lags?
observation:
the same symmetrical mm can be obtained with the sma predefined prt + horizontal offset -5
JSParticipant
Senior
Hi @snucke
As you can see in the screenshot, the symmetric MA responds faster to the price changes than the simple MA, so there is less delay (lagging)…
What i ment was why is it Infront of the price and not where the price actually is? Makes it look faster at reacting than i normal average
JSParticipant
Senior
Simple moving average:
Y[10] = (x[10] + x[11] + x[12] + x[13] + x[14]) / 5
Symmetrical moving average:
Y[10] = (x[8] + x[9] + x[10] + x[11] + x[12]) / 5
Why not show them in the same place? Where price is and where a normal moving average is being plotted