Free lesson · Volatility
EWMA as a causal variance baseline
Open interactive lessonPractice calculationsExplore labs
Start with the idea
A moving risk estimate should react to new shocks without forgetting the entire earlier path.
Symbols, units & horizon
- v_t: variance forecast for day t available before that day, squared daily-return fractions
- r_t: completed day t return or zero-mean residual
- λ∈[0,1): decay weight
- v_t+1: next-day variance forecast after observing r_t
When and why to use this
Benchmark more complex risk forecasts and resize positions after observed shocks.
A moving risk estimate should react to new shocks without forgetting the entire earlier path.
An exponentially weighted update blends the previous variance estimate with the squared latest return. The decay factor sets memory, and the update only becomes available after that return is observed. Initialization can matter during the warm-up period.
The simple formula treats conditional mean return as zero; otherwise update with a residual from a separately fitted causal mean model. It forecasts one-step variance under a modeling assumption, not the certain size of tomorrow’s move.
EWMA as a causal variance baseline
- Carry the old variance forward with weight λ.
- Square the completed daily return and weight it by 1−λ.
- Add; both terms must be in squared daily-return units.
v_t=.0001, λ=.94 and r_t=−.02 give .94×.0001+.06×.0004=.000118. Next-day volatility is sqrt(.000118)≈.010863.
Apply it in a strategy
- Freeze inputs at the stated decision time and record their units.
- Benchmark more complex risk forecasts and resize positions after observed shocks.
- Recompute the example, then change the material assumption and explain the difference.
Research deliverable
EWMA as a causal variance baseline: produce the worked calculation, a timestamped input record and a written decision addressing this limitation: Fixed decay and squared-return updates may adapt poorly to jumps, regime changes or persistent mean effects.
These are synthetic mechanics examples, not historical performance or paper replications. Module evidence and research boundaries record the 12 September 2026 review.
Python implementation
Self-contained teaching example. Python 3.10+; dependencies and input conventions are shown in the code and notation. Run in your own Python environment.
# Python 3.10+; standard library and NumPy only.
# Synthetic teaching inputs; conventions and units are defined in the notation above.
def ewma_variance(previous,return_value,decay):
if previous<0 or not 0<=decay<1: raise ValueError('Nonnegative variance and valid decay required')
return decay*previous+(1-decay)*return_value**2
assert abs(ewma_variance(.0001,-.02,.94)-.000118)<1e-12
print(ewma_variance(.0001,-.02,.94))Continue learning
Volatility: Measurement, Surfaces & Variance Risk — all lessons- Realized variance starts with squared returns
- EWMA as a causal variance baseline
- A multi-horizon realized-variance forecast
- Implied volatility is a model inversion
- Term structure through total and forward variance
- Strike convexity and a butterfly consistency check
- Vega requires a volatility-unit convention
- Variance exposure and the difference from arbitrage
Quantitative finance and development glossary · Python resources and libraries · Research sources and limitations