Moving Average - Exponential Moving Average

Further information: EWMA chart

An exponential moving average (EMA), also known as an exponentially weighted moving average (EWMA), is a type of infinite impulse response filter that applies weighting factors which decrease exponentially. The weighting for each older datum point decreases exponentially, never reaching zero. The graph at right shows an example of the weight decrease.

The EMA for a series Y may be calculated recursively:

for

Where:

  • The coefficient α represents the degree of weighting decrease, a constant smoothing factor between 0 and 1. A higher α discounts older observations faster. Alternatively, α may be expressed in terms of N time periods, where α = 2/(N+1). For example, N = 19 is equivalent to α = 0.1. The half-life of the weights (the interval over which the weights decrease by a factor of two) is approximately N/2.8854 (within 1% if N > 5).
  • Yt is the value at a time period t.
  • St is the value of the EMA at any time period t.

S1 is undefined. S1 may be initialized in a number of different ways, most commonly by setting S1 to Y1, though other techniques exist, such as setting S1 to an average of the first 4 or 5 observations. The prominence of the S1 initialization's effect on the resultant moving average depends on α; smaller α values make the choice of S1 relatively more important than larger α values, since a higher α discounts older observations faster.

This formulation is according to Hunter (1986). By repeated application of this formula for different times, we can eventually write St as a weighted sum of the datum points Yt, as:

for any suitable k = 0, 1, 2, ... The weight of the general datum point is .

An alternate approach by Roberts (1959) uses Yt in lieu of Yt−1:

This formula can also be expressed in technical analysis terms as follows, showing how the EMA steps towards the latest datum point, but only by a proportion of the difference (each time):

\text{EMA}_{\text{today}} = \text{EMA}_{\text{yesterday}} + \alpha \times
(\text{price}_{\text{today}} - \text{EMA}_\text{yesterday})

Expanding out each time results in the following power series, showing how the weighting factor on each datum point p1, p2, etc., decreases exponentially:

\text{EMA}_{\text{today}} = { \alpha \times (p_1 + (1-\alpha) p_2 + (1-\alpha)^2 p_3 + (1-\alpha)^3
p_4 + \cdots ) }

where

  • is
  • is
  • and so on

,

since .

This is an infinite sum with decreasing terms.

The N periods in an N-day EMA only specify the α factor. N is not a stopping point for the calculation in the way it is in an SMA or WMA. For sufficiently large N, The first N datum points in an EMA represent about 86% of the total weight in the calculation:

i.e. simplified, tends to .

The power formula above gives a starting value for a particular day, after which the successive days formula shown first can be applied. The question of how far back to go for an initial value depends, in the worst case, on the data. Large price values in old data will affect on the total even if their weighting is very small. If prices have small variations then just the weighting can be considered. The weight omitted by stopping after k terms is

which is

i.e. a fraction


{{\text{weight omitted by stopping after k terms}} \over {\text{total weight}}} = { { \alpha \times \left } \over { { \alpha \times \left } } }

= { {\alpha (1-\alpha)^k \times {{1} \over {1-(1-\alpha)}}} \over { { {\alpha} \over {1-(1-\alpha) } } } }

= (1 - \alpha)^k

out of the total weight.

For example, to have 99.9% of the weight, set above ratio equal to 0.1% and solve for k:

terms should be used. Since approaches as N increases, this simplifies to approximately

for this example (99.9% weight).

Read more about this topic:  Moving Average

Famous quotes containing the words moving and/or average:

    Photographs may be more memorable than moving images because they are a neat slice of time, not a flow. Television is a stream of underselected images, each of which cancels its predecessor. Each still photograph is a privileged moment, turned into a slim object that one can keep and look at again.
    Susan Sontag (b. 1933)

    ... to be successful a person must attempt but one reform. By urging two, both are injured, as the average mind can grasp and assimilate but one idea at a time.
    Susan B. Anthony (1820–1906)