Technical analysis

Moving Averages Explained: SMA vs. EMA and How to Use Them

Simple vs. exponential moving averages, the 20, 50 and 200-day lines, how to use them for trend and support, and their main limitations.

Key takeaways

  • A simple moving average (SMA) weights every day in its window equally; an exponential moving average (EMA) gives the latest close a weight of 2/(N+1), so it turns faster and lags less.
  • The 20-, 50- and 200-day averages are conventions for short-, medium- and long-term trends. Their main value is that millions of people watch the same lines.
  • From January 1971 to October 2026, the S&P 500 closed above its 200-day SMA on about 72% of trading days. The next day's price change annualized to about 9.7% after closes above the line and 4.5% after closes below, with nearly twice the volatility below.
  • Moving only in and out of the market on that line would have roughly halved the worst drawdown but earned less than buying and holding: about 6.9% a year in price terms against 8.3%, before costs, taxes, dividends and interest on cash.
  • Moving averages fail in sideways markets: the S&P 500 crossed its 200-day line 372 times in that period, and most dips below it reversed within a week.

A moving average is the average closing price over the last N trading days, recalculated every day so the line "moves" with the chart. The two main types differ in how they weight those days: the simple moving average (SMA) counts each day equally, while the exponential moving average (EMA) gives more weight to recent closes. In practice the EMA reacts faster to a turn; the SMA is smoother and less prone to false signals.

Neither is better in general. The choice depends on whether you care more about reacting early or about avoiding noise, and the period you choose (20, 50 or 200 days) matters more than the type. Below are the formulas with a worked example, the standard periods, an original look at the 200-day line on the S&P 500 since 1971, and the traps to avoid.

How is the simple moving average calculated?

The SMA adds the last N closes and divides by N:

SMA = (C1 + C2 + … + CN) ÷ N

Each day, the newest close enters the window and the oldest drops out. That second part is easy to forget: an SMA can rise on a day the price falls, simply because the close leaving the window was even lower. Analysts call this the drop-off effect, and it is why a 200-day SMA sometimes turns for reasons that have nothing to do with today's market.

How is the exponential moving average calculated?

The EMA blends today's close with yesterday's EMA, using a smoothing multiplier k:

k = 2 ÷ (N + 1)
EMAtoday = closetoday × k + EMAyesterday × (1 − k)

For a 20-day EMA, k = 2/21 ≈ 0.095, so today's close counts for about 9.5% and everything before it for the rest. For a 200-day EMA, k = 2/201 ≈ 0.01. Because each EMA value carries the previous one forward, older prices never fully disappear; their influence just shrinks geometrically. The first EMA value needs a starting point, and VantageLedger, like most charting software, seeds it with the SMA of the first N closes.

SMA vs. EMA: a worked example

Take a hypothetical stock with these seven daily closes, and a 5-day average of each type. The EMA multiplier is 2/(5+1) = 1/3, and the EMA starts on day 5 from the 5-day SMA.

Day Close 5-day SMA 5-day EMA
1$100——
2$102——
3$101——
4$105——
5$107$103.00$103.00 (seed)
6$110$105.00$105.33
7$104$105.40$104.89

The arithmetic:

  • Day 5 SMA: (100 + 102 + 101 + 105 + 107) ÷ 5 = 515 ÷ 5 = 103.00.
  • Day 6: SMA = (102 + 101 + 105 + 107 + 110) ÷ 5 = 105.00. EMA = 110 × 1/3 + 103 × 2/3 = 105.33.
  • Day 7: SMA = (101 + 105 + 107 + 110 + 104) ÷ 5 = 105.40. EMA = 104 × 1/3 + 105.33 × 2/3 = 104.89.

On day 6 the jump to $110 lifts the EMA more than the SMA. On day 7 the price falls 5.5%, and the two lines move in opposite directions: the EMA drops, while the SMA rises, because the $102 close leaving its window was lower than the new $104. That is the whole SMA-versus-EMA trade-off in one row.

