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.
開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。
開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。