A moving average smooths out short-term ups and downs so the underlying direction of a series is easier to see. It is used for sales and demand figures, website traffic, temperatures, quality-control readings and stock prices. Paste a series in time order, choose the type and period, and the calculator returns every average, the latest value, a chart of the data with the smoothed line, and the error you would have made using each average as a forecast for the next period.
How to use the moving average calculator
- Paste the data in time order, oldest first.
- Pick Simple (SMA), Exponential (EMA) or Weighted (WMA).
- Set the period N, the number of values in each average. For an EMA you can also override the smoothing factor α.
- Read the latest average on the tape. The table lists the average at each period, the forecast it implies for the following period and the resulting error.
Moving average formulas
The EMA starts from the SMA of the first N values. The forecast for period t + 1 is the average through period t; forecast accuracy is summarized by the mean absolute error (MAE) and root mean squared error (RMSE).
Worked example
A shop’s weekly orders for 12 weeks are 112, 118, 115, 121, 127, 124, 130, 136, 131, 138, 142, 139.
3-week SMA. The first average is (112 + 118 + 115) ÷ 3 = 115 in week 3. The next is (118 + 115 + 121) ÷ 3 = 118, and the last is (138 + 142 + 139) ÷ 3 = 139.67. That becomes the naive forecast for week 13.
3-week EMA. α = 2 ÷ 4 = 0.5. Starting from 115 in week 3, week 4 is 0.5 × 121 + 0.5 × 115 = 118, week 5 is 0.5 × 127 + 0.5 × 118 = 122.5, and by week 12 the EMA is 138.64.
3-week WMA. Weights 1, 2 and 3 sum to 6, so the latest value is (1 × 138 + 2 × 142 + 3 × 139) ÷ 6 = 139.83.
Which forecasts best? Over weeks 4 through 12, the forecast MAE is 5.41 orders for the SMA, 5.32 for the EMA and 4.70 for the WMA. The orders are trending upward, so every method lags behind; the WMA lags least because it leans hardest on the newest week. Almost every error is positive, which is the signature of lag on a rising series.
Choosing a method
Lag and responsiveness
A simple moving average of period N trails the data by about (N − 1) ÷ 2 periods. Weighted and exponential versions shorten the lag by emphasizing recent values, at the cost of passing through more noise. If turning points matter (spotting a slowdown quickly), prefer an EMA; if steadiness matters, a longer SMA.
Seasonal data
To strip out a repeating cycle, use a period equal to the cycle length, such as 12 for monthly data with a yearly pattern. The average then contains exactly one of each season and reveals the trend.
Beyond smoothing
Moving averages describe the past; they do not model trend. For a series with a steady upward or downward drift, fit a line with the linear regression calculator using the period number as x. For averages where you choose the weights yourself, use the weighted average calculator.
Frequently asked questions
What is the difference between SMA, EMA and WMA?
A simple moving average weights the last N values equally. A weighted moving average gives linearly increasing weights, so the newest value counts N times as much as the oldest in the window. An exponential moving average gives every past value some weight, shrinking by a constant factor each period, so it reacts fastest to recent changes.
How do I choose the period?
Shorter periods follow the data closely but keep more noise; longer periods are smoother but lag behind turning points. Match the period to the cycle you want to remove: 7 for daily data with a weekly pattern, 12 for monthly data with a yearly pattern. Comparing forecast errors for several periods is a practical tiebreaker.
Why does the EMA start at period N?
An EMA needs a starting value. This calculator follows the usual charting convention: the first EMA is the simple average of the first N values, and the recursive formula takes over from there. Some software starts from the first data value instead, which gives slightly different early values that converge over time.
Can a moving average predict the future?
Only naively. Using the latest average as next period's forecast works for a series that wanders around a stable level. For a trending series a moving average always lags behind, as the forecast errors in the example show; a trend line or a method designed for trends will do better.
What smoothing factor does the EMA use?
By default α = 2 ÷ (N + 1), so a 3-period EMA uses 0.5 and a 9-period EMA uses 0.2. You can enter your own α between 0 and 1; larger values react faster.