How to use this calculator
- Enter or choose series (oldest first).
- Enter or choose window (k).
- The latest simple moving average updates as you type. Use Copy result or Share to keep it.
Method
SMA = (x₁ + … + x_k) ÷ k; EMA_t = α·x_t + (1 − α)·EMA_{t−1}, α = 2 ÷ (k + 1), first EMA = first SMA; WMA = Σ j·x_j ÷ (k(k + 1)/2), newest weight k
- k
- window length
- x
- values in the window
- α
- EMA smoothing factor
Worked example
- Latest SMA = (6 + 8 + 12) ÷ 3 = 8.6667.
- α = 2 ÷ (3 + 1) = 0.5. EMA starts at the first SMA, 4; then 0.5 × 8 + 0.5 × 4 = 6; then 0.5 × 12 + 0.5 × 6 = 9.
- WMA = (1 × 6 + 2 × 8 + 3 × 12) ÷ 6 = 9.6667.
With a 3-period window the latest SMA is 8.67, the EMA 9 and the WMA 9.67.
What the result means
Moving averages lag the data. The SMA lags most; the EMA and WMA react faster to the latest change. A longer window smooths more but lags more.
Assumptions and limits
- Values are equally spaced in time and listed oldest first.
- The EMA is seeded with the simple average of the first k values, the usual convention.
- EMA values for the first few periods depend on the seeding method, so they can differ slightly from charting software that seeds differently.
Questions
Why does my EMA differ from my trading platform?
Platforms differ in how they start the EMA (first value or first SMA) and how much history they load. After about 3k periods the difference becomes negligible.
Should I use a centred moving average?
For smoothing historical data, a centred average avoids lag. For forecasting or live signals, use a trailing average like this one, which only uses past values.