A simple moving average is formed by computing the average (mean) price of a security over a specified number of periods. It places equal value on every price for the time span
selected. While it is possible to create moving averages from the Open, the High, and the Low data points, most moving averages are created using the closing price. For example: a 5-day simple moving average is calculated by adding the closing prices for the last 5 days and dividing the total by 5.
10 + 11 + 12 + 13 + 14 = 60
60/5 = 12
The calculation is repeated for each price bar on the chart. The averages are then joined to form a smooth curving line – the moving average line. Continuing our example, if the next closing price in the average is 15, then this new period would be added and the oldest day, which is 10, would be dropped.
The new 5-day simple moving average would be calculated as follows:
11 + 12 + 13 + 14 + 15 = 65
65/13 = 5
Over the last 2 days, the SMA moved from 12 to 13. As new days are added, the old days will be subtracted and the moving average will continue to move over time.