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.
Script de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.
Script de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.