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.
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน