What is EMA (Exponential Moving Average)?
Reviewed by Karthikeyan Anbarasan (Founder, TradeLyser) · Updated 19 Oct 2026 · Editorial policy
A simple moving average gives each of its N closes equal weight and drops the oldest close entirely when a new one arrives. An EMA never drops a close; each one’s weight shrinks a little with every new bar. The result is a line that turns sooner when price changes direction, at the cost of reacting more to noise.
How the EMA is calculated
- Choose the length N and work out the smoothing factor k = 2 ÷ (N + 1). For a 20-day EMA, k = 2 ÷ 21 = 0.0952.
- Seed the first value, usually with the simple average of the first N closes.
- For each new bar, take the gap between the close and the previous EMA and multiply it by k.
- Add that amount to the previous EMA. The EMA closes about 9.5% of the gap each day at N = 20.
| Day | Close | Gap to previous EMA | Gap × 0.0952 | 20-day EMA |
|---|---|---|---|---|
| Start | 24,800.00 | |||
| 1 | 25,010 | +210.00 | +20.00 | 24,820.00 |
| 2 | 25,115 | +295.00 | +28.10 | 24,848.10 |
| 3 | 24,890 | +41.90 | +3.99 | 24,852.09 |
| 4 | 24,760 | −92.09 | −8.77 | 24,843.32 |
| 5 | 24,980 | +136.68 | +13.02 | 24,856.33 |
Illustrative Nifty closes. Notice how little the EMA moves even when price swings 200 points: at k = 0.0952 each close shifts it by under a tenth of the gap. A 9-period EMA would shift by a fifth and a 200-period EMA by about one hundredth.
The same weights explain the trade-off traders feel. On day 1 above, a 9 EMA starting from 24,800 would have jumped to 24,842 (a fifth of the 210-point gap), while the 20 EMA moved to 24,820. The faster line gets you into a new move sooner and also pulls you into more moves that fade. There is no free setting; the right one is whichever your own tagged trades support.
How traders use it and log it
- Trend filter: longs only while price and a fast EMA (for example 20) are above a slow one (for example 50 or 200).
- Pullback entries: in a trending market, a pullback that holds near the 20 EMA is a common planned entry, with the stop beyond the swing low.
- Crossovers: a fast EMA crossing a slow one, such as 9 over 21 on intraday charts. MACD is itself built from the 12 and 26 EMAs.
- Trailing exits: hold while price closes above the EMA; exit on a close below it.
- Journal fields: EMA lengths and timeframe, whether price was above or below each EMA at entry, and the distance from the EMA in points. After 30 or more trades, compare expectancy above and below.
Limits and common mistakes
- It still lags. A faster reaction than an SMA is not a forecast; every EMA is built only from closes that have already happened.
- Ranges: in sideways markets a 9 or 20 EMA runs through the middle of price, and crossovers or "above/below" rules flip repeatedly.
- Live bar: the EMA on the current bar moves with every tick until the close. Signals taken mid-bar can disappear by the close, so define whether you act on closed bars.
- Stacking: plotting five EMAs makes it easy to find one that price respected after the fact. Choose the lengths before you look at the trade.
EMA vs SMA
EMA
SMA
Reference guide
| Context | Value | Reading |
|---|---|---|
| One EMA setting per strategy, written in the plan | Testable | Results can be compared across months because the rule did not change |
| EMA crossovers in a sideways market | Whipsaws | Fast EMAs cross back and forth in ranges; add a trend or volatility filter |
| Swapping EMA lengths after a few losses | Curve-fitting | Change settings only at a scheduled review with enough trades behind it |
Questions
How is EMA calculated?
EMA today = (close − previous EMA) × k + previous EMA, with k = 2 ÷ (N + 1). For a 20-period EMA, k is about 0.0952, so each close moves the EMA by under a tenth of the gap.
What is the difference between EMA and SMA?
An SMA weights all N closes equally; an EMA weights recent closes more. The EMA turns sooner but reacts more to noise.
Which EMA is best for intraday trading?
There is no single best length. 9, 20 and 21 are common on 5- and 15-minute charts. Choose one, keep it fixed per strategy and judge it on your own tagged trades with charges included.
What does the 200 EMA mean?
It is a slow average often used as a long-term trend line. Price above a rising 200 EMA is commonly read as a long-term uptrend; it is a filter for direction, not an entry signal.
Why does my EMA value differ from another platform?
EMAs depend on how much history is loaded and how the first value is seeded, so small differences between platforms are normal. Use one platform consistently.