A simple moving average (SMA) is the average price of an asset over the last n periods, recalculated each period as the window “moves” forward. It smooths out day-to-day noise, so the underlying trend is easier to see.
The formula
SMA = (P₁ + P₂ + … + Pₙ) ÷ n
where P₁ to Pₙ are the closing prices of the last n periods.
A quick example
Here are five days of closing prices, with a 3-day SMA:
| Day | Close | 3-day SMA |
|---|---|---|
| 1 | $20 | — |
| 2 | $22 | — |
| 3 | $24 | ($20 + $22 + $24) ÷ 3 = $22.00 |
| 4 | $23 | ($22 + $24 + $23) ÷ 3 = $23.00 |
| 5 | $26 | ($24 + $23 + $26) ÷ 3 = $24.33 |
Each day, the oldest price drops out of the window and the newest one comes in.
Calculate an SMA in Excel
- Put the dates in column A and the closing prices in column B, starting in row 2.
- For a 3-day SMA, type
=AVERAGE(B2:B4)in C4, the first row with three prices. - Drag the fill handle down. Each row averages its own last three prices.
For a 50-day SMA, use 50 rows instead: =AVERAGE(B2:B51) in C51, then fill down. New to formulas? Start with the free Excel Essentials course.
How traders use SMAs
- Trend direction: when the price is above a rising SMA, the trend is generally up; below a falling SMA, generally down.
- Common lengths: the 50-day SMA is a popular medium-term trend line, and the 200-day SMA a long-term one.
- Crossovers: when the 50-day crosses above the 200-day, it’s often called a golden cross. When it crosses below, it’s a death cross. Both are widely watched trend signals.
- Support and resistance: some traders watch for prices to pause or bounce near a widely followed moving average.
Limits to keep in mind
- It lags. An SMA is built from past prices, so it always reacts after the move has started. The longer the window, the bigger the lag.
- Every day counts equally. A price from 50 days ago weighs as much as yesterday’s. The exponential moving average (EMA) gives recent prices more weight, so it reacts faster.
- Choppy markets cause false signals. When prices move sideways, the price and its SMA can cross back and forth many times.
A moving average is best used as one tool among several, not as a complete strategy.
This article is for education only and isn’t investment advice.