EMA vs SMA: Formulas, Lag and Which Moving Average to Use

An SMA gives every bar in its window equal weight; an EMA gives the newest bars more. On the same 15-bar hypothetical series, after a 6-point jump the 5-bar EMA sat 5.03 below price against 6.00 for the 5-bar SMA, so it reacted faster, but in a steady trend both lag by the same number of bars.

SMA and EMA formulas

The simple moving average (SMA) of N bars is the sum of the last N closes divided by N. Every bar in the window has the same weight, 1/N, and a bar drops out completely the moment it leaves the window.

The exponential moving average (EMA) keeps a running value and blends in each new close: EMA = close × α + previous EMA × (1 − α), where α = 2 ÷ (N + 1). For N = 5, α = 2 ÷ 6 = 0.3333, so the newest close gets one third of the weight and the old EMA gets two thirds. Older bars never drop out; their weight just shrinks by the same factor each bar.

The EMA needs a starting value. A common choice, used here, is the SMA of the first N bars. Platforms differ: some start from the first close. The two versions converge after a few dozen bars, but the early values can differ.

Worked example: 5-bar SMA and EMA on the same series

The closes are hypothetical, made up for this page, with a 6-point jump at bar 9. Both averages use N = 5, so the first value is at bar 5.

SMA at bar 5 = (100 + 101 + 100 + 102 + 101) ÷ 5 = 100.80. The EMA starts at the same 100.80. At bar 6 the close is 103: SMA = (101 + 100 + 102 + 101 + 103) ÷ 5 = 101.40; EMA = 103 × 0.3333 + 100.80 × 0.6667 = 34.33 + 67.20 = 101.53.

At bar 9 the close jumps to 110. SMA = (101 + 103 + 102 + 104 + 110) ÷ 5 = 104.00. EMA = 110 × 0.3333 + 102.46 × 0.6667 = 36.667 + 68.306 = 104.97. The EMA moved about one point more toward the new price.

BarClose (hypothetical)SMA(5)EMA(5)Close − SMAClose − EMA
5101100.80100.800.200.20
6103101.40101.531.601.47
7102101.60101.690.400.31
8104102.40102.461.601.54
9110104.00104.976.005.03
10111106.00106.985.004.02
11110107.40107.992.602.01
12112109.40109.332.602.67
13111110.80109.880.201.12
14113111.40110.921.602.08
15112111.60111.280.400.72

Which one lags less?

In the table, the EMA is closer to price right after the jump: at bar 9 it trails by 5.03 against 6.00 for the SMA, and at bar 10 by 4.02 against 5.00. So after a sudden move the EMA responds faster.

The picture reverses later. By bar 13 the SMA is 110.80, only 0.20 below the close, because the old 100 to 104 bars have left its window. The EMA is 109.88, still 1.12 below, because those old bars still carry a small weight. That tail is the cost of the EMA's design.

In a steady straight-line trend there is no difference in average lag: an N-bar SMA lags price by (N − 1) ÷ 2 bars, and an EMA with α = 2 ÷ (N + 1) lags by the same (N − 1) ÷ 2. For N = 5 that is 2 bars. The EMA's advantage is the weighting of the latest bars, not a lower overall lag. Neither average predicts anything; both describe where price has been.

How does the length change the EMA weight?

The smoothing factor α = 2 ÷ (N + 1) sets how much of each new close enters the EMA. A short EMA gives the newest close a large share, so it hugs price; a long EMA gives it a tiny share, so it moves slowly. The table shows the share for common lengths.

Take the 20-bar EMA. α = 2 ÷ 21 = 0.0952, so if the previous EMA is 100.00 and the next close is 102.00, the new EMA = 102.00 × 0.0952 + 100.00 × 0.9048 = 9.71 + 90.48 = 100.19. A 2-point surprise moves the 20-bar EMA by 0.19. The same close on the 5-bar EMA from the example (α = 0.3333) would move it 0.67: 102.00 × 0.3333 + 100.00 × 0.6667 = 34.00 + 66.67 = 100.67.

That is the practical meaning of length: it decides how much a single bar is allowed to matter. If you pick a length that makes your average jump around, you will get more signals and more false ones; if you pick one that barely moves, you will get fewer and later ones.

Length Nα = 2 ÷ (N + 1)Share of the newest closeLag in a steady trend, bars
50.333333.3%2
90.200020.0%4
200.09529.5%9.5
500.03923.9%24.5
2000.01001.0%99.5

Which lengths do traders use?

There is no correct length. Common choices are short averages of 9 or 10 for entries on intraday charts, 20 as a one-month proxy on a daily chart, and 50, 100 and 200 for the longer trend. A longer length is smoother and slower, and a shorter one is noisier and faster. Whether you pick EMA or SMA matters less than whether you use the same setting consistently and understand what it does.

Crossovers, where a short average crosses a longer one, are widely used. A 50-day average crossing above a 200-day average is often called a golden cross and the reverse a death cross. These are lagging signals: by the time they appear a large part of the move has usually happened, and in a sideways market the averages cross repeatedly and produce losing trades.

SMAEMA
WeightsEqual across the windowHigher on recent bars, decaying
Old barsDrop out when they leave the windowNever drop out; weight shrinks
Reaction to a sudden moveSlower at first, then catches upFaster at first, keeps a small tail
Lag in a steady trend(N − 1) ÷ 2 bars(N − 1) ÷ 2 bars
Needs a starting value?NoYes, usually the first SMA

Limits and who should not rely on moving averages

Moving averages lag by construction, work best in trending markets, and give repeated false signals in ranges. Switching between SMA and EMA after a losing trade, or tuning the length until past data looks good, tends to produce a rule that fits the past and fails live.

If you want fast reaction to news-driven moves, an average is the wrong tool and a defined stop and risk limit matter more. If you trade very short timeframes with a platform that restarts the EMA each session, check its seeding. Nothing here is a trading recommendation, and trading carries a risk of loss.

Frequently asked questions

What is the difference between EMA and SMA?

An SMA weights every bar in its window equally. An EMA weights recent bars more, using EMA = close × α + previous EMA × (1 − α) with α = 2 ÷ (N + 1).

Is EMA better than SMA?

Not in general. The EMA reacts faster to a sudden move, but in a steady trend both lag by (N − 1) ÷ 2 bars, and the EMA's tail can keep it behind after the old data should have faded.

What does EMA stand for in trading?

Exponential moving average.

What are the most common moving average lengths?

9 or 10, 20, 50, 100 and 200 bars are common. None is universally best.

Why are my EMA values slightly different from this page?

The EMA starting value varies by platform. This page seeds it with the SMA of the first N bars; some platforms start from the first close.

Sources

This page explains a standard formula using hypothetical numbers we calculated ourselves; every figure can be checked from the arithmetic shown, so no outside source is needed.