Moving Average Calculator (SMA & EMA)
Compute Simple Moving Average (SMA) and Exponential Moving Average (EMA) from your time series. Paste prices, sales, or any numeric series (oldest to newest), choose the period, and the tool will show the latest averages, a full table, and an inline chart.
e.g. 3, 5, 10
α = 2/(n+1)
Blue: original data; Orange: selected moving average. First 30 points shown.
Latest MA
—
Current price/value
—
Diff (value - MA)
—
Method
—
| t | Value | MA | Diff |
|---|
Formulas
Simple moving average (SMA):
\( \text{SMA}_t = \dfrac{X_t + X_{t-1} + \dots + X_{t-n+1}}{n} \)
Exponential moving average (EMA):
\( \alpha = \dfrac{2}{n+1} \quad\Rightarrow\quad \text{EMA}_t = \alpha X_t + (1 - \alpha)\text{EMA}_{t-1} \)
with initialization \( \text{EMA}_1 = X_1 \).
When to use SMA vs EMA
- SMA: easy to interpret, good for smoothing.
- EMA: reacts faster to recent moves (used a lot in trading, e.g. 12/26 EMA).
Common periods
Finance: 5, 10, 20, 50, 100, 200. Operations/time series: 3, 4, 6, 12 depending on seasonality.