OPEN-SOURCE SCRIPT
Cập nhật Variance Risk Premium Oscillator

Variance Risk Premium Oscillator
What it does
The Variance Risk Premium Oscillator measures the gap between implied volatility (a volatility index such as India VIX) and realized volatility, scaled in standard-deviation (σ) units. That gap — the variance risk premium (VRP) — tells you whether option protection is currently rich (expensive, complacent) or cheap (underpriced, stressed). A vol-of-vol read is shown alongside as an instability gauge.
Why this is different (and original)
Most volatility tools on charts forecast or display realized volatility (ATR, standard-deviation bands, historical-vol plots). This one reads something different: the price of volatility insurance. Decades of research show implied volatility systematically exceeds the volatility that is subsequently realized, so the premium is, on average, positive — investors pay up for protection. When that premium stretches unusually high, protection is expensive and the crowd is complacent; when it collapses or turns negative, fear is being paid for and volatility is cheap. Presenting this premium as a clean, self-normalizing mean-reversion oscillator with a built-in edge test is what makes it original — it is not a realized-vol band and not a VIX plot.
How it works
Realized volatility = annualized standard deviation of log-returns over the chosen window.
Implied volatility = the volatility index you point it at.
VRP = Implied − Realized.
The VRP series is z-scored over the normalization window into the σ oscillator. Vol-of-vol (the standard deviation of the implied index) is tracked separately as an instability read in the dashboard.
How to use it
Above the upper (red) band = vol RICH / complacency — protection expensive.
Below the lower (green) band = vol CHEAP / stress — protection underpriced.
Turns out of an extreme (triangles) are the mean-reversion events: a turn up from the cheap zone often coincides with stress easing; a turn down from the rich zone with complacency ending.
Read the EDGE row. The harness checks whether, after a cheap-zone turn, price actually rallied (and after a rich-zone turn, faded) by ≥ k×ATR within the horizon, versus the unconditional Base %. EDGE = Hit − Base. If it is near zero on your market, the mean-reversion read is not paying there.
Settings guide
01 · Data & Volatility — implied-vol symbol, realized-vol length, annualization (252 for daily; bars-per-year for intraday), vol-of-vol length, universal price source.
02 · Normalization — z-score window, output smoothing.
03 · Calibration — horizon, favourable-move threshold (×ATR), base-rate window.
04 · Bands — stretch and extreme σ bands; divergence pivot.
05 · Display & Theme — visual style, regime tint, dashboard, colors.
Non-repaint
The implied-vol index is requested with lookahead_off and settles on its bar's close — no future leak.
Concept credit
Variance risk premium and its return predictability — Bakshi & Kapadia (2003); Carr & Wu (2009); Bollerslev, Tauchen & Zhou (2009); Coval & Shumway (2001).
Disclaimer
For research and education only. Not financial advice, not a recommendation, and not a guarantee of future results. A stretched premium does not guarantee reversion — regimes can stay rich or cheap for long stretches. All statistics are in-sample, close-to-close, and exclude costs. Do your own research and manage your own risk.
What it does
The Variance Risk Premium Oscillator measures the gap between implied volatility (a volatility index such as India VIX) and realized volatility, scaled in standard-deviation (σ) units. That gap — the variance risk premium (VRP) — tells you whether option protection is currently rich (expensive, complacent) or cheap (underpriced, stressed). A vol-of-vol read is shown alongside as an instability gauge.
Why this is different (and original)
Most volatility tools on charts forecast or display realized volatility (ATR, standard-deviation bands, historical-vol plots). This one reads something different: the price of volatility insurance. Decades of research show implied volatility systematically exceeds the volatility that is subsequently realized, so the premium is, on average, positive — investors pay up for protection. When that premium stretches unusually high, protection is expensive and the crowd is complacent; when it collapses or turns negative, fear is being paid for and volatility is cheap. Presenting this premium as a clean, self-normalizing mean-reversion oscillator with a built-in edge test is what makes it original — it is not a realized-vol band and not a VIX plot.
How it works
Realized volatility = annualized standard deviation of log-returns over the chosen window.
Implied volatility = the volatility index you point it at.
VRP = Implied − Realized.
The VRP series is z-scored over the normalization window into the σ oscillator. Vol-of-vol (the standard deviation of the implied index) is tracked separately as an instability read in the dashboard.
How to use it
Above the upper (red) band = vol RICH / complacency — protection expensive.
Below the lower (green) band = vol CHEAP / stress — protection underpriced.
Turns out of an extreme (triangles) are the mean-reversion events: a turn up from the cheap zone often coincides with stress easing; a turn down from the rich zone with complacency ending.
Read the EDGE row. The harness checks whether, after a cheap-zone turn, price actually rallied (and after a rich-zone turn, faded) by ≥ k×ATR within the horizon, versus the unconditional Base %. EDGE = Hit − Base. If it is near zero on your market, the mean-reversion read is not paying there.
Settings guide
01 · Data & Volatility — implied-vol symbol, realized-vol length, annualization (252 for daily; bars-per-year for intraday), vol-of-vol length, universal price source.
02 · Normalization — z-score window, output smoothing.
03 · Calibration — horizon, favourable-move threshold (×ATR), base-rate window.
04 · Bands — stretch and extreme σ bands; divergence pivot.
05 · Display & Theme — visual style, regime tint, dashboard, colors.
Non-repaint
The implied-vol index is requested with lookahead_off and settles on its bar's close — no future leak.
Concept credit
Variance risk premium and its return predictability — Bakshi & Kapadia (2003); Carr & Wu (2009); Bollerslev, Tauchen & Zhou (2009); Coval & Shumway (2001).
Disclaimer
For research and education only. Not financial advice, not a recommendation, and not a guarantee of future results. A stretched premium does not guarantee reversion — regimes can stay rich or cheap for long stretches. All statistics are in-sample, close-to-close, and exclude costs. Do your own research and manage your own risk.
Phát hành các Ghi chú
Variance Risk Premium / Vol-of-Vol Oscillator (short name: VRP / Vol-of-Vol)New in this update — downside vs upside variance. Realized volatility is now split into its downside and upside halves, and the premium is reported separately for each. Research on the variance risk premium finds the downside portion carries most of the return-predictive information, so seeing it on its own is more informative than the single blended premium.
New dashboard rows: Down VRP, Edge floor.
New exports: EXP_Bias, EXP_VRP, EXP_DownVRP, EXP_UpVRP, EXP_DownShare, EXP_VoV, EXP_Edge, EXP_EdgeLB, EXP_RunsZ.
Honest note: this is a realized-semivariance split of the premium, not a full option-surface decomposition — a transparent, defensible approximation. A stretched premium does not guarantee reversion.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.