Math calculator

Moving Average Calculator

Four averages, and how many periods behind each one is.

Four averages, and how far each one lags

A perfect trend, where the lag is exactly (n − 1)/2 and the tool can measure it.

20 points, 5-period window

Latest simple average: 61.0000

It lags the series by exactly 2.00 periods — (n − 1)/2, always, on any trend.

Simple (SMA)

61.0000

lag 2.00

Exponential (EMA)

61.0027

lag 2.00, α = 0.3333

Weighted (WMA)

63.0000

lag 1.33 — (n − 1)/3

Centred

61.0000

lag 0, but 2 points short at each end

20406001020periodvalue

Points are the series. Solid is the 5-period average, dashed the 10-period one. Both sit to the right of where the series actually moved, by 2.0 and 4.5 periods.

Measured on your own data, the lag at the last point is 2.000 periods against a predicted 2.000. On a straight line those agree exactly, because an average of the last n values of a line equals the line’s value at the middle of that window — which is (n − 1)/2 periods ago. On real data they differ, because the series is not a line; the formula is what the average would do on a trend, and it is the right figure to quote.
The EMA’s α is 0.333333 = 2/(5 + 1), and its lag is 2.0000 — the same 2.0000 as the 5-period simple average. That is not a coincidence. An exponential average with smoothing factor α lags by (1 − α)/α periods, and 2/(n + 1) is precisely the α that makes that equal (n − 1)/2. The unexplained arithmetic in every EMA formula exists to make an n-period EMA comparable with an n-period SMA. The EMA still reacts faster to a sudden jump, because it weights the newest point most heavily rather than equally — the equal lag is about a steady trend, not about a shock.
The centred average has zero lag and no value for the last 2 periods. That is the whole trade, and it is the reason trailing averages exist at all: a centred window needs data from both sides of each point, so it can never reach the present. For understanding what has already happened — deseasonalising a series, finding the underlying trend — centred is simply better, and the missing end is not a cost. For anything that has to act on the latest value it is unusable.

What this tool shows

Every moving average reports where the series was, and the lag is exact. A trailing n-period simple average sits (n − 1)/2 periods behind a trend — measured, not approximated. And that number is why α = 2/(n + 1) is in every EMA formula: it makes the exponential average lag by exactly the same amount.

  • Simple, exponential, linearly weighted and centred averages on one series
  • The lag each one carries, with the formula and the value measured on your data
  • Why α = 2/(n + 1) is the convention — it equalises the lag with an n-period SMA
  • Crossovers between two windows, and how far behind the turn they must be
  • The centred average, which has no lag and no recent values
  • How many points each method leaves undefined, and at which end
Four methods Lag stated α explained Crossovers

(n − 1)/2 periods behind, exactly.

Updated 12 September 2026 · Works in any browser, no installation

A moving average replaces each point with an average of the points around it. That removes noise and it necessarily removes timeliness, because an average of the past reports the past — and the amount is not a matter of feel. It is (n − 1)/2 periods for a trailing simple average, exactly.

At a glance

Formula shown
A trailing simple moving average is the mean of the last n values; on a linear trend its value equals the series (n − 1)/2 periods ago. An exponential average is αxₜ + (1 − α)·previous, which lags by (1 − α)/α periods — equal to (n − 1)/2 exactly when α = 2/(n + 1). A linearly weighted average lags by (n − 1)/3, and a centred one by zero at the cost of the last (n − 1)/2 points.
Scenario support
Smoothing a noisy series, deseasonalising monthly data, technical analysis of prices, control charts, forecasting baselines, and any measurement where the underlying level matters more than the individual readings.
Educational estimate
Planning support from the values you enter — not professional advice.

The lag is exact, not approximate

“Moving averages lag” is said constantly and quantified almost never. It is quantifiable, and the answer is clean.

A trailing n-period simple average lags a linear trend by exactly (n − 1)/2 periods. The mean of the last n values of a straight line is the line’s value at the middle of that window, which is (n − 1)/2 periods ago.

So a 50-day average is 24.5 days behind, and a 200-day average is 99.5. Those are not rules of thumb. The verification suite measures the lag on a linear series at seven window lengths and finds agreement to 10⁻⁹.

A linearly weighted average lags by (n − 1)/3, two thirds as much, because weighting recent points more heavily pulls the effective centre of the window forward.

A centred average lags by exactly zero, and cannot be computed for the last (n − 1)/2 points. That is the trade, and it is the reason trailing averages exist despite lagging.

