SMA vs EMA on the same price chart
SMA averages the last n closes with equal weights. EMA updates its previous value using EMA = previous EMA + 2/(n+1) × (close − previous EMA). A new close contributes more immediately to the EMA. Its influence then decays at each step.
Loading candle history…
Check a four-candle example
Take closes 10, 10, 10, 16 and use period 3. Both lines begin at 10 on the third candle if the EMA starts with those three closes’ mean. On the fourth candle SMA is 12. The EMA adds half of the 6-unit move from its previous value and reads 13.
Set the chart to period 20 and hover over a sharp move and a sideways interval. Compare the difference at the same date. Then move to 50 and repeat. A long quiet interval can leave the lines close together, while a large recent move changes the weighting effect.
When checking another implementation, record the input field, EMA initialization and first reported timestamp. A first-price EMA and an SMA-seeded EMA can disagree near the start even if both use the same multiplier. Exponential moving average reference
Compare with the two EMA periods used in MACD.