YZ Vol -- Yang-Zhang Volatility Estimator

Contents


Overview

Yang-Zhang Volatility is the most comprehensive classical volatility estimator. Developed by Dennis Yang and Qiang Zhang in 2000, it combines three separate volatility components into a single, robust measure:

  1. Overnight volatility -- the variance of the open relative to the previous close (captures inter-candle drift).
  2. Open-to-close volatility -- the variance of the close relative to the open (captures intraday directional movement).
  3. Rogers-Satchell volatility -- a component similar to Garman-Klass that uses high, low, open, and close (captures intraday range efficiently).

The formula optimally weights these three components to minimize the estimator's variance:

YZ = sqrt( overnight_var + k * open_close_var + (1 - k) * rogers_satchell_var )

Where k is chosen to minimize the total variance of the estimator.

What makes Yang-Zhang unique is its handling of overnight drift -- the gap between one candle's close and the next candle's open. Parkinson and Garman-Klass both assume this gap is zero, which is incorrect whenever there are jumps between candles. While cryptocurrency markets trade 24/7 (no true "overnight" close), there are still meaningful open-vs-previous-close differences caused by rapid price movement between candles, exchange maintenance windows, and liquidity gaps. Yang-Zhang captures this drift, producing the most robust volatility estimate when market patterns are irregular.


Format

yz_vol_{period}

The period defines how many candles the estimator averages over.

ExamplePeriodUse Case
yz_vol_1010Short-term -- responsive to recent volatility changes
yz_vol_2020Standard -- the recommended default for most strategies
yz_vol_5050Long-term -- captures the broad volatility regime, very stable

Period range: 5 to 500.

Value range: 0 to infinity (annualized volatility, always positive). Typical crypto range: 0.005 to 0.12.


Understanding YZ Vol Values

Yang-Zhang values are annualized volatility estimates expressed as decimals. Like all volatility estimators, they are not bounded to a fixed range and depend on the asset, timeframe, and market conditions.

YZ Vol RangeInterpretation
Below 0.01Ultra-calm -- all three volatility components are minimal. Strongest possible squeeze signal.
0.01 -- 0.035Low volatility -- quiet market with minimal inter-candle drift. Excellent squeeze environment.
0.035 -- 0.07Moderate volatility -- normal conditions for major crypto pairs. Suitable for most strategies.
0.07 -- 0.12High volatility -- large moves with significant drift between candles. Elevated risk.
Above 0.12Extreme volatility -- rapid, gapped price action. Very high risk for new entries.

Note

Yang-Zhang values may differ from Parkinson and GK Vol for the same period because of the overnight component. In markets with frequent gaps between candle close and next open, YZ Vol will be higher than GK Vol. In smooth, continuous markets, they will be very similar. These differences are themselves informative -- a large gap between YZ Vol and GK Vol reveals that inter-candle drift is a significant source of volatility.


Understanding Operators with YZ Vol

Each operator behaves differently with YZ Vol. As the most comprehensive volatility filter indicator, YZ Vol is almost always combined with directional entry signals.

< (Less Than) -- State-Based

What it does: The trigger is true on every candle where YZ Vol is below the threshold.

On the chart: The market is calm on every dimension -- small wicks, small bodies, and minimal drift between candles. This is the most thorough squeeze confirmation available from a single indicator.

[[actions.triggers]]
indicator = "yz_vol_20"
operator = "<"
target = "0.025"
timeframe = "1h"

Typical use: High-confidence squeeze detection. When YZ Vol is low, it means not only are the candles small, but there is minimal jump between consecutive candle opens and prior closes. The market is truly quiet. Combine with a directional trigger to enter when the squeeze resolves.

> (Greater Than) -- State-Based

What it does: The trigger is true on every candle where YZ Vol is above the threshold.

On the chart: Volatility is elevated across all components. The market is making large moves and potentially gapping between candles.

[[actions.triggers]]
indicator = "yz_vol_20"
operator = ">"
target = "0.08"
timeframe = "1h"

Typical use: Volatile market filter. Use > to avoid entering new positions when the market is chaotic, or to exit existing positions when volatility spikes to dangerous levels. YZ Vol > threshold as an exit trigger captures risk expansion that other estimators might miss.

cross_below -- Event-Based

What it does: Fires once, at the exact candle where YZ Vol transitions from above the threshold to below it. The previous candle had YZ Vol >= the target, and the current candle has YZ Vol < the target.

[[actions.triggers]]
indicator = "yz_vol_20"
operator = "cross_below"
target = "0.04"
timeframe = "1h"

Typical use: Detect the exact moment the market settles into a calm regime. Volatility has just dropped below the threshold -- the market is transitioning from active to quiet. This begins the watch period for a squeeze breakout setup.

cross_above -- Event-Based

What it does: Fires once, at the exact candle where YZ Vol transitions from below the threshold to above it. The previous candle had YZ Vol <= the target, and the current candle has YZ Vol > the target.

