Formula: EWMA Smoothing & Half-Life Formula
- smoothingFactorAlpha: Smoothing Factor Alpha (α)
- latestObservationYt: Latest Observation Yt (Y_t)
- priorEwmaLevelSt1: Prior Ewma Level St1 (S_{t−1})
Calculate updated EWMA S_t = α·Y_t + (1−α)·S_{t−1}, equivalent span N, and exponential half-life.
Both values break the derived lines. At α = 1 the level just copies the latest reading and the half-life is zero; at α = 0 the level never changes and span, centre of mass and half-life are all infinite. The engine therefore asks for an α strictly between 0 and 1. If you want almost no smoothing, try 0.99; for very heavy smoothing, try a small value such as 0.01.
For span N, α = 2/(N+1). For centre of mass c, α = 1/(1+c). For half-life h, α = 1 − 0.5^(1/h). So span 9, com 4 and a half-life of about 3.106 steps all describe α = 0.2. Enter the α you derive here and the supporting lines should show the setting you started from, which is a quick check that you converted correctly.
No. They have the same average data age, which is why the span convention exists, but different weights. The simple average weights the last nine readings equally and ignores the tenth completely. The EWMA weights the newest reading at 0.2, the one before at 0.16, then 0.128, and never quite reaches zero. The EWMA reacts to the latest reading more and drops old readings more gradually.
They are complements. λ is the weight kept on the old level and α is the weight given to the new reading, so α = 1 − λ. Risk and volatility papers usually quote λ, for example 0.94 for daily data, which is α = 0.06 here. If you type the λ value as α you get the opposite filter, one that barely remembers anything.
Yes. Any α above 0.5 gives a half-life under one step, because a reading loses more than half its weight on the very next update. At α = 0.5 the half-life is exactly 1. Very short half-lives mean the smoothed line follows the raw data closely, so check whether you really need smoothing at all before choosing a large α.
Not directly. The formulas assume one fixed step between readings. With irregular timestamps the usual approach is to let the decay depend on the time gap, using (1 − α) raised to the gap measured in steps, which this page does not do. If your gaps vary only a little you can usually ignore it; if they vary a lot, the half-life in steps loses its meaning.
Almost always because of the starting level or a bias adjustment. Some tools start from the first reading, some start from zero and correct for it, and some use an adjusted weighting for the first values. The single-step update shown here is the same in all of them, so the differences fade after a few half-lives. Compare later values, not the first handful.
It is the weighted average age of the information inside the smoothed value. At α = 0.2 the EWMA behaves, on average, like a reading taken four steps ago. It is also the steady lag behind a straight-line trend: if the data rises by a constant amount each step, the EWMA settles about four steps' worth of rise below the latest reading.
A smaller α removes more noise but adds lag, and the lag grows quickly at small values. The half-life roughly doubles when α halves in that region. Pick the longest half-life your decision can tolerate in delay, not the smoothest-looking line. If you need both low noise and quick response to trends, a single EWMA may not be enough.
The update rule is the same, but feed it squared returns rather than prices: Y_t is the latest squared return and S_{t−1} is the previous variance estimate. The output is the updated variance; take its square root for volatility. The span and half-life lines still describe how quickly old returns stop influencing the estimate.
The default asks a single question. Your smoothed level was 104 at the last step, a new reading of 118 has just arrived, and the smoothing factor α is 0.2. Where does the smoothed level go now?
The answer is 106.8 units. The new reading sits 14 units above the old level, and α = 0.2 means the EWMA moves one fifth of that gap, which is 2.8 units. Every EWMA update can be read this way: new level = old level + α × (new reading minus old level). The form on the page, S_t = α·Y_t + (1 − α)·S_{t−1}, is the same equation rearranged.
Seeing it as a fraction of the gap makes the behaviour easy to predict. If the reading had come in at 90 instead, the gap is minus 14 and the level falls by 2.8 to 101.2. The calculator confirms both. A reading equal to the old level leaves the level unchanged, whatever α you choose.
Below the main result sit three translations of α into other units: a span of 9 periods, a half-life of 3.106 steps and a centre of mass of 4 steps. None of them changes the update. They exist because different software and different fields describe the same filter in different terms, and you often need to move between them.
Span answers the question: which simple moving average does this EWMA roughly resemble? The convention is α = 2/(N+1), so N = 2/α − 1. With α = 0.2 that is 2/0.2 − 1 = 9, which is why traders and analysts sometimes call this a 9-period EWMA. The resemblance is about the average age of the data, not the shape of the weights. A 9-period simple average gives nine readings equal weight and then drops them; the EWMA gives every past reading some weight, shrinking by a factor of 0.8 each step back.
Centre of mass is the weighted average age of the readings inside the EWMA, measured in steps. It equals (1 − α)/α, so 0.8/0.2 = 4. Read it as: the typical piece of information in your smoothed value is four steps old. Span and centre of mass are linked, because N = 2 × com + 1, and 2 × 4 + 1 = 9.
Half-life is the number of steps after which a reading's weight has fallen to half of what it was when it arrived. The weight multiplies by (1 − α) each step, so you solve (1 − α)^h = 0.5, which gives h = ln(0.5)/ln(1 − α). The page writes it as −ln(2)/ln(1 − α); the two are identical. For α = 0.2, ln(0.8) is about −0.2231, and 0.6931 divided by 0.2231 is 3.106 steps, matching the supporting line.
A check worth doing once by hand: α = 0.5 gives a span of 3, a centre of mass of 1 and a half-life of exactly 1 step. The calculator returns all three, and the update becomes the plain average of the old level and the new reading.
The preset rows use α = 0.12, 0.2 and 0.3 with the same readings. At 0.12 the level only moves to 105.68, the span stretches to 15.667 periods and the half-life to 5.422 steps. At 0.3 it moves to 108.2 with a span of 5.667 and a half-life of 1.943 steps.
Two things stand out. First, the response to one surprise reading is linear in α: 0.12 moves 12% of the 14-unit gap, 0.3 moves 30%. Second, the memory measures are not linear. Going from 0.2 to 0.12 cuts α by 40%, yet the half-life rises by about 75%. Small α values sit on the steep part of the curve, so a change from 0.05 to 0.04 alters the memory far more than a change from 0.5 to 0.4.
Spans that are not whole numbers, like 15.667, are normal. Span is just another way of writing α, and only certain α values produce a round span. If you want a round span, compute α from it: a 20-period span means α = 2/21, about 0.0952381, and the calculator then shows a span of 20 periods and a half-life of 6.926 steps.
Picking α directly is hard to justify to anyone else. A half-life is easier: "a reading counts half as much after two weeks" is a statement a colleague can argue with. Invert the formula to get α = 1 − 0.5^(1/h).
For a half-life of 2 steps, α = 1 − 0.5^0.5, about 0.2928932. Enter that and the calculator reports a half-life of 2 steps, a span of 5.828 periods and a centre of mass of 2.414 steps. For a half-life of 1 step you get α = 0.5, as above.
Make sure the step matches your data. If you have daily readings and want a 10-day half-life, h is 10. If the same series is sampled hourly, the step is an hour and the same 10-day memory needs h = 10 × 24 hourly steps, which pushes α very close to zero. The calculator only knows steps; it cannot tell what a step means in your data.
Volatility models are a common case. A daily variance EWMA with a decay factor λ, as used in some risk systems, has α = 1 − λ. A λ of 0.94 is therefore α = 0.06 in this calculator. Enter the α, not λ, or every derived figure will describe the wrong filter.
The engine only accepts an α greater than 0 and less than 1. Type exactly 1 or exactly 0, or anything outside that range, and the page shows an error asking for a value strictly between the two instead of a result.
Both boundaries are real cases, just not interesting ones to compute. At α = 1 there is no smoothing: the level simply copies each new reading, the span collapses to 1 and the half-life to zero. At α = 0 the level never moves at all, and span, centre of mass and half-life all become infinite. Close to either end the numbers still work. An α of 0.99 moves the level 99% of the way to the new reading; an α of 0.01 gives a half-life of 68.968 steps.
The most common way to hit the error is typing a percentage. An α meant as 20% must be entered as 0.2. Entering 20 is rejected rather than guessed at, which is better than a silent reinterpretation, but it does mean the form will not accept settings written the way some software displays them.
The page needs a prior level. In a running system that is simply the last output. On the first step you have to invent one, and the choice affects the next several outputs.
Common choices are the first reading, the average of the first few readings, or zero with a bias correction. Starting at the first reading is simple and usually fine. Starting at zero is what some optimisers and library functions do internally, and then the early values are pulled towards zero until enough steps have passed. With α = 0.2 the starting value still carries 0.8^k of its weight after k steps, so after 3 steps (close to one half-life) it is still about half, and after 10 steps it has fallen to about 11%.
If you are reproducing someone else's EWMA, the seed and whether they used an "adjust" or bias correction setting explain most small disagreements in the first dozen values. Once the series has run several half-lives past the start, those differences fade and the update you see here matches theirs.
Smoothing and responsiveness pull in opposite directions. When the underlying series shifts permanently, the EWMA closes the gap by a factor of (1 − α) each step, so after k steps the remaining gap is (1 − α)^k of the original. With α = 0.2 that is 80% after one step and half after about 3.1 steps, which is the half-life again from a different angle.
For a steady upward trend the EWMA settles at a constant lag behind the data. That lag, in steps, equals the centre of mass: 4 steps at the default. A series rising by 1 unit per step will see the EWMA trail by about 4 units once it has settled. If that lag is unacceptable you need a larger α, accepting more noise, or a trend-aware method such as double exponential smoothing, which this page does not compute.
This is also why an EWMA crossover or alert fires late. The smoothed line is a summary of the past, and the centre of mass tells you how far in the past it is centred.
The page computes one step. For a whole series, feed each output back in as the next S_{t−1}; any spreadsheet column can do this with the same formula. Use the calculator to check the first few rows of your sheet or code, and to translate a setting between tools: a library that asks for span, another that asks for com, a paper that quotes half-life.
Before you settle on an α, write the half-life in real time units and ask whether a reading from that long ago should still count for half. If the answer feels wrong, adjust the half-life and derive α from it. That is a choice you can defend, and the calculator will show you the matching span and centre of mass for your notes.