OPEN-SOURCE SCRIPT

Yang-Zhang Volatility (YZVol) by CoryP1990 – Quant Toolkit

74
The Yang-Zhang Volatility (YZVol) estimator measures realized volatility using both overnight gaps and intraday moves. It combines three components: overnight returns, open-to-close returns, and the Rogers–Satchell term, weighted by Zhang’s k to reduce bias.

How to read it

Line color: Green when YZVol is rising (volatility expansion), Red when falling (volatility compression).

Background: Green tint = above High-vol threshold (active regime). Red tint = below Low-vol threshold (quiet regime).

Units: Displays Daily % by default on any timeframe (values are normalized to daily). An optional toggle shows Annualized % (√252 × Daily %).

Typical uses

Spot transitions between quiet and active regimes.

Compare realized vol vs implied vol or a risk-target.

Adapt position sizing to volatility clustering.

Defaults

Length = 20

High-vol threshold = 5% (Daily)

Low-vol threshold = 1% (Daily)

Optional: Annualized % display

Example — SPY (1D)

During the 2020 crash, YZVol surged to 5.8 % per day, capturing the height of pandemic-era volatility before compressing into a calm regime through 2021. Volatility re-expanded in 2022 due to reinflamed COVID fears and gradually stabilized through 2023. A sharp, liquidity-driven volatility event in August 2024 caused another brief YZVol surge, reflecting the historic one-day VIX spike triggered by market-wide risk-off flows and thin pre-market liquidity. A second, policy-driven expansion followed in April–May 2025, coinciding with the renewed U.S.–China tariff conflict and a sharp equity pullback. Since mid-2025, YZVol has settled near 1 % per day, with the red background confirming that realized volatility has once again compressed into a quiet, low-risk regime.

Part of the Quant Toolkit — transparent, open-source indicators for modern quantitative analysis. Built by CoryP1990.

Clause de non-responsabilité

Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.