OPEN-SOURCE SCRIPT
VRP IV vs Realised Vol

**Indicator name:** VRP — IV vs Realised Vol
---
**What it calculates:**
**Line 1 — India VIX (IV)**
It pulls the daily closing value of India VIX directly from TradingView using `request.security("INDIAVIX", "D", close)`. This is your implied volatility — what the market expects NIFTY to move annually.
**Line 2 — 20-day Realised Volatility (RV)**
It calculates the actual movement of NIFTY over the past 20 trading days using log returns. The formula is: standard deviation of daily log returns × √252 × 100. This converts daily movement into an annualised percentage — same unit as VIX so you can compare them directly.
**Line 3 — VRP**
It subtracts RV from IV. The result is plotted as a histogram.
---
**What you see on screen:**
- **Green bar** — VIX is above 20-day RV. IV is overpricing actual movement. Selling has structural edge. Enter trades.
- **Red bar** — VIX is below 20-day RV. IV is underpricing actual movement. No edge. Skip the week.
- **Zero line** — the crossover point. Green above, red below.
---
**How to read it practically:**
| Bar colour | What it means | Action |
|---|---|---|
| Green and tall | High VRP — IV significantly above RV | Strong edge — full size |
| Green and small | Low positive VRP — IV slightly above RV | Weak edge — half size |
| Red | Negative VRP — IV below RV | No edge — sit out |
---
**One important limitation:**
VIX is a 30-day forward looking measure. RV is a 20-day backward looking measure. They are not perfectly matched in time horizon — but this is the most practical comparison available on TradingView without complex calculations. The signal is directionally correct even if not perfectly precise.
Skrypt open-source
W zgodzie z duchem TradingView twórca tego skryptu udostępnił go jako open-source, aby użytkownicy mogli przejrzeć i zweryfikować jego działanie. Ukłony dla autora. Korzystanie jest bezpłatne, jednak ponowna publikacja kodu podlega naszym Zasadom serwisu.
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.
Skrypt open-source
W zgodzie z duchem TradingView twórca tego skryptu udostępnił go jako open-source, aby użytkownicy mogli przejrzeć i zweryfikować jego działanie. Ukłony dla autora. Korzystanie jest bezpłatne, jednak ponowna publikacja kodu podlega naszym Zasadom serwisu.
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.