SMA vs EMA: moving average math, lag and crossovers
In short
SMA vs EMA comes down to weighting. A simple moving average (SMA) is the plain mean of the last N closes; an exponential moving average (EMA) weights recent closes more, using a factor of 2 ÷ (N + 1): over 20 sessions, 9.5% on the latest close against 5% for the SMA. At the same period both have the same average lag, (N − 1) ÷ 2 sessions, or 99.5 for a 200-day average. That is why crossovers arrive after the turn.
On February 19, 2025, the S&P 500 closed at a record 6,144. On April 8, after the tariff announcements of April 2, it closed at 4,982.77, down 18.9%. Four sessions later, on April 14, the index’s 50-day moving average dropped below its 200-day average, the crossover the financial press calls a death cross. Anyone who treated it as a sell signal would have sold with the low already behind them.
The opposite signal, the golden cross, came on July 1. Two sessions earlier, on June 27, the index had already closed at 6,173, a new record and 23.9% above the April low. Both crossovers announced a turn that had already happened.
2025 was typical. A Reuters analysis of LSEG data counted 24 S&P 500 death crosses over roughly fifty years: in 54% of cases the signal came after the lowest point of the decline. In the other 46% the selloff kept going, by another 19% on average, and after the death crosses of 2000 and 2007 the full declines reached 45% and 55%.
Both averages did what their arithmetic dictates, because a 200-session average holds prices that are, on average, a hundred sessions old. If you use moving averages on your own account, you need to know how much of the past sits inside each line, and the quickest way to find out is to calculate one by hand.
What is a moving average?
A moving average smooths a series of prices using a chosen period, N. An SMA uses a sliding window of N closes, while an EMA gives progressively less weight to older prices. The resulting line is smoother than price because every point summarizes many sessions.
Two versions dominate. The simple moving average (SMA) gives every close the same weight. The exponential moving average (EMA) gives recent closes more weight and older ones progressively less. The longer the period, the smoother the line and the slower it turns.
How do you calculate a simple moving average?
Take five hypothetical closes: $10, $11, $12, $13 and $14. They add up to 60, and 60 divided by 5 is 12: that is the 5-day SMA on day five. On day six the stock closes at $15. Fifteen enters, 10 leaves as the oldest close, and the average rises to 13. No need to redo the sum: add to yesterday’s average the difference between the close entering and the close leaving, divided by the period. 12 + (15 − 10) ÷ 5 = 13.
Try it before reading on. Same five closes, but on day six the stock closes at $13, so the price falls from 14 to 13. Does the 5-day average go up or down? Decide before you read the answer.
Why can a moving average rise when the price falls?
It rises, from 12 to 12.60. Thirteen enters, 10 leaves: the sum goes from 60 to 63, and 63 ÷ 5 is 12.60. The direction of an SMA depends only on the close entering versus the close leaving, which means today against five sessions ago.
On a real chart this means a 50-day SMA keeps rising as long as today’s close is above the close from fifty sessions ago, even if the stock has been falling for three weeks. When the line surprises you, check which close is dropping out of the calculation.
How do you calculate an exponential moving average?
The EMA keeps no window. Each day it moves yesterday’s average toward today’s price by a fixed fraction of the gap, called the smoothing factor, which under the most common convention is 2 ÷ (N + 1): 1/3 for a 5-period EMA, 0.095 for a 20-period one. The formula is today’s EMA = yesterday’s EMA + (today’s close − yesterday’s EMA) × 2 ÷ (N + 1).
On day one there is no yesterday’s EMA. Many platforms start from the SMA of the first N closes, others from the first close, and on a long EMA that choice changes the number you see for many sessions. Here are both 5-day averages on the same hypothetical series, which climbs to 14 and then falls.
| Day | Close | In / out | SMA 5 | EMA 5, worked |
|---|---|---|---|---|
| 1 to 4 | 10, 11, 12, 13 | n/a | n/a | n/a |
| 5 | 14 | first full window | 60 ÷ 5 = 12 | 12 (seeded with the SMA) |
| 6 | 13 | 13 in, 10 out | 12.60 | 12 + (13 − 12) × 1/3 = 12.33 |
| 7 | 12 | 12 in, 11 out | 12.80 | 12.33 + (12 − 12.33) × 1/3 = 12.22 |
| 8 | 11 | 11 in, 12 out | 12.60 | 12.22 + (11 − 12.22) × 1/3 = 11.81 |
Price peaks on day five. The EMA starts falling on day seven, the SMA only on day eight, because on day seven 11 leaves and 12 enters. The rules differ: the SMA rises when the close entering beats the close leaving, the EMA rises when today’s close is above yesterday’s EMA.
SMA vs EMA: what is the difference?
The difference is in the weights. In a 5-period SMA each close counts for 20%, and a close from six sessions ago counts for nothing. In a 5-period EMA the latest close counts for 33.3%, the one before for 22.2%, then 14.8%, 9.9% and 6.6%: each step back cuts the weight by a third, and it never reaches zero. The five most recent closes carry 86.8% of the weight; the remaining 13.2% is spread across closes the SMA has already forgotten.
With the 2 ÷ (N + 1) factor, the average age of the prices inside an EMA is identical to that of an SMA with the same period: (N − 1) ÷ 2 sessions, or 2 for a period of 5. In a steady trend both lines trail price by the same distance. The EMA gains ground at turning points, because it puts heavy weight on the latest session right away, and loses it after violent moves, because a spike from thirty sessions ago is still in its calculation.
| Period | Weight of latest close, SMA | Weight of latest close, EMA | Average lag, both |
|---|---|---|---|
| 10 | 10% | 18.2% | 4.5 sessions |
| 20 | 5% | 9.5% | 9.5 sessions |
| 50 | 2% | 3.9% | 24.5 sessions |
| 200 | 0.5% | 1.0% | 99.5 sessions |
Because the EMA never discards a weight, after N sessions its starting value still carries about 13.5% of the result, after 2N about 1.8%, and getting it below 1% takes 461 sessions on a 200-period EMA. Two platforms that load histories of different length will therefore show two different 200-day EMAs on the same stock, and both calculations are correct.
Why do moving average crossovers lag?
A crossover is the moment a fast average, with a short period, cuts through a slow one. The golden cross is the 50-day average rising above the 200-day; the death cross is the reverse. First price has to turn, then the fast average, and finally the fast average has to cover the whole distance to the slow one. Each step adds sessions.
In the illustrative example price drops 19% in eighteen sessions and then climbs past its previous peak. The bearish cross between the 10- and 40-session simple averages comes 9 sessions after the peak, with price already down 8.4%; the bullish cross comes 20 sessions after the low, with price already up 13.4%. On the same prices, crossovers between a 10- and a 40-period EMA arrive just one session earlier. The gap shows more on the slow average alone: the 40-period EMA turns up 14 sessions after the low, the 40-period SMA after 27.
In a sideways market the opposite happens: the averages braid around each other and each crossover reverses a few sessions later. To know whether a crossover rule makes money you need entries, exits and costs set in advance and a sample that includes the sideways stretches, as we explain in our guide to what paper trading can and can’t test.
Which moving averages should you use: 10, 20, 50 or 200?
On a daily chart the 200-day average covers a little over nine months of trading and is the one most often quoted for an index’s long-term trend; the 50-day covers about two and a half months, the 20-day about one. What matters is that the period stays the same and is always calculated on the same data: the same price field (almost always the close of each candlestick), the same adjusted or unadjusted prices, the same interval. A 20-period average on hourly closes covers just over three trading days, one of several reasons to read the daily and weekly trend together.
If you use TC2000, save these settings in your layout and keep them identical across charts. We work from our own TC2000 setup, refined over about two years, and when two screens disagree the first thing we check is the input data.
Three common moving average mistakes
Picking the period that worked best in the past
Test twenty periods on ten years of chart and one of them will come out best by chance alone. Showing that one and hiding the other nineteen buries the failed comparisons, and nobody knows whether it will stay the best on data still to come. Decide what you want to measure first, then choose the period.
Treating the average as a floor
Plenty of traders buy when price touches the 50-day average, as if the line had to hold. The average is a statistic about the past, and price can cut through it without anything changing in the business. If you want price references, think in zones, as in our guide to support and resistance.
Buying a crossover without knowing where you’ll get out
A bullish crossover arrives after price has already risen, 13.4% off the low in the example. If you decide the exit afterward, the first pullback can take back in a few days what the signal needed weeks to confirm. Write the exit level down before you enter and work out your position size from there.
Moving averages tell you where price stands against its own past and nothing about how a stock compares with the market. For that you need relative strength, which shares only its name with the RSI indicator, as we explain in our guide to relative strength vs RSI.
The value (N − 1) ÷ 2 describes the average age of prices in the filter, with the EMA in steady state. It does not mean every signal or reversal arrives exactly that many sessions later: observed delay depends on the price path and signal definition. The EMA’s faster reaction in the worked example is not a rule for every series.
Frequently asked questions
Is SMA or EMA better?
It depends on what you want to measure. The EMA gives more weight to recent closes. The SMA treats every session equally and is easier to reproduce and compare across platforms. At the same period both have the same average lag, (N − 1) ÷ 2 sessions, so neither one gets ahead of price.
What are the golden cross and the death cross?
The golden cross is the 50-day moving average rising above the 200-day; the death cross is the 50-day falling below the 200-day. Both are slow by construction: in a Reuters analysis of LSEG data covering 24 S&P 500 death crosses over roughly fifty years, the signal arrived after the low of the decline in 54% of cases.
How do you calculate an EMA in Excel?
Put the factor 2 ÷ (N + 1) in a cell, for example H1. Use the simple average of the first N closes as the starting value; from the next row on, write yesterday’s EMA + (today’s close − yesterday’s EMA) × H1, locked as $H$1, and drag down.
Why is my moving average different from my broker’s?
Almost always because of the input data: price field, adjusted or unadjusted prices, interval, extended session. For an EMA the starting point and the amount of history loaded matter too: on a 200-period EMA the starting value still carries 13.5% after 200 sessions and drops below 1% only after about 460.
How much does the 200-day moving average lag?
It covers 200 sessions, a little over nine months of trading, and the prices inside it are on average 99.5 sessions old, close to five months. That holds for both the SMA and the 200-period EMA built with the 2 ÷ (N + 1) factor, which is why it describes the long-term trend well and flags turns late.
Sources and further reading
- Reuters (via KFGO): S&P 500’s looming “death cross” may not be as ominous as it sounds, April 14, 2025
- Yahoo Finance: The S&P 500 just flashed a “golden cross” (July 2025)
- CBS News: S&P 500 closes at record high (June 27, 2025)
- Wikipedia: 2025 stock market crash, S&P 500 closes in April 2025
- Fidelity: technical analysis session on moving averages (transcript)
