Chapter 8: Financial Feature Engineering

Range-Based Volatility Estimators from OHLC Data

High and low prices reveal intrabar dispersion that the closing price alone cannot, but each OHLC estimator is only better when its assumptions match the bar structure you actually trade.

Range-Based Volatility Estimators from OHLC Data

High and low prices reveal intrabar dispersion that the closing price alone cannot, but each OHLC estimator is only better when its assumptions match the bar structure you actually trade.

The Intuition

Close-to-close volatility treats a day as one number: yesterday's close to today's close. That is often a useful baseline, but it misses information about the path inside the bar.

Two days can have the same close-to-close return and very different realized turbulence. One may be quiet all day. The other may swing 3% intraday and finish unchanged. A range-based estimator sees the difference because the high and low encode how much of the path was explored before the close.

That is why Chapter 8 treats estimator choice as a real design knob rather than a cosmetic formula change. Volatility features feed position sizing, risk normalization, gating rules, and label construction. If the estimator is too noisy, all of those downstream objects become unstable. If the estimator is "efficient" under the wrong assumptions, it can be precise about the wrong quantity.

The decision is therefore not "which estimator is best?" It is "which estimator best matches my session structure and holding horizon?"

The Math

Let $O_t, H_t, L_t, C_t$ denote the open, high, low, and close for bar $t$.

The close-to-close return is

$$ r_t = \ln \frac{C_t}{C_{t-1}}. $$

Over a rolling window of $n$ bars, the usual variance estimate is the sample variance of $\{r_t\}$, then annualized by the number of bars per year.

Range-based estimators instead start from the idea that, under a continuous diffusion observed over one bar, the range $H_t-L_t$ contains more information about latent variance than the close alone. "Efficiency" here means lower estimator variance under that model, not universal superiority.

Parkinson

Parkinson uses only the intrabar range:

$$ \hat \sigma^2_{P,t} = \frac{1}{4 \ln 2}\left(\ln \frac{H_t}{L_t}\right)^2. $$

It is attractive because the full high-low excursion is informative even when the close returns near the open. But it assumes the bar is effectively continuous and therefore misses close-to-open jumps.

Garman-Klass

Garman-Klass adds the open-close move:

$$ \hat \sigma^2_{GK,t} = \frac{1}{2}\left(\ln \frac{H_t}{L_t}\right)^2 - (2\ln 2 - 1)\left(\ln \frac{C_t}{O_t}\right)^2. $$

This uses more of the OHLC bar and is often more precise than Parkinson when gaps are small and the session behaves like a single intraday diffusion.

Yang-Zhang

Yang-Zhang separates overnight and intraday variation. Define

$$ o_t = \ln \frac{O_t}{C_{t-1}}, \qquad c_t = \ln \frac{C_t}{O_t}. $$

It then combines the variance of overnight returns, the variance of open-to-close returns, and a drift-robust Rogers-Satchell term:

$$ \hat \sigma^2_{YZ} = \hat \sigma_o^2 + k \hat \sigma_c^2 + (1-k)\hat \sigma_{RS}^2, $$

where

$$ \hat \sigma^2_{RS,t} = \ln \frac{H_t}{O_t}\left(\ln \frac{H_t}{O_t} - \ln \frac{C_t}{O_t}\right) + \ln \frac{L_t}{O_t}\left(\ln \frac{L_t}{O_t} - \ln \frac{C_t}{O_t}\right), $$

and the finite-sample weight is commonly

$$ k = \frac{0.34}{1.34 + \frac{n+1}{n-1}}. $$

For rolling features, average the single-bar variance estimates over the window, then annualize. The practical point is more important than the algebra: Yang-Zhang tries to keep the efficiency gain from OHLC information without pretending that overnight jumps do not exist.

How It Works in Practice

The choice among these estimators is really a choice about which part of risk matters for the feature:

  • Close-to-close is the safest baseline when overnight gaps are central to the strategy and only closes are trusted.
  • Parkinson is useful when the goal is intrabar dispersion and the session is close to continuous.
  • Garman-Klass is attractive when open, high, low, and close all carry reliable session information and gaps are not dominant.
  • Yang-Zhang is the best default for daily equities or futures when close-to-open jumps are material and you still want the intraday range.

The efficiency story should be read narrowly. Under a clean diffusion, Parkinson and Garman-Klass can estimate variance with lower sampling noise than close-to-close returns. But if the market routinely reprices between sessions, that "extra precision" can come from ignoring the risk that actually matters for an overnight position.

Rolling aggregation also changes the meaning. A 20-day Yang-Zhang feature is not a generic "20-day volatility." It is an estimate built from 20 daily bars, each of which contains one overnight interval and one regular session. That is a different object from a 20-day feature built from hourly crypto bars, where there is no close-open gap in the same sense.

Worked Example

Suppose an equity ETF trades quietly for two weeks and then gaps down 4% after an earnings shock in one of its largest constituents.

Before the shock:

  • close-to-close volatility is low,
  • Parkinson and Garman-Klass are also low and usually a bit smoother,
  • Yang-Zhang looks similar because overnight variation is small.

Around the shock:

  • close-to-close volatility jumps because $C_t/C_{t-1}$ absorbs the gap,
  • Parkinson can remain surprisingly muted if the intraday high-low range is not extreme,
  • Garman-Klass may still underreact because it mostly rewards intraday structure,
  • Yang-Zhang rises clearly because it allocates variance to the overnight component.

That divergence is not a bug. It is the diagnostic. It tells you which estimator is aligned with the risk your strategy faces.

If the model holds risk overnight, Parkinson may be the wrong feature even if it is efficient in theory. If the strategy enters after the open and exits before the close, a range-focused estimator may be closer to the object you care about.

Figure Specification

Use one chart with 20-day rolling volatility for close-to-close, Parkinson, Garman-Klass, and Yang-Zhang on the same instrument. Highlight a visible overnight-gap episode. The desired visual message is that Parkinson and Garman-Klass can stay too calm when the day's risk arrives mostly through the open.

Add a compact decision table:

Estimator Uses Best when Main failure mode
Close-to-close $C_t, C_{t-1}$ gaps matter and closes are reliable misses intraday path
Parkinson $H_t, L_t$ intraday diffusion dominates misses overnight jumps
Garman-Klass $O_t, H_t, L_t, C_t$ full OHLC bar is reliable and gaps are modest fragile under large gaps
Yang-Zhang previous close plus OHLC daily bars with meaningful overnight risk more complex and still bar-dependent

Common Mistakes

WRONG: Use Parkinson on US equities through earnings season and expect it to capture overnight shock risk.

CORRECT: Use a gap-aware estimator such as Yang-Zhang, or move to realized intraday volatility if the use case demands a richer path measure.

WRONG: Mix adjusted closes with unadjusted opens, highs, and lows.

CORRECT: Apply corporate-action adjustments consistently across the full OHLC bar before computing any range-based feature.

WRONG: Compare annualized volatility numbers computed under different bar calendars.

CORRECT: Annualize variance and volatility using factors that match the bar cadence and the session definition.

WRONG: Treat "more efficient" as "more correct."

CORRECT: Efficiency is model-relative. The right estimator is the one whose assumptions are closest to the market structure and horizon of the feature.

Connections

  • Book chapters: Ch08 Financial Feature Engineering; Ch09 Model-Based Feature Extraction
  • Related primers: volatility models as feature extractors, microstructure noise, realized volatility
  • Why it matters next: these estimators define the raw volatility measure that later feeds GARCH, HAR, scaling rules, and state-dependent trading decisions

Register to Read

Sign up for a free account to access all 61 primer articles.

Create Free Account

Already have an account? Sign in