Moving Average Calculator

A moving average smooths a series by averaging the most recent k values. The simple average weights them equally; the exponential and weighted versions lean towards the latest values.

Also called: Rolling average calculator · SMA calculator · EMA calculator

  • Last updated
  • Formula tested against reference values

Your numbers

Separate with commas, spaces or new lines.

Result

Latest simple moving average
—

Calculating…

Latest exponential moving average
—
Latest weighted moving average
—
EMA smoothing factor α
—
Averages calculated
—
Full table

How to use this calculator

  1. Enter or choose series (oldest first).
  2. Enter or choose window (k).
  3. 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

  1. Latest SMA = (6 + 8 + 12) ÷ 3 = 8.6667.
  2. α = 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.
  3. 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.