What a moving average does
Q01 What is a moving average?
A moving average converts a price series into a smoother reference series. A common input is the close, but other inputs are possible. State the input, number of periods and chart interval: a 20-period average on a weekly chart differs from a 20-day average.
Q02 What is a simple moving average?
An n-period SMA gives each of the latest n observations weight 1/n. On the next observation, the oldest value leaves the window and the newest enters.
Q03 Why does the SMA change when an old price drops out?
The five closes 100, 102, 101, 105 and 107 sum to 515, so SMA(5) = 103.00. The next close is 106. Drop 100 and add 106: the sum becomes 521 and SMA = 104.20. The change is (106 − 100) ÷ 5 = 1.20.
The SMA’s update depends on the entering and leaving prices. A change in its slope need not mean the latest price alone changed sharply.
The EMA formula and starting value
Q04 What is an exponential moving average?
An EMA updates its previous value using the new price and a smoothing coefficient. Under a common convention, α = 2/(n + 1). The recursive weighting declines geometrically as observations age.
Equivalent: EMAₜ = EMAₜ₋₁ + α(Pₜ − EMAₜ₋₁)
Q05 How should the first EMA be seeded?
This lesson seeds the first EMA with the average of the first n closes, on observation n. Later values use the recurrence. Some software starts from the first price or uses an adjusted weighting method. Those choices can produce different early values, so document the seed and warm-up history when comparing outputs.
Q06 Can you show an EMA update?
Day-5 EMA = 103.00 and day-6 close = 106.00. EMA₆ = 103 + (1/3)(106 − 103) = 104.00. Day-7 close is 110, so EMA₇ = 104 + (1/3)(110 − 104) = 106.00. Keep full precision and round only the displayed result.
Q07 How do SMA and EMA compare?
| Feature | SMA | EMA |
|---|---|---|
| Recent-price weight | 1/n inside the rolling window | α under the specified recurrence |
| Older observations | Drop out after n periods | Persist with declining weight through the recurrence |
| Starting value | First full-window arithmetic mean | A stated seed, here the first n-price SMA |
| Response | Sensitive to both the new and departing price | Generally more responsive to new prices for the same n |
| Main limitation | Lag and possible whipsaws | Lag, seed sensitivity and possible whipsaws |
Neither average must always lie closer to the latest close or turn first on every possible path. The EMA’s faster typical response is a weighting property, not a universal ranking of every observation.
Ten-day worked calculation
Q08 What are the SMA and EMA for the same prices?
| Day | Close | SMA(5) | EMA(5) |
|---|---|---|---|
| 1 | 100.00 | — | — |
| 2 | 102.00 | — | — |
| 3 | 101.00 | — | — |
| 4 | 105.00 | — | — |
| 5 | 107.00 | 103.00 | 103.00 |
| 6 | 106.00 | 104.20 | 104.00 |
| 7 | 110.00 | 105.80 | 106.00 |
| 8 | 108.00 | 107.20 | 106.67 |
| 9 | 112.00 | 108.60 | 108.44 |
| 10 | 115.00 | 110.20 | 110.63 |
Q09 How do I reproduce this in Excel?
C6: =AVERAGE(B2:B6) · first SMA
C7: =AVERAGE(B3:B7) · roll and fill down
D6: =AVERAGE(B2:B6) · EMA seed
F2: =2/(5+1) · smoothing coefficient
D7: =$F$2*B7+(1-$F$2)*D6 · fill down
The row-6 result corresponds to observation 5 because row 1 is a header. Store outputs as formulas if students will edit the prices; cached values alone will not recalculate.
Q10 Can I calculate SMA and EMA from my own sample?
2–100 periods and up to 200 positive prices. EMA seed is the first n-price SMA. No forecasts or trade instructions are generated.
Slope, crossovers and market regimes
Q11 How should price and average slope be read?
A close above a rising average describes a different state from a close above a falling average. Use both location and slope alongside the wider chart. Being above the 200-day average alone does not formally establish a bull market, and a close below it does not mechanically establish a primary reversal.
Q12 What is a price crossover?
A bullish price crossover occurs when price moves from at/below the selected average to above it. A bearish crossover reverses that relation. Compare consecutive observations; “price is above the average” describes a state, not necessarily a new crossing event.
Q13 What are a golden cross and a death cross?
A commonly taught golden cross occurs when the 50-day SMA crosses above the 200-day SMA. A death cross is the reverse. Specify whether SMA or EMA is used. These are delayed trend signals, and a strategy must define execution, position size and exit rules separately.
Fastₜ > Slowₜ AND Fastₜ₋₁ ≤ Slowₜ₋₁
Bearish crossing at t:
Fastₜ < Slowₜ AND Fastₜ₋₁ ≥ Slowₜ₋₁
Q14 How is a crossover different from a regime?
If SMA50 first rises above SMA200 on Monday, Monday contains the crossing event. If it remains above on Tuesday and Wednesday, those dates remain in the above-average regime; they are not two more golden crosses.
In a daily-close backtest, a signal using the final close becomes known at that close. Model an achievable execution time rather than silently assuming an earlier fill.
Q15 Can moving averages act as support or resistance?
Traders sometimes watch pullbacks near a rising average or rallies toward a falling average. These are dynamic reference areas that can fail. The selected period should follow an explicit method rather than be chosen after observing which line price respected.
Whipsaws and fair testing
Q16 What is a whipsaw?
A whipsaw is a signal that reverses quickly, such as price crossing above a moving average and soon falling back below. Sideways fluctuations can generate repeated crossings and costs. A shorter period typically follows prices more closely but can produce more frequent signals.
Q17 Which periods should I choose?
| Lookback | Common chart reference | Caution |
|---|---|---|
| 10 or 20 sessions | Shorter-term movement | Not the same as 10 or 20 calendar days. |
| 50 sessions | Intermediate reference | Roughly a few trading months, not exactly a quarter. |
| 200 sessions | Longer-term reference | Less than a full trading year in many markets. |
Match the period to a stated purpose, then test stability over multiple periods and market conditions. A single best historical parameter can reflect overfitting.
Q18 What should a fair comparison report?
Use identical data, corporate-action treatment, starting dates and execution assumptions. Include the warm-up period, turnover, fees, slippage, drawdowns and a relevant benchmark. Separate parameter development from out-of-sample evaluation and distinguish missing observations from genuine trading sessions.
Q19 Practice: can an EMA be lower than the SMA?
At day 6 in the example, SMA(5) is 104.20 and EMA(5) is 104.00. Is this an error?
No. The SMA includes the latest five closes equally; the EMA retains declining weights and a seed. Their positions depend on the entire path. Greater recent-price sensitivity does not require EMA to be above SMA.
Sources and teaching notes
Based on Prof. V. Ravichandran’s Session 9 slides, especially slides 54–66, and the Technical Analysis Session 9 workbook’s sample and Nifty moving-average sheets. The ten-day example follows the slides; it uses hypothetical prices.
- Fidelity: Exponential Moving Average — weighting, recurrence and seeding.
- Schwab: Chart overlays — moving-average inputs.
No live market data is used here. Educational material; moving-average signals can fail and incur trading costs.