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

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.
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.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Quant finance researcher focused on options, volatility modeling, and derivative pricing. Building tools that turn complex market behavior into clear, data-driven insights. Explore analytics and modeling at OptionsAnalysisSuite.com
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Quant finance researcher focused on options, volatility modeling, and derivative pricing. Building tools that turn complex market behavior into clear, data-driven insights. Explore analytics and modeling at OptionsAnalysisSuite.com
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.