On real data the measured lag differs from the formula, because a real series is not a line. The tool prints both: the formula is what the average does on a trend, which is the figure worth quoting, and the measured one shows what it did on your last few points.

Why α = 2/(n + 1)

Every EMA formula contains it and almost no source explains it. The explanation is the lag from the previous section.

An exponential average lags by (1 − α)/α periods. That is the mean age of the weights — each observation gets weight α(1 − α)ᵢ, and the weighted mean of the ages is (1 − α)/α.

Setting that equal to (n − 1)/2 gives α = 2/(n + 1). One line of algebra. The convention exists so that a “10-period EMA” and a “10-period SMA” are comparable — same lag, different weighting.

The tool prints both lags side by side, and they match: 4.5 for a 10-period window either way. The verification suite checks it on a 500-point linear series across four windows.

Equal lag does not mean equal behaviour. An EMA reacts faster to a sudden jump, because it puts the most weight on the newest point rather than equal weight on all n. The equal lag is a statement about a steady trend, not about a shock.

And an EMA never fully forgets. Every past observation retains a small weight forever, where a simple average drops each point cleanly after n periods. That makes the EMA smoother and means an old outlier leaves a trace long after it has fallen out of any finite window.

A crossover cannot precede the turn

The most common use of two moving averages is the crossover, and the lag makes its timing a matter of arithmetic rather than of skill.

Both averages report the past, so their crossing reports the past. A fast average crosses a slow one only after the underlying series has already turned, by roughly the difference in their lags.

For a 50/200 pair that difference is 75 periods. (200 − 1)/2 minus (50 − 1)/2. A golden cross is, structurally, a report that something changed about seventy-five days ago.

The tool’s turning-point preset makes it concrete. The series turns at period 11; the crossover arrives several periods later, and the suite asserts it can never arrive before the turn.

On a series with no trend, every crossover is noise. The noisy-and-flat preset produces several, all of them false. Shorter windows produce more crossings and more false ones; longer windows produce fewer and later.

That is the trade, and it has no optimum. Any window choice is a position on the responsiveness-versus-noise curve, and it cannot be tuned from the same data it will be evaluated on without overfitting. A crossover rule tested on the history it was chosen from will always look good.

Centred averages, and deseasonalising

If you are describing what has already happened rather than reacting to the present, the trailing average is simply the wrong tool.

A centred average has no lag at all. Its window straddles each point, so the smoothed value sits where the data sits, and there is no correction to apply.

The cost is the end of the series. The last (n − 1)/2 points have no value, because the window would need data that does not exist yet. For historical analysis that is not a cost.

An even window needs the 2×n convention. A 12-period window has no middle point, so the standard fix averages two adjacent windows — half weight on each end of a 13-wide span. That is what a 12-month centred average of monthly data actually is, and it is what the tool computes.

Which is the first step in classical decomposition. A centred average over exactly one seasonal cycle removes the seasonality, because every season appears once in the window. Dividing the series by that average leaves the seasonal factors, which is how a seasonal index is built.

The window must match the cycle exactly. Twelve for monthly, four for quarterly, seven for daily data with a weekly pattern. A 10-month average of monthly data does not remove seasonality; it smears it.

Choosing a window, and what the choice costs

There is no correct window length, and the ways of choosing one are all statements about what you are willing to give up.

Longer windows smooth more and lag more, in a fixed relationship. Noise falls with √n and the lag rises with n, so doubling the window halves the noise by a factor of 1.41 and doubles the lag exactly.

Match the window to a real cycle where one exists. Seven days for weekly seasonality, twelve months for annual. A window chosen for a reason is defensible in a way that 50 and 200 are not.

The round numbers in finance are historical. 50 and 200 trading days are roughly ten weeks and ten months, and they persist because everyone uses them rather than because anything selected them. Their popularity is self-reinforcing and is itself a reason they sometimes work.

Optimising a window on past data overfits, always. With enough candidate windows one will have worked beautifully on any history, and that is the same problem the multiple comparisons page covers. Testing on data the choice did not see is the only check worth anything.

And a moving average is not a forecast. It estimates the current level from recent history. Projecting it forward assumes the level is stable, which is exactly the assumption the series violates whenever it matters — and a fitted trend is the honest tool when you need to extrapolate.

Where a moving average misleads

Smoothing changes the data, and three of the changes are routinely mistaken for findings.

