[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Exponential Moving Average - Frequency Response



PureBytes Links

Trading Reference Links

Carroll:
>Can anyone provide me a math expression which describes the frequency
>response of an exp MA?

Thanks to a private discussion I've been having with Mark Johnson, I
can suggest a way to do this.

An exponential moving average is identitcal in its response to a
lowpass RC filter (the resistor R is the series component and the
capacitor C is the shunt).  If you work out the math for the voltage
across the capacitor (which is the output signal of the lowpass filter),
for each time increment, you get the expression

V_out = V_in/(R*C) + V_out[1] - V_out[1]/(R*C)

...which translates to

w = 1/(R*C)
V_out = w*V_in + (1-w)*V_out[1];

If V_in is the price and V_out is the EMA, then one has

EMA = w*price + (1-w)*EMA[1];

...which is an exponential moving average using weighting w=1/(R*C).

Normally for an EMA, w=2/(length+1), where length is time units
in price bars, therefore length=2*R*C-1, or R*C = (length-1)/2.

So!  If you have an EMA, and you know the length parameter, then
you can calculate the equivalent RC constant of an electronic
lowpass filter, as RC=(length-1)/2.  Once you know that,
you can calculate the frequency response.  For that, see
http://www.ee.duke.edu/~cec/final/node110.html or anything else you
can find on google.

-- 
  ,|___    Alex Matulich -- alex@xxxxxxxxxxxxxx
 // +__>   Director of Research and Development
 //  \ 
 // __)    Unicorn Research Corporation -- http://unicorn.us.com