Moving Average/Simple Moving Average

Simple moving average - discrete


In financial applications a simple moving average (SMA) is the unweighted mean of the previous n data. However, in science and engineering the mean is normally taken from an equal number of data on either side of a central value. This ensures that variations in the mean are aligned with the variations in the data rather than being shifted in time. An example of a simple equally weighted running mean for a n-day sample of closing price is the mean of the previous n days' closing prices.


and   for   with   as additive group.

Let   be the cost/price of product at time  . If those prices are   and we want to create a simple moving average at day   and looking back for time span of   days then the formula is


When calculating successive values for other days/time  , a new value comes into the sum and an old value drops out, meaning a full summation each time is unnecessary for this simple case,



The period selected depends on the type of movement of interest, such as short, intermediate, or long-term. In financial terms moving-average levels can be interpreted as support in a falling market, or resistance in a rising market. If you draw a graph for   and cost function  , you will identify, that the graph of   runs smoother in the time  

If the data used are not centered around the mean, a simple moving average lags behind the latest datum point by half the sample width. An SMA can also be disproportionately influenced by old datum points dropping out or new data coming in. One characteristic of the SMA is that if the data have a periodic fluctuation, then applying an SMA of that period will eliminate that variation (the average always containing one complete cycle). But a perfectly regular cycle is rarely encountered.[1]

For a number of applications, it is advantageous to avoid the shifting induced by using only 'past' data. Hence a central moving average can be computed, using data equally spaced on either side of the point in the series where the mean is calculated.[2] This requires using an odd number of datum points in the sample window.


and   for   with   as additive group.


A major drawback of the SMA is that it lets through a significant amount of the signal shorter than the window length. Worse, it actually inverts it. This can lead to unexpected artifacts, such as peaks in the smoothed result appearing where there were troughs in the data. It also leads to the result being less smooth than expected since some of the higher frequencies are not properly removed.

Simple moving average - continuous


If we consider a continous measurement of value e.g. a force   at time  . The objective is to smooth the values   with a continous simple moving average. We look a time span   in the past. As probability distribution we use a uniform distribution (mathematics) for the intervall  . The density function is:


Application on the moving average definition for continuous probability distriubtions we get:

  1. Statistical Analysis, Ya-lun Chou, Holt International, 1975, ISBN 0-03-089422-0, section 17.9.
  2. The derivation and properties of the simple central moving average are given in full at Savitzky–Golay filter