Moving Average/Exponential

Exponential moving average

EMA weights N = 200

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

The EMA for a series   of collected data with a set of dates  , where   is the collected data at time index  .

  • First of all we have to defined a value   with  , that represents the degree of weighting decrease as a constant smoothing factor between 0 and 1. A lower α discounts older observations faster.
  • The weights are defined by
  for all   with   (geometric series).
  • The sum of weights from 0 to the time index   is defined by:
  • The discrete probability mass function is defined by:

The definition above creates the exponential moving average EMA with discrete probability mass function   by


The   at time index   may be calculated recursively:

  for all  


  • The coefficient   represents the degree of weighting decrease from   to  . This implements the aging of data from   to time index  .
  • the fraction   adjusts the denominator   for  .
  • the coefficient   in the EMA at time index t+1.

Initialization of EMA and Elimination of MA Impact form old data


  may be initialized in a number of different ways, most commonly by setting   to the first collected data   at time index 0 as shown above, though other techniques exist, such as starting the calculation of the moving average after the first 4 or 5 observations. Furthermore only a most recent subset of collected data before the time index   from the total history of collected date might be used for the  . The discrete probability mass function puts weights on the most recent   values of the collected data by:


The limitations to the most recent   values of the collected data eliminates the impact of very old data on the resultant moving average completely. By choosing a small   old data is less important than recent data and discounts older observations faster, but even the oldest data has a impact on the calculation of   at time index  .

Tne initialiation of   could incorporate something about values prior to the available data, i.e. history before  . Tne initialiation could introduce an error in the  . In view of this the early results should be regarded as unreliable until the iterations have had time to converge. This is sometimes called a 'spin-up' interval.

This formulation of EMA is designed as an application of an expected value, which is a standard definition in probability theory.

According to Hunter (1986).[2] this can be written as an repeated application of the recursive formula for different times   without standardisation, i.e.


An alternate approach defined by Roberts (1959)[3] is missing the standardisation of the probability distribution too, while the basic principle of exponential moving average remains the same.

Application to measuring computer performance


Some computer performance metrics, e.g. the average process queue length, or the average CPU utilization, use a form of exponential moving average with the recursive definition.


Here α is defined as a function of time between two readings. An example of a coefficient giving bigger weight to the current reading, and smaller weight to the older readings is


where exp() is the exponential function, time for readings tn is expressed in seconds, and W is the period of time in minutes over which the reading is said to be averaged (the mean lifetime of each reading in the average). Given the above definition of α, the moving average can be expressed as


For example, a 15-minute average L of a process queue length Q, measured every 5 seconds (time difference is 5 seconds), is computed as

  2. NIST/SEMATECH e-Handbook of Statistical Methods: Single Exponential Smoothing at the National Institute of Standards and Technology
  3. NIST/SEMATECH e-Handbook of Statistical Methods: EWMA Control Charts at the National Institute of Standards and Technology