OPEN-SOURCE SCRIPT
Correlation Scanner

๐ CORRELATION SCANNER - Financial Instruments Correlation Analyzer
๐ฏ ORIGINALITY AND PURPOSE
Correlation Scanner is a professional tool for analyzing correlation relationships between different financial instruments. Unlike standard correlation indicators that show the relationship between only two instruments, this script allows you to simultaneously track the correlation of up to 10 customizable instruments with a selected base asset.
The indicator is designed for traders working with cross-market analysis, portfolio diversification, and searching for related assets for arbitrage strategies.
๐ง HOW IT WORKS
The indicator uses the built-in ta.correlation() function to calculate the Pearson correlation coefficient between instrument closing prices over a specified period. Mathematical foundation:
1. Correlation Calculation: for each instrument, the correlation coefficient with the base asset is calculated over N bars (default 60)
2. Results Sorting: instruments are automatically ranked by absolute correlation value (from strongest to weakest)
3. Visualization: results are displayed in a table with color coding:
- Green: positive correlation (instruments move in the same direction)
- Red: negative correlation (instruments move in opposite directions)
- Color intensity depends on correlation strength
4. Correlation Strength Classification:
- Very Strong (๐ช๐ช๐ช): |r| > 0.8 โ very strong relationship
- Strong (๐ช๐ช): |r| > 0.6 โ strong relationship
- Medium (๐ช): |r| > 0.4 โ medium relationship
- Weak: |r| > 0.2 โ weak relationship
- Very Weak: |r| โค 0.2 โ very weak relationship
๐ SETTINGS AND USAGE
MAIN PARAMETERS:
โข Main Instrument โ base instrument for comparison (default TVC:DXY - US Dollar Index)
โข Correlation Period โ calculation period in bars (10-500, default 60)
โข Number of Instruments to Display โ number of instruments to show (1-10)
โข Table Position โ table location on the chart
INSTRUMENT CONFIGURATION:
The indicator allows configuring up to 10 instruments for analysis. For each, you can specify:
โข Instrument โ instrument ticker (e.g., FX_IDC:EURUSD)
โข Name โ display name (emojis supported)
VISUAL SETTINGS:
โข Show Chart Label with Correlation โ display current chart's correlation with base instrument
โข Table Header Color โ table header color
โข Table Row Background โ table row background color
๐ก USAGE EXAMPLES
1. DOLLAR IMPACT ANALYSIS: set DXY as the base instrument and track how dollar index changes affect currency pairs, gold, and cryptocurrencies
2. HEDGING ASSETS SEARCH: find instruments with strong negative correlation for risk diversification
3. PAIRS TRADING: identify assets with high positive correlation to find divergences and arbitrage opportunities
4. CROSS-MARKET ANALYSIS: track relationships between stocks, bonds, commodities, and currencies
5. SYSTEMIC RISK ASSESSMENT: identify periods of increased correlation between assets, which may indicate systemic risks
โ ๏ธ IMPORTANT NOTES
โข Correlation does NOT imply causation
โข Correlation can change over time โ regularly review the analysis period
โข High past correlation doesn't guarantee the relationship will persist in the future
โข Recommended to use the indicator in combination with fundamental analysis
๐ ALERTS
The indicator includes a built-in alert condition: triggers when strong correlation (|r| > 0.8) is detected between the current chart and the base instrument.
๐ฏ ORIGINALITY AND PURPOSE
Correlation Scanner is a professional tool for analyzing correlation relationships between different financial instruments. Unlike standard correlation indicators that show the relationship between only two instruments, this script allows you to simultaneously track the correlation of up to 10 customizable instruments with a selected base asset.
The indicator is designed for traders working with cross-market analysis, portfolio diversification, and searching for related assets for arbitrage strategies.
๐ง HOW IT WORKS
The indicator uses the built-in ta.correlation() function to calculate the Pearson correlation coefficient between instrument closing prices over a specified period. Mathematical foundation:
1. Correlation Calculation: for each instrument, the correlation coefficient with the base asset is calculated over N bars (default 60)
2. Results Sorting: instruments are automatically ranked by absolute correlation value (from strongest to weakest)
3. Visualization: results are displayed in a table with color coding:
- Green: positive correlation (instruments move in the same direction)
- Red: negative correlation (instruments move in opposite directions)
- Color intensity depends on correlation strength
4. Correlation Strength Classification:
- Very Strong (๐ช๐ช๐ช): |r| > 0.8 โ very strong relationship
- Strong (๐ช๐ช): |r| > 0.6 โ strong relationship
- Medium (๐ช): |r| > 0.4 โ medium relationship
- Weak: |r| > 0.2 โ weak relationship
- Very Weak: |r| โค 0.2 โ very weak relationship
๐ SETTINGS AND USAGE
MAIN PARAMETERS:
โข Main Instrument โ base instrument for comparison (default TVC:DXY - US Dollar Index)
โข Correlation Period โ calculation period in bars (10-500, default 60)
โข Number of Instruments to Display โ number of instruments to show (1-10)
โข Table Position โ table location on the chart
INSTRUMENT CONFIGURATION:
The indicator allows configuring up to 10 instruments for analysis. For each, you can specify:
โข Instrument โ instrument ticker (e.g., FX_IDC:EURUSD)
โข Name โ display name (emojis supported)
VISUAL SETTINGS:
โข Show Chart Label with Correlation โ display current chart's correlation with base instrument
โข Table Header Color โ table header color
โข Table Row Background โ table row background color
๐ก USAGE EXAMPLES
1. DOLLAR IMPACT ANALYSIS: set DXY as the base instrument and track how dollar index changes affect currency pairs, gold, and cryptocurrencies
2. HEDGING ASSETS SEARCH: find instruments with strong negative correlation for risk diversification
3. PAIRS TRADING: identify assets with high positive correlation to find divergences and arbitrage opportunities
4. CROSS-MARKET ANALYSIS: track relationships between stocks, bonds, commodities, and currencies
5. SYSTEMIC RISK ASSESSMENT: identify periods of increased correlation between assets, which may indicate systemic risks
โ ๏ธ IMPORTANT NOTES
โข Correlation does NOT imply causation
โข Correlation can change over time โ regularly review the analysis period
โข High past correlation doesn't guarantee the relationship will persist in the future
โข Recommended to use the indicator in combination with fundamental analysis
๐ ALERTS
The indicator includes a built-in alert condition: triggers when strong correlation (|r| > 0.8) is detected between the current chart and the base instrument.
Skrip open-source
Dengan semangat TradingView yang sesungguhnya, pembuat skrip ini telah menjadikannya sebagai sumber terbuka, sehingga para trader dapat meninjau dan memverifikasi fungsinya. Salut untuk penulisnya! Meskipun Anda dapat menggunakannya secara gratis, perlu diingat bahwa penerbitan ulang kode ini tunduk pada Tata Tertib kami.
๐ Join our FREE open Telegram channel! Everyone welcome! ๐ฑโจ t.me/smart_day_trader
Pernyataan Penyangkalan
Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.
Skrip open-source
Dengan semangat TradingView yang sesungguhnya, pembuat skrip ini telah menjadikannya sebagai sumber terbuka, sehingga para trader dapat meninjau dan memverifikasi fungsinya. Salut untuk penulisnya! Meskipun Anda dapat menggunakannya secara gratis, perlu diingat bahwa penerbitan ulang kode ini tunduk pada Tata Tertib kami.
๐ Join our FREE open Telegram channel! Everyone welcome! ๐ฑโจ t.me/smart_day_trader
Pernyataan Penyangkalan
Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.