EWMA - Exponentially Weighted Moving Average

Quick Reference

Metodo ottimale per stimare volatilita futura usando pesi esponenziali su rendimenti passati.

Formula EWMA Standard Deviation

σ²_t = λ × (r_t - μ_t-1)² + (1 - λ) × σ²_t-1

Variabili

  • σ²_t: Variance estimate al tempo t
  • λ (lambda): Decay parameter (0 < λ < 1)
  • r_t: Return al tempo t
  • μ_t-1: Mean return estimate (spesso ≈ 0)
  • σ²_t-1: Previous variance estimate

Standard deviation:

σ_t = √σ²_t

Lambda Ottimale

Ricerca empirica mostra:

λ = 0.06061

Questo corrisponde a: - Span = 32 giorni - Half-life = 11 giorni

Span e Lambda Relationship

λ = 2 / (Span + 1)

Esempi:

Span (giorni) Lambda Half-life (giorni)
22 0.087 7.6
32 0.061 11.0
64 0.031 22.0

Half-Life

Numero di giorni dopo cui 50% del peso e stato usato.

Formula approssimata:

Half-life ≈ -log(2) / log(1 - λ)

Per λ = 0.06061:

Half-life ≈ 11 giorni

Perche EWMA > Simple Moving Average

Simple MA (SMA)

Finestra N giorni, pesi uguali:

σ = √[Σ(r_t - μ)² / N]

Problemi: - Hard jumps quando dati escono dalla finestra - Tutti dati stessa importanza (giorno 1 = giorno 30) - Noisy estimate

EWMA

Pesi decrescono esponenzialmente:

Weight(t-1) = λ
Weight(t-2) = λ × (1-λ)
Weight(t-3) = λ × (1-λ)²
...

Vantaggi: - Smooth estimate - Piu peso a dati recenti (sensato!) - Meno noise - Forecast power migliore

Equivalenza EWMA vs SMA

EWMA span 32SMA window 22

Entrambi hanno half-life ~11 giorni.

Ma EWMA è superiore perche smooth.

Blended Estimate

Per catturare sia clustering che mean reversion:

σ_blend = 0.7 × σ_short + 0.3 × σ_long

Dove: - σ_short: EWMA con λ = 0.06061 (span 32) - σ_long: EWMA con λ molto piccolo (span >>100)

Vantaggi blend: - Short term cattura volatility clustering - Long term previene posizioni massime pre-crisis - Ulteriormente riduce trading costs

Calcolo Ricorsivo

EWMA e efficiente da calcolare ricorsivamente:

Initial:

σ²_0 = Sample variance primi 30-50 giorni

Update daily:

σ²_t = λ × r²_t + (1 - λ) × σ²_t-1

(Assumendo μ ≈ 0, altrimenti sottrai mean)

No need di ricalcolare su tutta la storia ogni giorno!

Esempio Pratico: S&P 500

Day 0 (initialization):

σ²_0 = 0.01² = 0.0001  (1% daily vol)

Day 1: - r_1 = +0.02 (2% return) - λ = 0.06061

σ²_1 = 0.06061 × 0.02² + (1 - 0.06061) × 0.0001
     = 0.06061 × 0.0004 + 0.93939 × 0.0001
     = 0.000024 + 0.000094
     = 0.000118

σ_1 = √0.000118 = 0.0109 (1.09% daily)

Annualize:

σ_annual = 0.0109 × 16 = 17.4%

When to Update

Frequency: - Daily: Raccomandato per vol target > 15% - Weekly: OK per vol target < 15% - Hourly: Se automated e high vol target (30%+)

Never: Dopo ogni trade! (overkill)

Decay Visualization

Peso relativo di rendimenti passati (λ = 0.06):

Days ago Weight Cumulative
1 6.1% 6.1%
5 4.7% 26.5%
11 (half-life) 3.0% 50.0%
20 1.7% 70.0%
50 0.3% 94.0%

Dopo 50 giorni, 94% del peso e stato usato.

Comparison: Fast vs Slow EWMA

Fast (λ = 0.10, span 19): - React quickly to changes - More noise - Higher trading costs - Better immediate forecast

Optimal (λ = 0.06, span 32): - Balance reaction vs noise - Best forecast power - Reasonable costs

Slow (λ = 0.03, span 65): - Very smooth - Slow to react - Misses regime changes - Lower forecast power

Blended: Best di entrambi!

Implementation Details

Handling Missing Data

Se mercato chiuso (weekend/holiday): - Skip days (don't update) - Or use zero return

Non inflates variance estimate.

Initial Estimate

Option A: Use SMA su primi 30 giorni Option B: Use expanding window fino a 30 giorni Option C: Use long-run average (se disponibile)

Dopo ~50 giorni, initial estimate irrilevante.

Annualization

EWMA fornisce σ giornaliera:

σ_annual = σ_daily × √252  (business days)
σ_annual ≈ σ_daily × 16  (approssimazione)

Forecast Horizon

EWMA ottimale per forecast: - 1-40 giorni ahead: Eccellente - 40-100 giorni: Buono - >100 giorni: Poor (use blend)

Per long-term mean reversion domina.

Alternative: GARCH

GARCH (1,1) model:

σ²_t = ω + α × r²_t-1 + β × σ²_t-1

Piu complesso di EWMA, marginalmente migliore forecast.

Per trading pratico, EWMA sufficiente.

Errori Comuni

  • Lambda troppo alto: Excessive trading, noise
  • Lambda troppo basso: Miss regime changes
  • Not annualizing: Usare σ daily per annual targets
  • Forgetting to update: Stale estimate
  • Only short-term estimate: Ignore mean reversion
  • Complex models: GARCH overkill per most applications

Concetti Correlati

  • [[Volatility Clustering]] - fenomeno che EWMA cattura
  • [[Standard Deviation]] - cosa stiamo stimando
  • [[Position Sizing]] - usa σ_EWMA per calcoli
  • [[Mean Reversion]] - perche blend con long-term needed