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

Re: Exponential moving average



PureBytes Links

Trading Reference Links

At 10:34 AM -0400 9/27/00, Paul Altman wrote:

>Your reply:
>
>>SC = 2 / (N+1) where N = number of days in EMA
>
>At first glance, though, this looks very misleading. It gives the
>user the false sense that N in any _meaningful_ way effects the
>lookback period. Yes, it obviously effects it, but not in a way that
>has much to do with the # of days lookback desired.
>
>Also, what's the deal with the "+1"? Since the EMA is such a wild
>approximation of the desired lookback period (the EMA really looks
>back forever, but with distant past data being under-weighted into
>oblivion), what difference does it make whether we add (or subtract)
>a "1" to the denominator? Is this somehow more elegant? I don't see
>it.

There is an "elegant" reason for this but it is a little obscure.

If the exponential moving average is defined as:

      F0 = a * P0 + (1 - a) * F1

where:

F0 is the output, and
P0 is the price input, and
F1 is the previous value of the filter on the previous bar, and
a  is a factor

If you apply this average to a "Ramp" price function, one where the
price continuously rises at any fixed rate per bar, you can easily 
derive the lag between the price (P0) and the output of the average
(F0) to be:

      Lag = (1 - a) / a

The lag of a Simple Moving Average is well known to be:

      Lag = (Length - 1) / 2

(you can derive it the same way if you doubt it)

so equating the two values of Lag you can reduce this to:

      Length = (2 - a) / a

or, rearranging:

     a = 2 / (Length + 1)

Hence, the convention.

This makes the Exponential Moving Average have the same lag as a
Simple Moving Average with the same Length input.

Now, aren't you sorry you asked?

Bob Fulks