OPEN-SOURCE SCRIPT

Currency Volatility Index (CVI)

65
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):
  1. Pull the series of daily closes.
  2. Compute the series of log-returns: ln(today’s close / yesterday’s close).
  3. Calculate the standard deviation of those log-returns over your lookback.
  4. 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.

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.