How to Calculate Simple Moving Average in Trading - dummies

# 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.

Date Close SMA
5/1/2008 22.81
5/2/2008 23.09
5/5/2008 22.91
5/6/2008 23.23
5/7/2008 22.83
5/8/2008 23.05
5/9/2008 23.02
5/12/2008 23.29
5/13/2008 23.41 23.07
5/14/2008 23.49 23.15
5/15/2008 24.60 23.31
5/16/2008 24.63 23.51
5/19/2008 24.51 23.65
5/20/2008 23.73 23.75
5/21/2008 23.31 23.78
5/22/2008 23.53 23.83
5/23/2008 23.06 23.81
5/27/2008 23.25 23.79
5/28/2008 23.12 23.75
5/29/2008 22.80 23.55
5/30/2008 22.84 23.35

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.

Credit: Chart courtesy of StockCharts.com

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[1] + P[2] + P[3] + . . . P[N]) ÷N

Where:

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.