Glossary
EMA (Exponential Moving Average): Formula and Use
An exponential moving average (EMA) is a moving average that gives more weight to recent prices, so it reacts faster than a simple moving average. Traders use EMAs such as 9, 20, 50 and 200 to judge trend and momentum. On TradingLead, add 'Moving Average Exponential' or the 'EMA 20/50/100/200 Multiple' study from the Indicators dialog, or use ta.ema in Pine.
Definition
An exponential moving average (EMA) is a type of moving average in which recent candles count more than older ones. Every past price still contributes, but its influence shrinks exponentially with age. As a result, an EMA follows price more closely than a simple moving average of the same length.
Formula
First compute the smoothing factor:
α = 2 ÷ (N + 1), where N is the EMA length.
Then on every new candle:
EMA_today = α × Close_today + (1 − α) × EMA_yesterday
Example for a 9-period EMA: α = 2 ÷ 10 = 0.2. If yesterday's EMA was 100 and today's close is 105, today's EMA = 0.2 × 105 + 0.8 × 100 = 101.
The very first EMA value needs a starting point. Some platforms seed it with an SMA; TradingLead's TLScript-Pine ta.ema seeds from the first valid sample. Early values can therefore differ slightly between platforms, then converge.
How traders read it
- Trend filter: price above a rising 50 or 200 EMA is often treated as an uptrend; below a falling one as a downtrend.
- Crossovers: a fast EMA (for example 9 or 20) crossing a slow EMA (50) is a common momentum signal.
- Pullback zones: in strong trends on Nifty or large-cap stocks, traders watch the 20 EMA as a possible pullback area.
- Building block: MACD is built from the difference between two EMAs.
Common settings
- 9 / 20 — short-term and intraday momentum.
- 50 — medium-term trend.
- 100 / 200 — long-term trend on daily charts.
Pitfalls
- Faster reaction also means more false turns in choppy markets.
- EMA crossovers still lag — by the time they confirm, a large part of the move may be over.
- Values depend on how much history is loaded; very short histories give less stable early EMAs.
- Never use one EMA rule alone as a trading decision; test it first.
How to add an EMA on TradingLead
- Open a chart at tradinglead.in/charts.
- Click Indicators and search Moving Average Exponential, then set the length.
- For four EMAs at once, add EMA 20/50/100/200 Multiple and change any length in its settings.
To build your own in Indicator Studio (documented Pine v5/v6 subset, validated before execution):
//@version=6
indicator("EMA pair", overlay=true)
plot(ta.ema(close, input.int(20, "Fast")), "Fast EMA", color=color.teal)
plot(ta.ema(close, input.int(50, "Slow")), "Slow EMA", color=color.red)
In Python, df["close"].ewm(span=20, adjust=False).mean() gives a similar EMA — see Write a Python indicator.
Educational content only — not investment advice.
Frequently asked questions
- Why do traders prefer EMA over SMA?
- Because the EMA weights recent candles more, it turns sooner when price changes direction. The trade-off is more sensitivity to short-lived noise.
- Does TradingLead have a multiple-EMA indicator?
- Yes. 'EMA 20/50/100/200 Multiple' plots four EMAs in one study, and each length can be changed in its settings.
- How does TradingLead's Pine ta.ema start its calculation?
- In TLScript-Pine, ta.ema seeds from the first valid source value, skips unavailable samples and rejects lengths of zero or less. Early values can differ slightly from other platforms that seed with an SMA.
Related
Last updated: