◆ New — Strategy Validator, Code Fixer & Prop Compliance Checker are live. Try one free →
Home / Indicators / Historical Volatility
Volatility indicator

Historical Volatility

The annualized standard deviation of logarithmic returns — the standard quantitative measure of how much an instrument has actually been moving.

Illustrative diagram — not live market data.

What it is

Historical Volatility (HV), also called realized or statistical volatility, measures how much an instrument's returns have varied over a recent window, expressed as an annualized percentage. It is the volatility number used across quantitative finance: an HV of 20% means that, based on the last N bars, the instrument's returns have been dispersing at a rate consistent with a 20% standard deviation over a year. To calculate it from price data: take logarithmic returns (the natural log of each close divided by the prior close), compute the standard deviation of those returns over a lookback window such as 20 or 30 bars, then annualize by multiplying by the square root of the number of periods in a year, and multiply by 100 to read as a percentage. Unlike ATR, which measures raw range in price units, HV is unitless and comparable across instruments of any price level. It is strictly backward-looking — a summary of movement that already happened, distinct from implied volatility, which is derived from option prices. HV describes the past; it does not predict future volatility or price direction. This is educational content, not financial advice, and trading involves risk of loss.

How it works

Log returns are used instead of simple percentage changes because they are time-additive (the log return over a week equals the sum of the daily log returns), which is what makes the square-root annualization mathematically coherent. Step by step: r(t) = ln(close(t) / close(t−1)); take the standard deviation of r over the last N bars; multiply by √P, where P is the number of return periods in a year; multiply by 100. The √P step assumes returns are roughly independent across periods, so variance grows linearly with time and volatility grows with its square root. Here is where convention quietly changes the answer: for US equities on daily bars, P = 252 (trading days); for cryptocurrency, which trades every day, P = 365; forex commonly uses about 260 weekdays. Applying √252 to a crypto daily series understates its annualized volatility by roughly 2% of the reported figure relative to the 365-day convention — and on intraday bars P must be bars-per-day × days-per-year, which many published scripts get wrong or ignore entirely. Two HV readings are only comparable if they used the same lookback and the same annualization factor. The window choice matters too: 10-bar HV is jumpy and reactive, 100-bar HV is smooth and slow, and both are 'correct' — they answer different questions.

How traders read it

Common settings

Lookback windows of 10, 20, or 30 bars are common on daily charts (20 approximates one trading month). The annualization factor should match the instrument: 252 for equity daily bars, 365 for crypto daily bars, roughly 260 for forex weekdays, and bars-per-day × trading-days-per-year for intraday data. Some implementations use the sample standard deviation (dividing by N−1) and some the population version (dividing by N); the difference is small at typical windows but is another reason cross-platform values disagree.

Strengths

Pitfalls to watch

Pine v6 example

//@version=6
indicator("Historical Volatility", overlay = false)

length   = input.int(20, "Lookback (bars)", minval = 2)
perYear  = input.int(252, "Periods per Year", minval = 1, tooltip = "252 equity daily, 365 crypto daily, ~260 forex; intraday = bars/day x days/year")

logReturn = math.log(close / close[1])
hv        = ta.stdev(logReturn, length) * math.sqrt(perYear) * 100

plot(hv, "HV % (annualized)", color = color.purple)
hline(0, "Zero", color = color.gray)

Pro tip: Before quoting or comparing any historical-volatility number, state its two hidden parameters out loud: the lookback window and the annualization factor. A '20% HV' means nothing until you know whether it came from 20 bars annualized at √252 or 30 bars at √365 — and on crypto or intraday data the wrong factor silently misstates the result. Treat HV as a risk-sizing input, not a signal. This is educational information only, not financial advice; past volatility does not predict future volatility, and all trading carries risk of loss.

Built an indicator from this? Run it through the Validator to catch look-ahead bias and repainting, or convert a strategy to Pine Script.

Educational only — not financial advice, not a recommendation to trade. No indicator is predictive; trading involves substantial risk of loss.

Catch the bug that compiles.Run auditGet Pro