Concept

EMA

EMA is a Trend concept. The Library holds 23 implementations, each one a working definition you can pull into Quant.

Top EMA indicators

23 total

What is an EMA?

An EMA (exponential moving average) is a weighted average of price in which the weights decay exponentially with age: the newest bar counts most, and each older bar counts a fixed fraction less. In its recursive form, each new EMA value equals a smoothing factor alpha times the current price, plus (1 minus alpha) times the previous EMA value. Charting convention sets alpha to 2 divided by (length + 1), so a 20-period EMA uses an alpha of roughly 0.095.

The exponential weighting is what separates it from an SMA, which weights every bar in its window equally and drops the oldest bar entirely. An EMA never fully drops anything: old data fades smoothly rather than falling off a cliff, and the stated length is really a convention for choosing alpha, not a hard window. The result is a smoother roll and a faster response to new prices at the same nominal length. Exponential smoothing was not invented for markets; it came out of 1950s forecasting and inventory research before technical analysts adopted it.

The EMA matters because it is the workhorse smoother of technical analysis. It defines trend direction and dynamic support in countless templates, and it sits inside other indicators: MACD is the difference between two EMAs, and many oscillator signal lines are EMAs of the oscillator. Its lag-versus-smoothness tradeoff also spawned a whole lineage of successors, from DEMA and TEMA to adaptive designs like KAMA.

How to calculate an EMA

The EMA is a one-line recursion; the only real decisions are the length and the seed:

  1. 1Choose a length N and convert it to the smoothing factor: alpha = 2 / (N + 1). A 9-period EMA uses alpha of 0.2; a 200-period EMA uses roughly 0.01.
  2. 2Seed the series. Most platforms start the EMA at the first available price or at the simple average of the first N bars; the choice only affects early values, because the seed's influence decays exponentially.
  3. 3Update recursively on every bar: the new EMA equals alpha times the current close plus (1 minus alpha) times the prior EMA.
  4. 4Read it like any moving average: slope for direction, price's position above or below the line for bias, and distance from the line for stretch.

How traders use it

  • As a trend filter: price holding above a rising EMA frames a long bias, price below a falling one frames a short bias. The 9, 20/21, and 50 lengths are common intraday and swing choices, with the 200 serving as the classic long-horizon reference.
  • As dynamic support and resistance: trending markets often pull back to a widely watched EMA and react there, the behavior covered under dynamic S/R via MA. The line is a zone of interest, not a guarantee.
  • In crossover systems: a fast EMA crossing a slow one is the standard trend-change trigger, formalized in moving average crossovers and extended into an MA ribbon when many lengths are plotted at once.
  • As a building block: EMAs smooth other series as often as they smooth price. MACD, signal lines, and smoothed oscillators all reuse the same recursion, and Wilder's indicators run on the closely related RMA.

EMA vs similar moving averages

SMA: Equal weights across a fixed window versus exponentially decaying weights. The SMA drops its oldest bar abruptly, which can kink the line when a large bar exits the window; the EMA fades old data smoothly and turns faster at the same stated length.

WMA: Both front-weight recent prices, but the WMA's weights decline linearly toward zero across a hard window, while the EMA's decline geometrically and never quite reach zero. The WMA is fully window-bound; the EMA carries a long, fading memory.

RMA: Wilder's smoothing is the same recursion with alpha = 1/N instead of 2/(N+1), so it is heavier and slower at the same stated length. RSI and ATR are built on it, which is why they feel smoother than an EMA-based equivalent of the same period.

DEMA: The DEMA combines an EMA with an EMA of that EMA to cancel lag rather than merely shorten it. It hugs price more tightly in trends but overshoots more at turns; the plain EMA is the more conservative default.

More EMA implementations

Related concepts · Moving-average lineage

Concept family

Trend

100 concepts mapped · 88 in the Library

EMA FAQ

What is the difference between EMA and SMA?

Weighting. An SMA averages the last N closes equally; an EMA weights recent closes more and older ones exponentially less, so it turns sooner and tracks price more closely at the same length. Neither is universally better: the EMA reacts faster but also whipsaws faster, while the SMA filters more noise at the cost of extra lag.

What are the most common EMA lengths?

The 9, 12, 20/21, 26, 50, 100, and 200 appear most often. The 12 and 26 come from MACD's standard settings, 9 and 21 are popular for short-term work, and the 50 and 200 anchor swing and position timeframes. Popularity, not superiority, keeps them in use: a widely watched length simply attracts more reactions around it.

Why does an EMA react faster than an SMA of the same length?

Because the newest bar carries the largest single weight, 2/(N+1), whereas in an SMA it carries only 1/N and the average also has to wait for old bars to leave the window. The EMA starts turning on the first bar of new information; the SMA turns only as the window's contents gradually change.

Does an EMA use data outside its stated length?

Yes. The length only sets the decay rate; every prior bar still contributes a shrinking amount. This is why two platforms can print slightly different EMA values when their loaded history or seeding method differs. In practice the influence of bars beyond a few multiples of the length is negligible.

Is a rising EMA a buy signal?

Not by itself. A rising EMA says average price has been improving, which is context rather than a trigger. Most systems pair EMA slope or position with a separate entry condition, such as a crossover, a pullback that holds the line, or a momentum confirmation, plus a defined invalidation level. A rising average does not prevent an immediate reversal.

Build EMA your way.

Quant writes, tests, and refines it with you — then it runs on LuxAlgo charting or ports to TradingView.