Moving averages: SMA vs EMA

A moving average is the average price of a stock over its last N periods, recalculated every period so that it "moves" along with the chart. By smoothing out day-to-day noise it makes the underlying direction easier to see. The two common versions, the simple moving average (SMA) and the exponential moving average (EMA), differ only in how much weight they give to recent prices.
The formulas
SMA(N) = (P1 + P2 + ... + PN) / N
k = 2 / (N + 1)
EMA = Price today x k + EMA yesterday x (1 - k)
The SMA gives every one of the last N closing prices the same weight. The EMA gives the newest price a weight of k and lets older prices fade gradually. For a 20-period EMA, k = 2 / 21, or about 9.5%. The first EMA value is usually seeded with the SMA of the first N periods, which is why EMAs on different platforms can differ slightly at the start of a chart.
Both averages are most often applied to closing prices on a daily chart, but they work on any time frame.
Example (illustrative numbers)
Take a 5-period average on a stock that has closed at exactly $10 for a while, then jumps to $20 and stays there. Here k = 2 / 6, or about 0.333.
| Day | Close | SMA(5) | EMA(5) |
|---|---|---|---|
| 5 | $10 | $10.00 | $10.00 |
| 6 | $20 | $12.00 | $13.33 |
| 7 | $20 | $14.00 | $15.56 |
| 8 | $20 | $16.00 | $17.04 |
On day 6 the EMA is $13.33: $20 x 0.333 plus $10 x 0.667. The SMA is $12.00 because the new $20 close is only one of five equal parts. The EMA reacts faster at first. The SMA must wait for the old $10 closes to drop out of its window, one per day, and then it moves in a straight line.
SMA versus EMA
| SMA | EMA | |
|---|---|---|
| Weighting | Equal across the window | Heavier on recent prices |
| Reaction speed | Slower | Faster |
| Smoothness | Smoother | Slightly more jagged |
| Quirk | Jumps when a large old price drops out of the window | Never fully forgets old prices, though their weight shrinks quickly |
Neither is better in general. The EMA responds sooner, which helps at turning points but also gives more false alarms. The SMA is steadier but later. Many traders choose by convention: the 50-day and 200-day SMAs are the most widely watched averages, while EMAs of 12 and 26 periods appear inside MACD.
One note on terminology: some indicators, such as RSI and ATR, use Wilder's smoothing, which is an exponential average with a weight of 1/N instead of 2/(N+1). The idea is the same, but the numbers are not identical to a standard EMA of the same length.
How to read a moving average
Common periods and what they roughly represent on a daily chart:
- 10 or 20 days: about two to four weeks of trading, used for short-term trend.
- 50 days: about ten weeks, a medium-term trend gauge.
- 200 days: about forty weeks, the usual line between a long-term uptrend and downtrend.
Rules of thumb that chart readers use:
- Position. Price above a rising average is consistent with an uptrend; price below a falling average is consistent with a downtrend.
- Slope. A flat average means the stock has no clear trend over that window. The slope often tells you more than the exact level.
- Distance. When price is far above or below its average, it is stretched relative to its recent past. That can precede a pullback or simply mark a strong trend.
- Bounces. In a steady trend, price often pauses near a rising average such as the 50-day. This is a tendency, not a rule, and the line is better treated as a zone than as an exact level.
- Crossovers. When a faster average crosses a slower one, it signals that the trend direction may have changed. The best-known example is the golden cross and death cross.
Common mistakes and limits
- Expecting prediction. A moving average is built entirely from past prices, so it always lags. It confirms a trend that is already underway.
- Whipsaws in sideways markets. When price chops around a flat average, it crosses it again and again, producing a string of signals that go nowhere.
- Hunting for the perfect period. Testing dozens of lengths until one fits history is a form of over-fitting. A setting that worked in the past has no guarantee going forward.
- Ignoring data length. A 200-day average needs 200 days of history, so recent listings cannot have one.
- Using it alone. Pair trend tools with something that measures volatility or participation, such as Bollinger Bands or volume. For the wider picture, see technical analysis basics.
Where to see it on StocksXray
Stock pages show a price chart with indicators, so you can judge where a stock sits relative to its own trend. The scanner has dedicated presets for the best-known crossovers: golden cross and death cross.
Key takeaways
- An SMA weights all N prices equally; an EMA weights recent prices more, using k = 2 / (N + 1).
- The EMA reacts faster and is noisier; the SMA is smoother and later.
- Price above a rising average, and below a falling one, is the basic trend read.
- Averages lag by design and generate false signals when a stock moves sideways.
- Treat each average as a zone and a context tool, not as a prediction.
Related reading
Educational only, not financial advice. Examples use illustrative numbers.