Moving Average(MA)
Last updated
Was this helpful?
Last updated
Was this helpful?
In , a moving average (rolling average or running average) is a calculation to analyze data points by creating a series of of different subsets of the full data set. It is also called a moving mean (MM) or rolling mean and is a type of filter. Variations include: , and , or forms (described below).
Given a series of numbers and a fixed subset size, the first element of the moving average is obtained by taking the average of the initial fixed subset of the number series. Then the subset is modified by "shifting forward"; that is, excluding the first number of the series and including the next value in the subset.
In financial applications, a simple moving average (SMA) is the unweighted of the previous n data-points. 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 the closing price is the mean of the previous n days' closing prices. Let those prices be . Let the mean over the first k data-points be . Thus, the mean over all the data-points is calculated as:
This means that the moving average filter can be computed quite cheaply on real time data with a FIFO / circular buffer.
When calculating successive values, a new value comes into the sum, and the oldest value drops out. This means that a full summation each time is unnecessary. Thus, the new mean can be calculated as:
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 in a falling market or in a rising market.