Definition · Technical Analysis
Exponential Moving Average (EMA): Formula, Example and Uses
The exponential moving average follows price more closely than a simple average because each new close carries more weight. One multiplier, k, sets how much.
DefinitionSeen on: Chart
Exponential moving average A moving average that gives recent closing prices more weight than older ones, so it turns sooner than a simple moving average of the same length when price changes direction.
Also called EMA, exponentially weighted moving average.
Start with a 10-day EMA. The multiplier is k = 2 / (10 + 1), which is 2/11, or 0.1818. That is the share of each new close that enters the average. The rest of the average is yesterday’s value carried forward, and yesterday’s value already holds a fraction of the day before, which holds a fraction of the day before that, so every close the average has ever seen is still in there, shrinking a little each day.
The formula
EMA today = (close - EMA yesterday) x k + EMA yesterday, where k = 2 / (N + 1) and N is the number of periods.
Read it as a correction. Take the gap between today’s close and the old average. Move the average part of the way toward the close. A larger k means a bigger step. Shorter EMAs have larger k values, so they react faster. Each day an older close keeps the same fraction of its weight, 1 - k, so in a 10-day EMA a close from five trading days ago carries about 0.37 of the weight of today’s close, because 0.8182 multiplied by itself five times comes to roughly 0.37.
The close jumped $2.20. The average moved 40 cents. A simple 10-day average would move by the new close minus the close that dropped out of the window, divided by 10, which could be more or less than 40 cents depending on what fell off the far end. The EMA has no far end.
To try other lengths and prices, use the moving average calculator.
Where the first value comes from
An EMA needs a yesterday. On day one there isn’t one. The usual fix: seed it with the simple average of the first N closes. Then apply the formula from the next day on.
So early values depend on where the calculation began. Start the same 10-day EMA a month later and the numbers differ at first, then drift together as the seed’s influence fades, until after enough bars the difference is too small to see on a chart. Right after a listing, or on a platform that loads little history, it can be visible.
How it shows up on a chart
An EMA is a single line laid over the price bars, usually labeled with its length, such as “EMA 21”, and most charting platforms let you choose which price it is built from, with the close as the default. Traders often run two or three at once. A short one hugs price; a longer one describes the trend underneath.
The way price sits against the line is what people read. Price above a rising EMA is an uptrend in its simplest form. A close back under a flattening line is the first sign of fatigue. Plenty of traders use a short EMA as a trailing reference, holding while closes stay above it and selling the first close below. Those rules and their failures are in moving averages as a trend filter.
EMA against SMA
Faster is the whole difference. It turns sooner after a reversal. That gets you in or out earlier. The cost shows up in flat, choppy markets, where a fast line crosses back and forth through price every few days and each cross looks like a signal, so you pay for the early turns with a run of small losing trades that a slower average would have sat through.
A simple moving average gives every close in the window equal weight. It is steadier. It is also later.
What people get wrong
The most common mistake is treating the EMA’s length as a secret setting. A 20-day and a 21-day EMA are nearly the same line. Scan old charts for the best-fitting length and you mostly fit the past.
Another is comparing numbers across platforms and assuming one is broken. Different seed dates explain most small gaps.
Related terms
The MACD is built from two EMAs, the 12-period and the 26-period, and its signal line is a third EMA, taken over nine periods of their difference, which is why it lags even more than either average alone. The golden cross and death cross are crossovers of the 50-day and 200-day averages, which some charts draw as simple and others as exponential. For the wider set of chart tools, see the technical analysis topic.
Questions traders ask next
Which EMA periods do swing traders use most?
Short lengths such as 8, 10 and 21 days show up on a lot of swing charts, with 50 and 200 used for the longer trend. No length is correct for every stock. Choose one that matches your holding period, test it on past charts of the stocks you trade, and keep it fixed long enough to learn how it behaves.
Why does my EMA value differ from the one on another platform?
The two platforms probably started the calculation at different points or seeded it differently. An EMA carries a trace of every close since the first one, so two correct calculations with different starting dates disagree slightly. Loading more history before the date you care about shrinks the gap.