Lag vs. responsiveness: which should you use?

Every moving average lags, because it is built from past prices. A rough rule: an N-day SMA's center of gravity sits about (N − 1)/2 days in the past, so a 200-day SMA reflects where prices were around 100 trading days ago. An EMA of the same length leans more on recent prices and turns sooner.

Faster is not automatically better. Using VantageLedger's daily S&P 500 history from 1971 to October 2026, the close crossed its 200-day SMA 372 times and its 200-day EMA 416 times: the more responsive line gave about 12% more signals, and in a choppy market more signals mostly means more false ones. The usual compromise:

  • EMAs for shorter periods and trading signals, where reaction speed matters (MACD is built from 12- and 26-day EMAs; see the MACD guide).
  • SMAs for long-term trend filters such as the 200-day line, where stability and comparability with what everyone else watches matter more.

The 20, 50 and 200-day moving averages

These three periods are conventions rather than optimized values, but conventions matter in markets: a widely watched line can attract orders simply because so many people look at it.

  • 20-day (about one month of trading): short-term trend, used by swing traders and as the middle line of Bollinger Bands Explained: Squeeze and Strategies.
  • 50-day (about ten weeks): the medium-term trend. Pullbacks to a rising 50-day line are a classic entry point in growth stocks.
  • 200-day (about ten months): the long-term trend and the line financial media quote most. Price above a rising 200-day average is the most common definition of a long-term uptrend.

The shorter the period, the more often price crosses it. Over the same 1971–2026 window, the S&P 500 crossed its 20-day SMA about 29 times a year, its 50-day about 17 times a year and its 200-day fewer than 7 times a year. VantageLedger's charts draw SMA and EMA lines at 20, 50, 100 and 200 days, so you can see how each behaves on Apple or the Nasdaq 100 ETF (QQQ).

Does the 200-day moving average work? What the S&P 500 data shows

We tested the most famous use of a moving average, "stay invested when the market is above its 200-day line", on the S&P 500 price index. The method:

  • Data: VantageLedger's daily closes for ^GSPC. The test starts on January 4, 1971, so every 200-day average uses only data from 1970 onward (the series has no data from April 1960 to December 1969), and runs to October 23, 2026: 14,071 sessions.
  • Signal: on each day, is the close above the 200-day SMA of the last 200 closes, including that day?
  • Return: the change from that close to the next day's close, so the signal never uses information it could not have had.
  • Annualizing: the average daily log return in each group, times 252 trading days, converted back to a percentage. Price only: no dividends, no trading costs, no taxes, no interest on cash.
S&P 500, Jan 1971 – Oct 2026 Share of trading days Next-day price return, annualized Volatility, annualized
Close above 200-day SMA72%9.7%13%
Close below 200-day SMA28%4.5%25%
All days (buy and hold)100%8.3%17%

Three findings stand out. First, the market spends most of its time above the line: 72% of sessions overall, ranging from 55% to 58% in the 1970s and 2000s to about 85% in the 1990s and 2010s. Second, returns after closes below the line were still positive on average, just lower. Third, and most striking, volatility below the line was nearly twice as high: crashes, panics and the biggest rebound days cluster there.

What if you had held the index only after closes above the line, and sat in cash otherwise? Price return would have fallen from about 8.3% to about 6.9% a year, but the worst peak-to-trough decline would have shrunk from about 57% (2007–09) to about 28%. That is the honest picture of a 200-day filter: it is a risk-reduction tool, not a return enhancer. In reality the gap would be shifted by factors we left out: interest earned on cash helps the filter, while lost dividends, trading costs and taxes on 186 round trips hurt it.

The table below lists the S&P 500's declines of 20% or more since 1971. The filter helped most in slow, grinding bear markets: after a few false starts, it gave its last exit signal at about 1,476 in late December 2007 and its re-entry at about 943 in June 2009. It helped less in fast crashes, where the index had already fallen more than 10% from its peak before closing below the line (October 1987, February 2020). And it whipsawed in choppy stretches: 32 crossings between March 2000 and the end of 2003, and 20 between January 2022 and March 2023.

Peak Bottom Decline Back at peak
−48.2%
−27.1%
−33.5%
−49.1%
−56.8%
−33.9%
−25.4%
S&P 500 declines of 20% or more from a record close, on daily closes through . Recovery is the first close back at the prior peak. Periods with gaps in our history are skipped.

How to use moving averages

As a trend filter

The simplest use: only consider buying when price is above a rising 200-day (or 50-day) average, and be more cautious below it. Many long-term investors use it only to avoid adding money into a collapsing market.

As dynamic support and resistance

In a steady uptrend, pullbacks often stall near the 20- or 50-day line; in a downtrend, rallies often fail there. Treat the average as a zone rather than a precise level, and look for confirmation from price action or volume.

For crossovers

A shorter average crossing a longer one signals a change in trend. The best-known is the 50-day crossing above the 200-day, the golden cross, and its opposite, the death cross; see Golden Cross and Death Cross Explained. Crossovers between two averages are slower than price-versus-average signals but produce fewer whipsaws.

You can track any of these without watching the chart: the screener lists every asset where, for example, the 50-day SMA has just crossed above the 200-day, and an indicator alert can email you when it happens on a chosen asset.

Find moving-average crossovers

Other moving averages: WMA, HMA, DEMA, TEMA and KAMA

Several variants try to reduce lag without adding too much noise. All are available on VantageLedger charts:

  • WMA (weighted): linear weights, the latest day counting N times as much as the oldest.
  • HMA (Hull): combines WMAs of different lengths and smooths the result, giving a fast line with little lag.
  • DEMA and TEMA (double and triple exponential): subtract part of the lag by combining an EMA with EMAs of itself. Very responsive, and correspondingly jumpier.
  • KAMA (Kaufman adaptive): speeds up when prices move efficiently in one direction and slows down when they chop sideways, which directly targets the whipsaw problem.

None of them escapes the basic trade-off: whatever reduces lag also lets more noise through.

Moving average pitfalls

  • Whipsaws in sideways markets. When prices range, they cross the average back and forth. Of the 186 times the S&P 500 closed below its 200-day SMA between 1971 and October 2026, 111 lasted five sessions or fewer before it closed back above. Some traders require a close a few percent beyond the line, or two consecutive closes, before acting.
  • Lag at turning points. A long average confirms a new trend only after a sizable part of the move has happened.
  • Optimizing the period. Searching for the "best" period on past data (say, a 163-day EMA) almost always finds one that worked historically and fails afterwards.
  • Ignoring the slope. Price above a falling 200-day average is a weaker signal than price above a rising one.

For how moving averages fit with oscillators and volatility tools, see The Best Technical Indicators and How to Combine Them and Technical Analysis for Beginners.

FAQ

Is EMA better than SMA?

Neither is better in general. The EMA reacts faster and suits shorter-term signals; the SMA is smoother and suits long-term trend filters. On the S&P 500 since 1971, the 200-day EMA produced about 12% more crossings than the 200-day SMA.

What is the best moving average for day trading?

Day traders typically use short EMAs, such as 9 or 20 periods, on intraday bars. VantageLedger works on daily data, so its moving averages suit swing traders and investors rather than intraday trading.

Why is the 200-day moving average important?

It is the most widely followed long-term trend line, roughly ten months of trading. Since 1971 the S&P 500 has spent about 72% of sessions above it, and the days below it have been far more volatile.

How many days is a 50-day moving average?

Fifty trading sessions, about ten weeks or two and a half months, because weekends and market holidays are not counted.

This article is for education only and is not investment advice. Past performance does not guarantee future results. Live figures are computed from daily closing prices and can lag the market by a day or more.

Instruments in this article

Keep reading