Moving averages: simple (SMA) and exponential (EMA)
A moving average is the average closing price over a fixed number of recent periods, recalculated every period so it “moves” along the chart. It smooths out day-to-day noise and shows the direction of the trend. The two most common kinds are the simple moving average (SMA), which weights every close equally, and the exponential moving average (EMA), which gives recent closes more weight so it turns sooner.
Moving averages are the building blocks of many other indicators on this site: MACD is the gap between two EMAs, Bollinger Bands are drawn around a 20-period SMA, and the Hull and volume-weighted averages are variations on them.
At a glance
| Simple moving average (SMA) | Exponential moving average (EMA) | |
|---|---|---|
| What it averages | The last n closes, equally weighted | All past closes, with weights that shrink the older they are |
| Reacts to a new price | Only through what enters and leaves the window | Immediately, in proportion to the gap between price and the average |
| Common lengths | 20, 50, 100, 200 days | 9, 12, 20, 26, 50 days |
| In TradingView’s rating | Lengths 10, 20, 30, 50, 100 and 200 | Lengths 10, 20, 30, 50, 100 and 200 |
How they’re calculated
Simple moving average. Add the last n closes and divide by n:
SMA(n) = (close₁ + close₂ + … + closeₙ) ÷ n
Each new period, the oldest close drops out of the window and the newest comes in, so the SMA changes by exactly (new close − dropped close) ÷ n.
Exponential moving average. Start from yesterday’s EMA and move it a fixed fraction k of the way toward today’s close:
k = 2 ÷ (n + 1)
EMA today = close × k + EMA yesterday × (1 − k)
For a 10-period EMA, k = 2 ÷ 11 = 0.1818, so each new close pulls the average 18.18% of the way toward it. A close’s influence never disappears entirely; it fades by a factor of (1 − k) each period.
The EMA needs a starting value. This page’s example uses the first 10-day SMA, a common convention. Platforms differ in how they start the EMA, which only affects the first few dozen values.
Worked example: a 10-day SMA and EMA
A hypothetical stock closes at these prices over ten days:
| Day | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
|---|---|---|---|---|---|---|---|---|---|---|
| Close | 50.00 | 50.40 | 50.10 | 50.90 | 51.30 | 51.00 | 51.80 | 52.20 | 51.90 | 52.60 |
The ten closes add up to 512.20, so the 10-day SMA on day 10 is 51.22. The example uses that as the starting EMA too.
Now three more days arrive. Each row shows how both averages update:
| Day | Close | Close dropped from the SMA | 10-day SMA | 10-day EMA |
|---|---|---|---|---|
| 10 | 52.60 | 51.220 | 51.220 | |
| 11 | 53.10 | 50.00 (day 1) | 51.530 | 51.562 |
| 12 | 52.80 | 50.40 (day 2) | 51.770 | 51.787 |
| 13 | 53.50 | 50.10 (day 3) | 52.110 | 52.098 |
Day 11 worked through:
- SMA: 51.22 + (53.10 − 50.00) ÷ 10 = 51.22 + 0.31 = 51.53.
- EMA: 53.10 × 0.1818 + 51.22 × 0.8182 = 9.654 + 41.908 = 51.562. Put another way, the EMA moved 18.18% of the 1.88 gap between the close and the old EMA.
Two things stand out. On day 13 the SMA rose 0.34, partly because a low close (50.10) left the window: the SMA can move simply because an old price drops out, which traders call the drop-off effect. The EMA has no window, so it only moves because of the new close. In a steady trend like this one the two stay close; after a sudden jump, the EMA reacts more in the first few days.
How traders read moving averages
- Price above or below the average. A close above a rising average is usually read as an uptrend, and a close below a falling one as a downtrend. This is exactly how TradingView’s rating scores each average.
- Slope. A flat average means no clear trend, whatever side the price is on.
- Crossovers between two averages. When a shorter average crosses above a longer one, traders call it a bullish crossover; the 50-day SMA crossing above the 200-day SMA is widely called a “golden cross”, and crossing below it a “death cross”.
- Support and resistance. Prices often pause near widely watched averages such as the 50- and 200-day, partly because so many traders watch them.
- Length sets the trend you’re watching. A 20-day average tracks the past month’s trend; a 200-day average tracks roughly the past year’s, since a year has about 252 trading days.
How TradingView’s rating uses them
TradingView’s moving-average rating counts 12 simple and exponential averages, with lengths 10, 20, 30, 50, 100 and 200, alongside the Hull and volume-weighted averages and the Ichimoku Cloud. For every average the rule is the same:
| Reading | Condition |
|---|---|
| Buy (+1) | The average is below the price |
| Sell (−1) | The average is above the price |
| Neutral (0) | The average equals the price |
On day 13 above, with the close at 53.50, both 10-day averages (52.11 and 52.098) are below the price, so each would score Buy. The rule only looks at which side of the average the price is on, not at the average’s slope or at crossovers.
Settings and variations
- Length. Shorter averages hug the price and turn sooner but give more false turns; longer ones are smoother and later.
- Source. Averages are usually of the close, though some traders average the typical price ((high + low + close) ÷ 3).
- Other types. The weighted moving average (WMA) gives linearly larger weights to recent closes; the Hull average combines WMAs to cut lag; the VWMA weights by volume.
Limitations
- Moving averages lag. They are made from past prices, so they confirm a trend after it starts and turn after it ends.
- Sideways markets cause whipsaws. When prices swing around a flat average, the price crosses it back and forth and each cross flips the reading.
- The same rule scores very different things. Under TradingView’s rule, a price one cent above the 200-day average counts as fully Buy, the same as a price 30% above it.
See it on a live chart
This market's chart has one value per day, with no daily high or low, so it draws as a line and these indicators, which need highs and lows, aren't shown on it.
The 20-day EMA, 50-day SMA and 200-day SMA on daily candles. The legend at the top left shows each average's latest value; hover over or tap the chart to read any earlier day.
For TradingView's current rating of any market, with this indicator among the 26, see the market analysis page or the technical signals for all markets.
Sources
- TradingView, Simple Moving Average, read Nov. 30, 2026
- TradingView, Exponential Moving Average, read Nov. 30, 2026
- TradingView, Technical Ratings, read Nov. 30, 2026
This page explains how an indicator is calculated and how traders commonly read it. The worked examples use hypothetical prices. Nothing here is a recommendation to buy or sell any investment. This content is for informational purposes only and does not constitute financial advice. Consult a qualified financial advisor before making investment or financial decisions.