Trend Indicators

Moving Averages (SMA and EMA): How They Work, Settings and Crossovers

Also called: SMA · EMA · Simple moving average · Exponential moving average

The average price over a rolling window, used to smooth out noise and show the direction of a trend. The most widely used indicator of all.

A moving average takes the average closing price over the last n periods and recalculates it every period, so the line “moves” with the chart. It smooths day-to-day noise and makes the underlying direction easier to see.

There are two main types. A simple moving average (SMA) gives every period equal weight. An exponential moving average (EMA) gives more weight to recent prices, so it reacts faster to new moves but also produces more false turns.

Moving averages are the foundation of many other indicators, including MACD, Bollinger Bands and Keltner Channels.

20-day and 50-day simple moving averages on a sample price series
  • Price (sample data)
  • SMA 20
  • SMA 50
20-day and 50-day simple moving averages on a sample price series100120140Day 1Day 31Day 61Day 91Day 121Day 151

Calculated on an illustrative price series, not real market data. The faster 20-day average turns before the slower 50-day average as the trend changes.

How it is calculated

SMAn = (P1 + P2 + … + Pn) ÷ n    EMAtoday = Ptoday × k + EMAyesterday × (1 − k)

P
closing price of each period
n
number of periods in the average
k
smoothing factor = 2 ÷ (n + 1)

The first EMA value is usually seeded with the SMA of the first n periods.

How traders read it

  • Direction: a rising average suggests an uptrend, a falling one a downtrend. The slope matters more than any single crossing.
  • Price vs average: price holding above a key average (often the 200-day) is widely read as a sign of a healthy long-term trend; below it, of weakness.
  • Crossovers: when a faster average crosses above a slower one, traders call it bullish; a cross below is bearish. The 50-day crossing above the 200-day is the well-known golden cross; crossing below is the death cross.
  • Dynamic support and resistance: in trends, prices often pull back towards a moving average before continuing, so traders watch averages as areas of interest.

Common settings

  • 20 periods for short-term trends, 50 for medium-term and 200 for long-term trends on daily charts.
  • EMAs of 9, 12, 21 and 26 periods are popular with short-term traders.
  • There is no “correct” length: shorter averages react faster but whipsaw more; longer averages are smoother but later.

Limitations

Moving averages lag by design: they confirm a trend after it has started and signal a reversal after it has happened. In sideways, choppy markets they cross back and forth and generate many losing signals.

Crossover rules have been studied extensively; results vary by market and period, and simple rules often lose much of their edge after trading costs. Treat crossovers as a description of the trend, not a forecast.

Works well with

A trend-strength gauge such as ADX helps filter out crossovers in trendless markets, and ATR helps size stops. See the trend-following combination.

Worked example

Worked example

Five closing prices: 10, 11, 12, 11 and 13. The 5-day simple moving average is (10 + 11 + 12 + 11 + 13) ÷ 5 = 11.4.

For a 5-day exponential moving average the weight is k = 2 ÷ (5 + 1) ≈ 0.333. Starting from 11.4, if the next close is 14, the EMA becomes 14 × 0.333 + 11.4 × 0.667 ≈ 12.27. The EMA moves further towards the new price than an SMA would, because recent prices carry more weight.

Common mistakes

  • Expecting a crossover to arrive early. By construction a moving average confirms a move after it has started.
  • Switching periods until the chart “fits”. Pick a setting for a reason and keep it, or test it properly.
  • Using crossovers in a sideways market, where they produce repeated false signals.

Frequently asked questions

Which is better, SMA or EMA?

Neither is better in every case. The EMA reacts faster to recent prices, which helps catch turns earlier but gives more false signals. The SMA is smoother and is the more common choice for long-term levels like the 200-day average.

What is a golden cross?

When the 50-day moving average crosses above the 200-day moving average. It is widely watched as a sign of a strengthening long-term trend, but it occurs after much of the move has already happened.

Related

More trend indicators

Indicators describe what prices have done; none of them predicts what prices will do. Charts use an illustrative price series, not real market data. This page is education, not investment advice.