[QuantSchool] What are Moving Averages exactly ?

1
There are two main ways to filter and smooth data
This is the well known ARMA model

AR stand for "Auto-Regressive" and MA stands for "Moving Average"

A moving average uses past input data, so price data in case of trading, and assigns weights to each price in the past.
this is also called a FIR filter (Finite Impulse Response)
FIR are best in a non realtime situation because they filter with linear phase conservation but wil a high group delay (n/2)
a very simple FIR filter is the SMA (Simple Moving Average)

but in, trading we don't really care about phase, we mostly care about low lag
this is where the IIR filter comes into play :

A regressive approach uses the output of the filter in the computation of the filter. so this is a recursive way of filtering
this is also called an IIR filter (Infinite Impulse Response)
a very simple IIR is the EMA (Exponential Moving Average)

of course you can combine both worlds, and EMAs NEED to have a Moving Average part, otherwise it would be always equals to zero;
example Y = 1.2 * Y(t-1) is always equals to 0 because the previous EMA value is unknown

let's look at formulas :

Code: Select all

SMA= (A0 + A1 + A2 + ... + An-1)/n
where:
An =Price of an asset at period n
n=Number of total periods
​
EMA formula :

Code: Select all

EMA=Price(t)×k+EMA(y)×(1−k)
where:
t=today
y=yesterday
N=number of days in EMA
k=2÷(N+1)​
so you can see that in the EMA formula, there is the output of the previous bar : EMA(y)

another difference between the two, is that the EMA, because it uses EMA values from the previous day, will not be coherent from beginning to finish. the filter will slowly go towards its final value. It means that to be accurate, you need to process a high number of bars before having the EMA close to its right value

Two types of filters are not the only ones. Some imply much different types of filterings (like Jurik, SSA, ROF, Beltrami, Linear Regression, Wavelets, etc) to cite a few.
But this is not the purpose of this post.

Jeff
These users thanked the author ionone for the post (total 2):
boytoy, eduarescobar


Who is online

Users browsing this forum: Ahrefs [Bot], ChatGPT [Bot], DotNetDotCom [Bot], mate, TEAMTRADER, URS, whiteadrian23, Yandex [Bot] and 119 guests