Historical Volatility Calculator

Prices are

How to use it

  1. Paste a column of closing prices, or two columns of date and close, straight from a spreadsheet or a download. A heading line is skipped. If the dates run newest first, the series is turned around.
  2. Say whether the prices are daily, weekly or monthly. This sets how volatility is annualized.
  3. Change the EWMA decay λ if you want to. 0.94 is the RiskMetrics value for daily data.
  4. Enter a forecast horizon to add it to the GARCH forecast table.
  5. The three volatility estimates, the fitted GARCH(1,1) model and its forecast appear and update as you edit. GARCH needs at least 100 returns.

To see it filled in, choose “Show an example”. Use adjusted closes, so splits and dividends do not show up as price moves. For study and comparison; not financial advice.

Result

Paste a column of prices, oldest first.

Log returns, less their mean. Annualized volatility is the per-period figure times the square root of the periods per year. EWMA and GARCH both start from the sample variance.

Methodology, equations and examples

Volatility is the standard deviation of an asset's returns, usually quoted per year. Option prices give the market's forward-looking estimate, its implied volatility. A price history gives a backward-looking one, and this calculator measures it three ways. The close-to-close figure weights every return in the series equally. EWMA weights recent returns more. GARCH(1,1) also pulls the estimate back toward a long-run level, so it can forecast how volatility will change.

Returns

Each return is a log return, rt = ln(Pt / Pt−1), where Pt is the close at period t. Log returns add up over time, so a year's return is the sum of its daily returns. The calculator works with the returns less their mean, εt = rt − r̄. For daily data the mean is small and this changes little; for monthly data it matters more.

Close-to-close historical volatility

The historical volatility is the sample standard deviation of the returns:

s = √( Σ (rt − r̄)² / (n − 1) )

It is annualized by multiplying by the square root of the periods per year, √252 for trading days, √52 for weeks and √12 for months. This assumes returns are independent from one period to the next, so their variances add.

Example: closes of 100, 102, 101 and 103.5 give returns of 1.980 %, −0.985 % and 2.445 %. Their mean is 1.147 % and their sample standard deviation 1.861 %, or 1.861 % × √252 = 29.54 % a year.

EWMA

The exponentially weighted moving average (EWMA) makes each period's variance a blend of the last variance and the last squared return:

ht+1 = λ ht + (1 − λ) εt²

ht is the variance of period t's return, estimated from the returns before it. The weight on a return falls by a factor of λ each period, so with λ = 0.94 a return 11 periods back counts about half as much as the latest one. RiskMetrics uses λ = 0.94 for daily data. The calculator starts the recursion from the sample variance and reports h for the period after the last price.

Example (Hull): with λ = 0.90, yesterday's volatility estimate 1 % and yesterday's return 2 %, today's variance is 0.90 × 0.0001 + 0.10 × 0.0004 = 0.00013, a volatility of 1.14 % a day.

GARCH(1,1)

GARCH(1,1), the generalized autoregressive conditional heteroskedasticity model, adds a constant to the EWMA recursion:

ht+1 = ω + α εt² + β ht

with ω > 0, α ≥ 0, β ≥ 0 and α + β < 1. The constant draws the variance toward the long-run variance VL = ω / (1 − α − β). EWMA is the special case ω = 0, α = 1 − λ, β = λ, which has no long-run level.

  • α is the weight on the latest shock: a high α makes volatility jump after a large move.
  • β is the weight on the last variance: a high β makes volatility slow to change.
  • α + β is the persistence. A shock to the variance decays by that factor each period, so its half-life is ln 0.5 / ln(α + β) periods.

Example (Hull): with ω = 0.000002, α = 0.13 and β = 0.86, the long-run variance is 0.000002 / 0.01 = 0.0002, a volatility of 1.41 % a day. If yesterday's volatility estimate was 1.6 % and yesterday's return 1 %, today's variance is 0.000002 + 0.13 × 0.0001 + 0.86 × 0.000256 = 0.00023516, a volatility of 1.53 % a day.

Fitting by maximum likelihood

The calculator chooses ω, α and β to make the observed returns as likely as possible, assuming each εt is normal with variance ht. That maximizes the log-likelihood

ln L = −½ Σ [ ln 2π + ln ht + εt² / ht ]

It starts at α = 0.08 and β = 0.90 with ω set so that the long-run variance equals the sample variance, and searches with the Nelder-Mead simplex method. The search runs over ω = e^a, α + β = 1 / (1 + e^(−b)) and α / (α + β) = 1 / (1 + e^(−c)), so every trial satisfies the constraints. It then restarts once from its answer, to make sure it has not stopped early. If the search does not converge, the results say so.

A fit needs enough data. With a few hundred returns, α and β on their own are uncertain, though their sum is usually well determined. Several years of daily prices give steadier estimates. The calculator needs at least 100 returns before it fits GARCH.

Forecasting volatility

The expected variance k periods ahead decays geometrically toward the long-run level:

E[hn+k] = VL + (α + β)^(k−1) (hn+1 − VL)

Averaging this over the next T periods gives the variance to use for, say, pricing an option that expires in T periods:

average variance = VL + (1 − (α + β)^T) / (T (1 − α − β)) × (hn+1 − VL)

The forecast table annualizes each average. Near-term horizons stay close to today's volatility; long horizons approach the long-run figure. This is the term structure of volatility the model implies.

The example

"Show an example" fills in 1,000 daily closes simulated on this page from a GARCH(1,1) with ω = 0.000002, α = 0.08, β = 0.90 and a mean return of 0.03 % a day. The long-run volatility of that model is √(0.000002 / 0.02 × 252) = 15.87 % a year, and a shock has a half-life of ln 0.5 / ln 0.98 = 34.3 days. The fit recovers a persistence of 0.979 against the true 0.98, with α = 0.066 and β = 0.913. Its long-run volatility comes out at 13.41 %, lower than the truth, because 999 returns pin down the slow decay of volatility less well than its persistence. A different seed would give a different, equally valid sample.

Limits

All three methods treat each period's return as normal given its variance. Real returns have fatter tails, so the GARCH fit tends to understate how often large moves happen. Volatility from past prices describes the past. It is a starting point for judging an implied volatility or a risk figure, not a prediction of what the market will do. For study and comparison; not financial advice.

Top