EMA / SMA — Moving averages

A moving average filters price noise by averaging a sliding window: the SMA with equal weights, the EMA with more weight on recent bars. It is the building block behind half the indicator catalogue.

On this page

The moving average is the oldest filter in technical analysis: the average of the last n closes, recomputed on every bar. Raw price wobbles even when nothing meaningful is happening; the average cancels most of that back-and-forth and leaves the underlying direction visible. Almost everything you will meet in this catalogue — MACD, Bollinger Bands, Supertrend, ADX — is built on top of this idea.

In plain terms — Price is a crowd shouting different numbers every second; the moving average is the crowd's average voice. It does not tell you the next number: it tells you which way the chorus is drifting.


What it measures

A moving average answers a single question: noise aside, where is price going? The parameter n (the window) decides how much noise is removed — and how much lag you pay in exchange:

Window Behaviour Typical use
Short (9–21) Responsive, jumpy Riding the current trend, dynamic support
Medium (50) The compromise Swing-trading context
Long (100–200) Stable, slow Regime filter: above or below?

The trade-off is structural, not a flaw to engineer away: more smoothing means more lag. An n-period SMA lags by roughly n/2 bars; no parameter choice removes that cost — it only moves it around.

How to read the chart — Thin line: price. Gold line: the EMA 20, riding the trend and touched by pullbacks. Teal line: the SMA 50, slower, defining the context. Interactive — hover (or tap) the highlighted points: the pullback to the EMA, the role of the SMA 50, structural lag.

INDICATOR · TREND EMA 20 and SMA 50 — two speeds, two roles The fast one rides the trend, the slow one sets the context CYCLEPEDIA DIAGRAM — EMICICLO PRICE · EMA 20 · SMA 50 105 113 121 123 SMA 50 EMA 20 SMA 50 pullback NOISE FILTERED · EMA 20 89% NOISE FILTERED · SMA 50 96% A moving average filters noise: you choose a trade-off, not perfection
EMA 20 and SMA 50 on the same series: the fast one follows, the slow one filters. Lag is the price of smoothness.
Hover or tap the highlighted points

How it is calculated

SMA (Simple Moving Average) — the arithmetic mean of the last n closes:

SMA(5) on closes 100, 102, 101, 104, 103 → (100+102+101+104+103) / 5 = 102

On the next bar the window slides: the new close enters, the oldest drops out.

EMA (Exponential Moving Average) — weights recent bars more heavily, with exponentially decaying weights:

EMA(today) = α · Close(today) + (1 − α) · EMA(yesterday), with α = 2/(n+1)

With n = 20, α ≈ 0.095: each new bar carries about 9.5% of the updated value. The practical result: at equal periods the EMA turns earlier at reversals and trembles more in noise. Neither is "better": they are two settings of the same trade-off. Common conventions: EMA on short windows (9, 12, 21), SMA on long ones (50, 100, 200).


Reading it in practice

  1. Regime filter — price above the SMA 200: a context for hunting longs; below it: a defensive context. It is not an entry signal — it answers "what market am I in?", the question that comes before every other.
  2. Dynamic support and resistance — in orderly trends price stretches away from the average and returns to it; the touch of the EMA 20/50 is among the most watched spots in trading. Treat it as an attention zone, to be confirmed by the price reaction.
  3. Building block for other tools — the MACD is the distance between two EMAs; Bollinger Bands are an SMA with standard-deviation margins; the Supertrend is an ATR band with average-like logic. Understand the moving average well and the rest of the catalogue reads itself.

In the cyclic analysis tradition the average is also used centred: shifted back by half its window it stops lagging and becomes a dissection tool for the waves that make up price.


Limits and traps

Warning — crossovers in sideways markets. "Buy when the fast average crosses the slow one" only works where an underlying direction exists. In a sideways market the averages keep intertwining and crossovers produce serial false signals (whipsaw): you buy high and sell low, several times in a row. Before trading a crossover, verify that a trend exists — that is the job of the ADX.

  • Lag cannot be removed, only chosen. "Magic" parameters found in hindsight are almost always overfitting.
  • The average is computed on closes: intrabar events (spikes, wicks) pass straight through it without leaving a trace.