OPEN-SOURCE SCRIPT
Currency Volatility Index (CVI)

This Currency Volatility Index (CVI) indicator aggregates the realized volatility of the eight “major” FX pairs into a single, tradable series—much like an FX-version of the VIX. Here’s what it does step by step:
Inputs & Settings
• Volatility Length (default 20 days): the lookback over which daily log-returns’ standard deviation is computed.
• Data Timeframe (default Daily): the resolution at which price data is fetched for each pair.
• Smoothing Length (default 5): the period of a simple moving average applied to the raw, averaged volatility (in %).
Pair-by-Pair Volatility Calculation
For each hard-coded symbol (EURUSD, GBPUSD, USDJPY, USDCHF, AUDUSD, USDCAD, NZDUSD, EURGBP):
Aggregation
The eight annualized volatilities are averaged (equal weights).
The resulting number is then multiplied by 100 to express it as a percentage.
Smoothing & Plotting
A simple moving average over the aggregated volatility smooths out spikes.
The smoothed CVI (%) is plotted as a standalone line below price charts.
Visualization Aids
A small table in the top-right corner shows each pair’s current volatility in percent.
A dynamic label on the final bar prints the latest CVI value directly on the chart.
Why use it?
Gives a one-stop measure of overall FX market turbulence.
Helps you compare “quiet” vs. “volatile” regimes across currencies.
Inputs & Settings
• Volatility Length (default 20 days): the lookback over which daily log-returns’ standard deviation is computed.
• Data Timeframe (default Daily): the resolution at which price data is fetched for each pair.
• Smoothing Length (default 5): the period of a simple moving average applied to the raw, averaged volatility (in %).
Pair-by-Pair Volatility Calculation
For each hard-coded symbol (EURUSD, GBPUSD, USDJPY, USDCHF, AUDUSD, USDCAD, NZDUSD, EURGBP):
- Pull the series of daily closes.
- Compute the series of log-returns: ln(today’s close / yesterday’s close).
- Calculate the standard deviation of those log-returns over your lookback.
- Annualize it (×√252) to convert daily volatility into an annualized figure.
Aggregation
The eight annualized volatilities are averaged (equal weights).
The resulting number is then multiplied by 100 to express it as a percentage.
Smoothing & Plotting
A simple moving average over the aggregated volatility smooths out spikes.
The smoothed CVI (%) is plotted as a standalone line below price charts.
Visualization Aids
A small table in the top-right corner shows each pair’s current volatility in percent.
A dynamic label on the final bar prints the latest CVI value directly on the chart.
Why use it?
Gives a one-stop measure of overall FX market turbulence.
Helps you compare “quiet” vs. “volatile” regimes across currencies.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.