Technical Indicators
IntermediateLesson 34 of 70 · 9 min read

Moving averages: SMA and EMA

Moving averages smooth out price to show the trend; learn how they are calculated, what 9, 20, 50 and 200 mean, and how crossovers work.

Prefer bite-sized cards? Use Step by step above to study this lesson one idea at a time, with a quiz at the end.

A moving average (MA) is the average price over the last so-many candles, recalculated every time a new candle closes. Plotted as a line, it smooths out the jagged ups and downs so the underlying direction is easier to see. The number of candles used is called the period or length.

Simple moving average (SMA)

147.00147.50148.00148.2010:1810:3410:5011:0611:2211:3811:5412:10
12:20O 148.20H 148.22L 148.19C 148.20SMA 9SMA 20
Price with simple moving averages. The shorter average hugs price; the longer one is smoother and slower.

The SMA adds up the last N closing prices and divides by N. Every candle counts equally.

Example · Calculating a 5-period SMA
The last five closes are $10, $11, $12, $11 and $13. Sum = $57. SMA = $57 ÷ 5 = $11.40. The next candle closes at $14. The oldest close ($10) drops out and $14 comes in: $11 + $12 + $11 + $13 + $14 = $61, and $61 ÷ 5 = $12.20. That dropping and adding is why it 'moves'.
5-period SMA
$57
Last 5 closes added
÷
5
Number of closes
=
$11.40
SMA
Next close $14: the $10 drops out, the sum becomes $61, and $61 ÷ 5 = $12.20.

Exponential moving average (EMA)

226.00228.00230.00232.00226.4510:1810:3410:5011:0611:2211:3811:5412:10
12:20O 226.42H 226.45L 226.35C 226.45EMA 9EMA 20
A fast and a slow EMA. When the fast line crosses the slow line, the short-term trend has changed relative to the longer one.

The EMA gives more weight to the most recent candles, so it reacts faster than an SMA of the same length. Each new EMA value moves part of the way from the old EMA toward the newest close. The size of that step is the multiplier 2 ÷ (N + 1).

One step of a 9 EMA
$12.00
Old EMA
+
0.2
2 ÷ (9 + 1)
×
$1.00
Gap to new close
=
$12.20
New EMA
The EMA closes 20% of the gap to price on each candle.
Example · One step of a 9 EMA
For a 9 EMA the multiplier is 2 ÷ (9 + 1) = 0.2. If the previous EMA was $12.00 and the new close is $13.00, the gap is $1.00. New EMA = $12.00 + 0.2 × $1.00 = $12.20. You never need to do this by hand; the point is that the EMA closes 20% of the gap to price on each candle.
SMA versus EMA
SMA
  • All candles count equally
  • Slower, smoother
  • Downside: late to turn
  • Common use: 50 and 200 on daily charts
EMA
  • Recent candles count more
  • Faster, more responsive
  • Downside: more false signals in choppy markets
  • Common use: 9 and 20 on intraday charts

The common lengths

What each length is used for
9
Very short-term momentum. In a strong intraday trend price often rides the 9 EMA
20
Short-term trend. Pullbacks to the 20 EMA are a popular place to look for entries
50
Medium-term trend. Widely watched on daily charts
200
Long-term trend. Above the 200-day SMA is seen as healthy, below it as weak

These numbers are not magic. They matter mostly because so many people watch them, so price often reacts near them.

How traders read them

Slope
Rising: uptrend on that timescale. Falling: downtrend. Flat: a range
Price versus the average
Above a rising average is strong. Below a falling average is weak
Dynamic support
In a trend, pullbacks often stall near the average: support or resistance that moves
Crossovers
Fast above slow (e.g. 9 EMA over 20 EMA) is bullish. Crossing below is bearish

Two crossovers have names. A golden cross is the 50-day SMA crossing above the 200-day SMA. A death cross is the 50-day crossing below the 200-day. They are long-term signals watched by investors more than day traders.

Golden cross
  • 50-day SMA crosses above the 200-day SMA
Death cross
  • 50-day SMA crosses below the 200-day SMA
Long-term signals, watched by investors more than day traders.
Crossovers get chopped up in ranges
When price moves sideways, the averages tangle together and cross back and forth. Each cross gives a signal that fails almost immediately. This is called a whipsaw. Moving averages are trend tools and only work when there is a trend.
The whipsaw
1234
No trend
  1. 1Price goes sideways
  2. 2Averages tangle
  3. 3They cross: a signal
  4. 4Signal fails at once
Tip
Use moving averages as a filter more than a trigger. A simple rule such as 'only look for long trades when price is above a rising 20 EMA' keeps you on the right side of the trend without relying on late crossover signals.

Key takeaways

  • A moving average is the average price over the last N candles, redrawn as each candle closes.
  • The SMA weights all candles equally; the EMA weights recent candles more and reacts faster.
  • 9 and 20 are common intraday lengths; 50 and 200 are watched on daily charts.
  • Slope, price position and crossovers describe the trend, but always with a lag.
  • In sideways markets, moving averages produce repeated false signals called whipsaws.
Try the indicators in the simulator

Check your understanding

Score 70% or more to pass the lesson. You can retry as often as you like.

1. The last four closes are $20, $22, $21 and $25. What is the 4-period SMA?
2. How does an EMA differ from an SMA of the same length?
3. What is a 'golden cross'?
4. When do moving-average crossover signals work worst?