How to Calculate Simple Moving Average in Trading
A simple moving average (SMA) is a simple trading indicator to calculate and use. To calculate it, you add a number of prices together and then divide by the number of prices you added. An example makes the SMA clearer.
A nine-day moving average of Intel’s (INTC) closing price is calculated throughout May 2008 and then is plotted on a price chart. To start the SMA calculation, use the closing prices. Add the first nine closing prices together, from May 1 through May 13, and divide by 9. The resulting value is placed alongside the ninth trading day, May 13. Continue for each subsequent day in the month.
The SMA data is superimposed on the bar chart’s price data. Notice that you need nine prices before you can plot the first SMA point. In other words, the first SMA point appears on the ninth price bar, and the first eight price bars do not display an SMA value.
To calculate the second SMA point, add the prices from May 2 through May 14 together, divide by 9, and place the result as the SMA data point next to May 14.
Another way to think of calculating SMAs is that you drop the oldest price in the calculation and add the closing price from the next price bar. Continue this series by dropping the oldest price, adding the newest price, and dividing by 9 for the remainder of the month.
If you’re mathematically inclined, here’s what the series looks like as an equation:
SMA = (P + P + P + . . . P[N]) ÷N
N is the number of periods in the SMA
P[N] is the price being averaged (usually the closing price)
Traders used to calculate SMAs by hand, but fortunately, computers now relieve traders from this rather mundane chore.
Luckily, you don’t have to do this calculation yourself. You can let StockCharts.com automatically calculate it for you. You’ll find the simple moving average as one of the overlays in the Chart Attributes section. You select the type of overlay you want, such as Moving Avg (simple), and then put in the number of periods. The simple moving average lines will be automatically generated on your chart.