A moving average is the average closing price over a fixed number of recent sessions, recalculated every day so that it moves with the chart. It smooths out day-to-day noise and shows the direction and strength of the trend, at the cost of reacting late.
How it works
The two common types differ only in how they weight the data:
- Simple moving average (SMA): the sum of the last n closes divided by n. Every day in the window counts equally, and the oldest close drops out as a new one is added.
- Exponential moving average (EMA): EMA today = EMA yesterday + α × (close today − EMA yesterday), with α = 2 ÷ (n + 1). For a 20-day EMA, α is about 0.095, so the latest close carries roughly 9.5% of the weight and older closes fade gradually rather than dropping out. The calculation is usually seeded with the SMA of the first n closes.
Because the EMA weights recent prices more, it turns sooner than an SMA of the same length. Both lag: an SMA's centre of gravity sits about (n − 1) ÷ 2 sessions in the past, so a 50-day SMA describes where the stock was roughly a month ago.
Traders use a handful of standard lengths. The 10- and 20-day averages (often the 21-day EMA) track the short-term trend; the 50-day tracks the intermediate trend; the 200-day is the most widely watched measure of the long-term trend, for single stocks and for indexes alike.
How to read it
- Slope first. A rising average describes an uptrend, a falling one a downtrend, and a flat one a range. The slope matters more than whether price sits a few cents above or below the line.
- Stacking order. Price above the 50-day, and the 50-day above the 200-day, is the classic description of a healthy uptrend. The reverse order describes a downtrend.
- Dynamic support and resistance. In a trend, pullbacks often pause near a widely followed average, because many traders watch the same line; see support and resistance.
- Crossovers. A faster average crossing a slower one marks a change in trend. A 50-day crossing above the 200-day is called a golden cross; a cross below is a death cross. By the time either happens, much of the move has usually occurred.
- Distance from the average. A stock far above its 20-day average is extended: the trend is strong, but the risk of a pullback is higher. Momentum oscillators such as the RSI measure the same stretch another way.
Worked example (illustrative numbers)
Five closes: $100, $102, $101, $104 and $103. The 5-day SMA is $510 ÷ 5 = $102.00. When the next close of $108 arrives, the $100 drops out and the SMA becomes ($102 + $101 + $104 + $103 + $108) ÷ 5 = $103.60.
For an EMA, suppose a stock's 20-day EMA stands at $50.00 and today it closes at $52.10. With α = 2 ÷ 21, the new EMA is $50.00 + (2 ÷ 21) × $2.10 = $50.20. The average moves only a fifth of a dollar on a $2.10 jump, which is the smoothing at work.
A trend read on a hypothetical stock might look like this:
| Reading | Value | Interpretation |
|---|---|---|
| Close | $84 | Above both averages |
| 50-day SMA | $78, rising | Intermediate trend up |
| 200-day SMA | $70, rising | Long-term trend up |
| Distance from the 20-day EMA | +3% | Not extended |
The averages describe the trend; they do not say whether the next session will be up or down.
Limitations and common mistakes
- Lag. Every average is late by construction. Shorter lengths react faster but give more false signals.
- Whipsaws in ranges. In a sideways market, price crosses its averages repeatedly, and crossover systems pile up small losses.
- No correct length. Testing dozens of lengths and keeping the one that worked best on past data is over-fitting; see backtesting.
- Data differences. Results vary slightly with the seed, the amount of history and whether prices are adjusted for splits, so two charting tools can show different values.
- Treating a line as a wall. An average is a reference that many traders watch, not a price where a turn is assured.
In Clear Tape
In Clear Tape's trading systems, you can build your own rules from SMAs and EMAs of any length from 2 to 252 sessions, compare them with price or with each other, and use crossovers as entry or exit conditions; one starting template is a pullback to the 20-day EMA in an uptrend. EMAs are seeded with the SMA of their first n values, as in TradingView's built-in indicators. Several presets rely on averages: the Leader Trend Filter checks the 50-, 150- and 200-day SMAs, the Trend Pullback buys dips to the 21-day EMA, and the 10/20 EMA Cross trades crossovers only above the 200-day SMA. The screener has an uptrend rule (price above the 50-day average, the 50-day above the 200-day), the market breadth card shows the share of stocks above their 50- and 200-day averages, and the market stance turns Defensive when SPY closes below its 200-day average. Building systems is free; watchlist screening, backtests, the screener, breadth and the market stance are available to Tools and Pro members.
For educational purposes only. Not investment advice.