[[actions.triggers]]
indicator = "yz_vol_20"
operator = "cross_above"
target = "0.06"
timeframe = "1h"

Typical use: Detect the moment volatility expands from a calm state. The market was quiet and is now making larger, more gapped moves. This regime change often marks the beginning of a significant trending move. Combine with direction indicators to trade the expansion.

Why: YZ Vol produces floating-point values calculated to many decimal places. Exact equality will almost never be true. Use < or > instead.

Choosing the right operator

  • Use < for the most comprehensive squeeze detection available -- low YZ Vol means the market is quiet on every axis.
  • Use > to avoid chaotic markets or to trigger exits when volatility spikes.
  • Use cross_below / cross_above to detect precise volatility regime transitions.

TOML Examples

Ultra-Calm Market RSI Dip Buy

When YZ Vol confirms an ultra-calm market and RSI drops into oversold territory, buy the dip. The logic: in a truly quiet market, an RSI dip is more likely a temporary pullback than the start of a crash.

[[actions]]
type = "open_long"
amount = "100 USDC"

  [[actions.triggers]]
  indicator = "yz_vol_20"
  operator = "<"
  target = "0.02"
  timeframe = "1h"

  [[actions.triggers]]
  indicator = "rsi_14"
  operator = "<"
  target = "30"
  timeframe = "1h"

YZ Vol Spike -- Exit or Avoid

When volatility explodes above the danger threshold, exit the position. A sudden YZ Vol spike means the market has become unpredictable, with large gaps between candles.

[[actions]]
type = "sell"
amount = "100%"

  [[actions.triggers]]
  indicator = "yz_vol_20"
  operator = "cross_above"
  target = "0.10"
  timeframe = "1h"

Triple Volatility Confirmation Squeeze

The highest-confidence squeeze setup: require all three volatility estimators (Parkinson, GK Vol, and YZ Vol) to confirm low volatility simultaneously. When all three agree, enter on a bullish RSI signal.

[[actions]]
type = "open_long"
amount = "150 USDC"

  [[actions.triggers]]
  indicator = "parkinson_20"
  operator = "<"
  target = "0.02"
  timeframe = "1h"

  [[actions.triggers]]
  indicator = "gk_vol_20"
  operator = "<"
  target = "0.025"
  timeframe = "1h"

  [[actions.triggers]]
  indicator = "yz_vol_20"
  operator = "<"
  target = "0.025"
  timeframe = "1h"

  [[actions.triggers]]
  indicator = "rsi_14"
  operator = "cross_above"
  target = "30"
  timeframe = "1h"

Regime-Based Trend Entry

Use YZ Vol to confirm the market is in a moderate volatility regime (trending, not chaotic), then enter on an EMA crossover with a macro trend filter.

[[actions]]
type = "open_long"
amount = "100 USDC"

  [[actions.triggers]]
  indicator = "yz_vol_20"
  operator = ">"
  target = "0.02"
  timeframe = "1h"

  [[actions.triggers]]
  indicator = "yz_vol_20"
  operator = "<"
  target = "0.07"
  timeframe = "1h"

  [[actions.triggers]]
  indicator = "ema_9"
  operator = "cross_above"
  target = "ema_21"
  timeframe = "1h"

  [[actions.triggers]]
  indicator = "sma_50"
  operator = ">"
  target = "sma_200"
  timeframe = "1d"

Tips

Most comprehensive classical estimator

Yang-Zhang is the only classical volatility estimator that accounts for overnight (inter-candle) drift in addition to intraday range and open-close movement. This makes it the most robust single number for answering "how volatile is this market right now?" If you can only use one volatility indicator, YZ Vol gives you the most complete picture.

Accounts for inter-candle drift

Even though crypto markets trade 24/7, the open of a new candle often differs from the prior candle's close -- especially during fast-moving markets or lower-liquidity periods. Parkinson and GK Vol ignore this gap. Yang-Zhang captures it. If your strategy is sensitive to gap risk (e.g., stop-loss slippage between candles), YZ Vol is the right volatility measure to monitor.

Use for regime-based strategies

Rather than using fixed thresholds, consider building strategies around volatility regimes: low YZ Vol (squeeze) = accumulate, moderate YZ Vol = trend-follow, high YZ Vol = reduce exposure. This regime-based approach adapts naturally to changing market conditions without requiring constant threshold recalibration.

Compare all three estimators for deeper insight

Running Parkinson, GK Vol, and YZ Vol together reveals what kind of volatility the market is experiencing. If all three are similar, the market is behaving normally. If YZ Vol is significantly higher than GK Vol, inter-candle gaps are a major volatility source. If Parkinson is high but GK Vol is lower, candles have large wicks but close near their opens. These divergence patterns can inform whether to use tight stops, wide stops, or no stops at all.