OPEN-SOURCE SCRIPT
IV vs RV Volatility Cones

What it does
It draws two cones around the same anchor price. One is built from implied volatility, read from India VIX. The other is built from realized volatility, measured on weekly bars of the chart symbol. Both are scaled to the same horizon and drawn with the same geometry, so their widths are directly comparable.
Where the implied cone is wider than the realized cone, the option market was charging for more movement than the index actually delivered. Where it is narrower, the index outran what options were priced for. That gap is the variance risk premium, and it is the whole point of the indicator.
Two cones, two jobs
The historical cone is anchored to a weekly close one horizon in the past, so the whole four-week journey sits inside it and you can see how it resolved. Price finishing outside the realized cone means the index moved further than its own recent volatility said it usually does. Price finishing outside the implied cone means it moved further than options had paid for.
The forward cone starts at the current bar and projects one horizon ahead, using the latest confirmed weekly volatility reading. It is a distribution, not a forecast of direction.
How it is calculated
Implied leg. India VIX is an annualised implied volatility quoted in percentage points. It is rescaled to the horizon by the square root of the horizon over 52.
Realized leg. Weekly log returns are measured over the lookback, then scaled to the horizon by the square root of the number of weeks. Three estimators:
Yang-Zhang, the default. It combines the weekend-gap variance, the open-to-close variance and the Rogers-Satchell range term, weighted by the standard k factor. It uses the whole weekly bar and is the most efficient and most drift-independent of the three.
Std Dev. Sample standard deviation of weekly close-to-close log returns. Simple, and blind to everything inside the week.
ATR%. Weekly Average True Range as a fraction of price, times a user-set factor. Range-aware, but the factor is a convention rather than a derivation.
Both cones use the same geometry, lognormal by default, so a difference in width is a difference in volatility and nothing else.
Reading the panel
The readout gives the one-sigma figure for each leg in percent, the resulting price cone for each, and the ratio of the two. A verdict line calls the ratio rich, fair or cheap against thresholds you set. Rich means implied is running above realized. That is the normal state for an index, so the useful signal is the size of the gap and its direction of travel, not its sign.
Timeframes
All volatility maths runs in the weekly context, so the values are identical on a 15-minute chart and a weekly chart. Use any timeframe up to Weekly. Above Weekly the indicator disables itself and says so, because a weekly request from a monthly chart returns partial bars.
Alerts
Four are provided: implied crossing above the rich threshold, implied crossing below the cheap threshold, and price closing outside the realized cone in either direction.
Limitations, stated plainly
India VIX measures implied volatility on NIFTY 50. Point the implied source at something else and you are comparing one instrument's implied volatility against another's realized volatility, which means nothing. The input exists so you can pair a different index with its own volatility index, not so you can run this on any symbol.
One sigma is a description of a distribution, not a boundary. Roughly one period in three should finish outside a well-calibrated one-sigma cone. Bands being broken is expected behaviour, not a signal.
Square-root-of-time scaling assumes weekly returns are independent. Real index returns cluster in volatility, so the scaling understates the tails during a stress regime and overstates them coming out of one.
The implied leg uses a single at-the-money-ish volatility number and ignores skew, so it will understate downside and overstate upside relative to what the option surface actually prices.
Realized volatility is backward-looking by construction. It tells you what just happened, not what is about to.
This plots volatility. It produces no directional signal, no entries and no exits.
Not financial advice. For education and research only.
It draws two cones around the same anchor price. One is built from implied volatility, read from India VIX. The other is built from realized volatility, measured on weekly bars of the chart symbol. Both are scaled to the same horizon and drawn with the same geometry, so their widths are directly comparable.
Where the implied cone is wider than the realized cone, the option market was charging for more movement than the index actually delivered. Where it is narrower, the index outran what options were priced for. That gap is the variance risk premium, and it is the whole point of the indicator.
Two cones, two jobs
The historical cone is anchored to a weekly close one horizon in the past, so the whole four-week journey sits inside it and you can see how it resolved. Price finishing outside the realized cone means the index moved further than its own recent volatility said it usually does. Price finishing outside the implied cone means it moved further than options had paid for.
The forward cone starts at the current bar and projects one horizon ahead, using the latest confirmed weekly volatility reading. It is a distribution, not a forecast of direction.
How it is calculated
Implied leg. India VIX is an annualised implied volatility quoted in percentage points. It is rescaled to the horizon by the square root of the horizon over 52.
Realized leg. Weekly log returns are measured over the lookback, then scaled to the horizon by the square root of the number of weeks. Three estimators:
Yang-Zhang, the default. It combines the weekend-gap variance, the open-to-close variance and the Rogers-Satchell range term, weighted by the standard k factor. It uses the whole weekly bar and is the most efficient and most drift-independent of the three.
Std Dev. Sample standard deviation of weekly close-to-close log returns. Simple, and blind to everything inside the week.
ATR%. Weekly Average True Range as a fraction of price, times a user-set factor. Range-aware, but the factor is a convention rather than a derivation.
Both cones use the same geometry, lognormal by default, so a difference in width is a difference in volatility and nothing else.
Reading the panel
The readout gives the one-sigma figure for each leg in percent, the resulting price cone for each, and the ratio of the two. A verdict line calls the ratio rich, fair or cheap against thresholds you set. Rich means implied is running above realized. That is the normal state for an index, so the useful signal is the size of the gap and its direction of travel, not its sign.
Timeframes
All volatility maths runs in the weekly context, so the values are identical on a 15-minute chart and a weekly chart. Use any timeframe up to Weekly. Above Weekly the indicator disables itself and says so, because a weekly request from a monthly chart returns partial bars.
Alerts
Four are provided: implied crossing above the rich threshold, implied crossing below the cheap threshold, and price closing outside the realized cone in either direction.
Limitations, stated plainly
India VIX measures implied volatility on NIFTY 50. Point the implied source at something else and you are comparing one instrument's implied volatility against another's realized volatility, which means nothing. The input exists so you can pair a different index with its own volatility index, not so you can run this on any symbol.
One sigma is a description of a distribution, not a boundary. Roughly one period in three should finish outside a well-calibrated one-sigma cone. Bands being broken is expected behaviour, not a signal.
Square-root-of-time scaling assumes weekly returns are independent. Real index returns cluster in volatility, so the scaling understates the tails during a stress regime and overstates them coming out of one.
The implied leg uses a single at-the-money-ish volatility number and ignores skew, so it will understate downside and overstate upside relative to what the option surface actually prices.
Realized volatility is backward-looking by construction. It tells you what just happened, not what is about to.
This plots volatility. It produces no directional signal, no entries and no exits.
Not financial advice. For education and research only.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.