It manufactures autocorrelation. Adjacent values of a moving average share n − 1 of their inputs, so they are correlated by construction. Running a test that assumes independent observations on smoothed data inflates significance badly, and the smoothing is the cause.

It can create cycles that are not there. The Slutsky-Yule effect: averaging pure noise produces a series with apparent periodicity, and the period depends on the window rather than on the data. A cycle visible only after smoothing is a candidate for this.

It hides the variability you may have wanted. A smoothed series understates the range of the underlying values, so a capability or risk figure computed from averages rather than from individual readings is systematically optimistic — which is the mistake the capability page is about.

The endpoints are the least reliable part. The most recent value of a trailing average is built from the fewest settled observations and will be revised as more arrive. Charts rarely say so, and decisions are usually made at exactly that point.

And a change in the window changes the picture. As with histogram bins, a feature that disappears when the window changes was a property of the smoothing rather than of the series. Trying two or three windows costs nothing and settles it.

Sources and methodology

References for the methods and their known artefacts.

Method. Each average is computed directly rather than through a shared abstraction, so the lag each one carries can be stated as its own property rather than inferred. The lag figures are checked against the series itself: on a linear trend the implied lag — (value − average)/slope — must equal (n − 1)/2 for a simple average, (1 − α)/α for an exponential one, (n − 1)/3 for a weighted one and zero for a centred one, and the suite verifies all four to 10⁻⁹ across seven window lengths. It separately confirms that α = 2/(n + 1) makes the exponential lag equal the simple one, that every method reproduces a constant series exactly, that shifting the series shifts the average by the same amount, and that a crossover never precedes the turn that caused it. That engine is verified on every change against 54 assertions. The count and the per-case breakdown are published on the formula verification page.

Related calculators

Where this goes next:

Mean, Median and ModeAll three centres marked on your own data, every mode rather than just the first, and the mean-median gap read as a direct measure of skew.
Standard DeviationSample and population standard deviation, plus variance, mean, median, quartiles, z-scores, outliers, and confidence intervals.
Exponential RegressionFits y = ae^(bx) by true least squares as well as by the usual log-transform, and shows the gap — on the built-in preset the standard method is out by 8% on the doubling time and leaves 4.79 times the squared error.
Trimmed MeanTrimmed and Winsorized means at any fraction, plotted across the full sweep — because a 0% trim is the arithmetic mean and a 50% trim is exactly the median, so the trim fraction is a dial between them.
Frequency DistributionA frequency table with relative and cumulative columns, and all six standard bin-count rules computed at once — they disagree by a factor of 6.67 at n = 10,000, where Sturges asks for 15 bins and the square-root rule asks for 100.
Linear RegressionThe least-squares line with r and r² — and the regression of x on y beside it, because those are two different lines rather than one line rearranged.

More in Math, or browse all calculators.

Educational use disclaimer

An educational tool and not investment advice. Moving averages describe past data and lag it by a computable amount; smoothing induces autocorrelation and can produce apparent cycles in pure noise, so features visible only after smoothing should be treated with caution.

How we calculate · Found an error? email us

Authorship & verification

Written and maintained by , a business operator who builds spreadsheet-based calculators.

What's changed (4 updates)

Published 12 September 2026

  1. Published a moving average calculator that prints the LAG each method carries, which almost no tool states. On a linear trend a trailing n-period simple moving average sits exactly (n − 1)/2 periods behind — measured to 1e-9 across seven window lengths, not approximated. A 200-day average is 99.5 days behind.
  2. That number explains the one piece of unexplained arithmetic in every EMA formula. An exponential average with smoothing factor alpha lags by (1 − alpha)/alpha periods, and alpha = 2/(n + 1) makes that exactly (n − 1)/2 — so the convention exists to make an n-period EMA comparable with an n-period SMA. Verified on a 500-point linear series at four windows.
  3. A linearly weighted average lags by (n − 1)/3 and a centred one by exactly zero, at the cost of the last (n − 1)/2 points. All four are computed together with their lags, and the tool also measures the lag on the user's own data so the formula can be checked against it.
  4. Detects crossovers between two windows and states that one cannot precede the turn that caused it — the gap is roughly the difference in the two lags, 75 periods for a 50/200 pair. The suite asserts that no crossover appears before the turn on a series built to turn at a known point.

Add this calculator to your site

Responsive embed — and private: nothing your visitors type leaves their browser.