Library · Indicators
SMA (Simple Moving Average)
The simple moving average is the plain arithmetic mean of the last N closing prices, with every close in the window given exactly the same weight.
Why it matters
The simple moving average (SMA) is the most basic indicator there is. If you understand how to take an average, you already understand it. That makes it the best place to learn how indicators behave in general: what smoothing is, where lag comes from and why settings change sensitivity.
It also sits inside other tools. The middle line of Bollinger Bands is an SMA, and volume averages are usually SMAs too.
What it looks like
The SMA is one line drawn over the candles. Each point on it is the average of the closes in the window that ends at that candle.
How it is calculated
- Take the windowThe last N closing prices.
- Add them upEvery close counts once.
- Divide by NThe result is one point on the line.
- Slide forwardOn the next close, drop the oldest price and repeat.
SMA(N) = (C1 + C2 + ... + CN) / NC1 to CN are the last N closing prices. Each one has a weight of 1/N.In plain words
Imagine a queue with exactly N seats. Each new closing price takes a seat at the front and the oldest one leaves from the back. The SMA is simply the average of whoever is seated right now.
A 5-period SMA with made-up pricesHypothetical illustration
A hypothetical asset closes at 98, 100, 101, 103 and 108. The sum is 510, so the SMA is 510 / 5 = 102.
The next candle closes at 104. The 98 leaves the window. The new sum is 100 + 101 + 103 + 108 + 104 = 516, and the SMA is 516 / 5 = 103.2.
Notice that price fell from 108 to 104 on that candle, yet the SMA rose from 102 to 103.2. The close that entered (104) was higher than the close that left (98).
Settings and what they change
The only real setting is the period N. Most platforms also let you pick the input, which is the closing price by default.
| Period | Behaviour | Trade-off |
|---|---|---|
| Short (for example 10) | Stays close to price, turns quickly | More false turns in choppy markets |
| Medium (20 or 50) | Common middle ground | Moderate lag |
| Long (100 or 200) | Very smooth, far from price | Reacts late to real changes |
There is no correct period. Picking the length that would have fitted a past chart best is overfitting: the setting was chosen with hindsight and often stops fitting once new candles print.
How to read it
- A rising SMA means the average close of the window is going up. A falling SMA means it is going down.
- Price above the SMA means the latest close is higher than the average of the last N closes. Price below means it is lower.
- Price crossing the SMA means the latest close has moved from one side of its recent average to the other. It is a description of what happened, not an instruction.
- A flat SMA with price weaving through it usually accompanies a range.
Going deeper
Equal weights and the drop-off effect
Because every close has the same weight, an SMA reacts twice to any unusual candle: once when it enters the window and again when it leaves.
Suppose the last five hypothetical closes are 120, 100, 100, 100 and 100. The SMA is 520 / 5 = 104. The next close is 100 again. Price has not moved, but the 120 drops out and the SMA falls to 500 / 5 = 100. The line moved because of a candle from five periods ago, not because of anything happening now.
This is the main practical difference from the EMA, where old prices fade gradually instead of leaving all at once.
How practitioners use it
Long SMAs such as the 50 and 200 on daily charts are widely followed, mostly as a rough description of the long-term trend. Some traders watch them as areas of dynamic support and resistance, and some compare a fast and a slow SMA, which is the basis of moving average crossovers.
In each case the SMA is used as context alongside market structure and volume. On its own it only restates past closes.
What it does NOT mean
- Price above the SMA does not mean “bullish from here”. It means the last close is above the average of the last N closes. Nothing more.
- The SMA is not a level that price respects. Price crosses it freely, and often.
- A turn in the SMA does not mark the turn in price. By the time the line bends, price turned some candles earlier.
- The 200-period SMA has no special power. It is widely watched by convention, and conventions can be ignored by the market at any time.
Common mistakes
- Treating a price cross as a “buy signal” or “sell signal”. It is neither. In sideways markets these crosses happen constantly and lead nowhere.
- Forgetting the drop-off effect. An SMA can move because an old candle left the window.
- Optimising the period on past data. The best-looking historical setting is usually an overfitted one.
- Comparing SMAs across timeframes as if they were the same. A 50-period SMA on a 15-minute chart covers about half a day. On a daily chart it covers 50 days.
Risks and limitations
- The SMA lags by construction. Roughly speaking, it reflects prices from the middle of its window.
- It whipsaws in ranges and in volatile, directionless markets.
- It uses only closing prices. Highs, lows, volume and news are invisible to it.
- Equal weighting makes it slow to reflect a genuine change in conditions.
Key takeaway
The SMA is the plain average of the last N closes. It is smooth, easy to verify by hand and always behind price.
Sources and further reading
- Technical Analysis of the Financial Markets, John J. Murphy (1999). Chapter on moving averages