🚀🚀 PROFABIGHI_CAPITAL Correlation Heatmap System 🚀🚀

The PROFABIGHI_CAPITAL Correlation Heatmap System is an institutional-grade multi-asset correlation visualization tool engineered for cryptocurrency traders seeking to dissect inter-asset dependencies and portfolio risk clustering through dynamic, rolling correlation matrices or benchmark-focused comparisons. By computing Pearson correlation coefficients over adjustable lookback periods across up to 20 symbols, it generates color-coded heatmaps highlighting positive (green) or negative (red) relationships, while the single-asset mode benchmarks against a primary symbol (e.g., BTC) to reveal relative strength hierarchies[/b>, top/bottom extremes, and diversification insights—empowering users to optimize allocations, detect co-movement risks, or uncover decoupling opportunities in volatile markets with real-time table updates and symmetric visualizations.
This sophisticated system transcends basic scatter plots by offering dual-mode flexibility—comprehensive pairwise matrices for broad ecosystem scanning or targeted single-asset scans for focused relative analysis—complete with invalid symbol tolerance[/b>, dynamic table sizing[/b>, and performance-optimized fetching[/b>, ensuring seamless scalability from watchlists of 5 assets to full 20-symbol universes while maintaining computational efficiency and visual clarity for professional-grade decision-making.
🚀 Main Settings
- Display Mode: Core selector between 'X -> Y Matrix' for exhaustive pairwise correlation grids that reveal the full network of asset interdependencies, ideal for identifying clusters of high-beta alts or low-correlation hedges, and 'Single Asset R Comparison' for streamlined benchmarking against a chosen primary symbol, perfect for evaluating how individual tokens align or diverge from market leaders like BTC during regime shifts
- Correlation Length: Adjustable rolling window (default 30 bars) that defines the historical scope for coefficient calculations, where shorter periods emphasize recent volatility correlations for tactical adjustments and longer horizons capture structural relationships for strategic portfolio construction, balancing noise reduction with regime sensitivity
- Number of Assets in Matrix: Scalable limit (up to 20) controlling the heatmap dimensions, enabling focused 5x5 grids for core holdings or expansive 20x20 matrices for ecosystem-wide scanning, with automatic diagonal suppression (em-dashes) to avoid self-correlation artifacts and optimize visual density
📊 Single Asset R Comparison Settings
- The PROFABIGHI_CAPITAL Asset: Primary symbol designation (default BTCUSD) serving as the correlation anchor, allowing traders to assess how alts co-move with this reference during pumps, dumps, or sideways action, facilitating relative strength rankings and beta-like exposure profiling without full regressions
- Number of Assets in Main Table: Configurable count (up to 20) for the unsorted correlation list, providing a comprehensive yet manageable view of dependencies in original input order, useful for sequential portfolio reviews or quick scans of predefined watchlists
- Number of Top/Bottom Assets: Highlight limit (default 5) for dedicated tables showcasing strongest positive (top) and weakest/negative (bottom) correlations, spotlighting diversification candidates (low R) or momentum followers (high R) to guide rebalancing decisions amid market rotations
📈 Assets List (20x)
- Asset 1 through Asset 20: Sequential symbol inputs for building the correlation universe, starting with majors like BTC, ETH, SOL for baseline stability and extending to alts like XRP, ADA for diversification insights, with tooltip guidance for format (e.g., CRYPTO:BTCUSD) and flexibility for custom tokens across exchanges
- Grouped Configuration: Organized list for streamlined portfolio assembly, allowing quick swaps of underperformers or additions of emerging narratives, ensuring the heatmap reflects current market themes from blue-chips to speculative plays
- Exchange Prefix Support: Native handling of prefixed symbols (e.g., CRYPTO:, BINANCE:), enabling cross-platform comparisons without manual adjustments, while the short name extractor cleans displays for readability in dense tables
📡 Data Fetching (20x)
- Parallel Security Requests: Simultaneous close price pulls for all 20 assets using timeframe-aligned fetches, ensuring synchronized data across symbols to maintain correlation accuracy even in asynchronous market hours
- System Asset Isolation: Dedicated retrieval for the primary benchmark symbol, preventing contamination in single-mode comparisons and allowing independent updates without affecting matrix computations
- Invalid Symbol Resilience: Built-in ignore_invalid_symbol parameter with na defaults, gracefully handling malformed inputs or delisted tokens to avoid script crashes and enable partial universe analysis
- Chart Timeframe Alignment: Automatic adaptation to the active chart resolution, supporting from 1-minute intraday correlations for scalping to daily for swing trading, with consistent bar indexing for reliable rolling windows
🔧 Helper Functions
- Short Name Extractor: Utility to strip exchange prefixes and suffixes (e.g., CRYPTO:BTCUSD → BTC), generating compact labels for table headers and cells, enhancing scannability in large matrices without losing symbol identity
- Correlation Column Generator: Core function computing Pearson coefficients between two series over the specified length, returning both the value and a binary color (green for positive >0, red for negative) to streamline heatmap cell population with visual intuition
- Cell Filler Routine: Standardized table.cell wrapper applying consistent black-transparent backgrounds, small text sizing, and dynamic text colors, ensuring uniform aesthetics across all visualization modes while supporting conditional formatting for emphasis
📊 Correlation Calculations
- Pairwise Rolling Coefficients: Exhaustive computation of ta.correlation for every unique asset pair (up to 190 in 20x20 mode), generating symmetric matrices that illuminate co-movement patterns, from tight BTC-ETH linkages to decoupled niche alts, with na-safe handling for data gaps
- Single-Asset Benchmark Series: Dedicated correlations against the primary symbol for all others, producing a vector of R values that quantify relative dependencies, enabling quick identification of 'BTC clones' (high positive) or inverse hedges (negative)
- Length-Parameterized Rolling: Each coefficient uses the user-defined lookback to filter transient noise, where 20-bar windows highlight short-term spillovers and 100-bar captures enduring regime correlations for long-term allocation
- Color Mapping Logic: Binary green/red assignment based on sign (positive/negative), providing immediate visual cues for diversification (seek reds) or momentum trading (cluster greens), with potential for gradient extensions in future iterations
- Diagonal Suppression: Automatic em-dash placement on self-correlations (always 1.0), avoiding redundant cells and centering focus on inter-asset insights in the heatmap grid
🎨 Visualization Logic
- Last-Bar Dynamic Refresh: Table recreation on barstate.islast with prior deletions to prevent accumulation, ensuring crisp updates without historical artifacts or memory bloat in extended sessions
- Branding Banner Table: Bottom-center single-cell overlay with bold, yellow-texted indicator title on black background, serving as persistent identifier and visual anchor amid multi-table layouts
- Matrix Heatmap Construction: Centered (num_assets+1)x(num_assets+1) table with gray borders, populating headers vertically/horizontally with short names, filling off-diagonals with formatted R values and sign-based colors for symmetric, at-a-glance dependency mapping
- Single-Mode Multi-Table Suite: Top-center primary asset highlight (yellow-bordered), middle-center unsorted main list for sequential review, left/right top/bottom sorted subsets for extreme correlation spotlights, all with gray headers and color-coded R cells
- Progressive Cell Population: Nested conditionals scaling fills to active asset count, ensuring partial matrices render cleanly while full 20x20 grids showcase exhaustive pairwise analysis without overflow
- Error Handling Label: Fallback red downward label when no valid correlations available, prompting data checks and preventing blank displays in edge cases like all-invalid symbols
✅ Key Takeaways
- Dual-Mode Versatility: Seamlessly toggles between exhaustive pairwise heatmaps for ecosystem mapping and single-asset benchmarks for relative strength profiling, adapting to tactical or strategic analysis needs
- Rolling Correlation Insights: Adjustable windows reveal dynamic dependencies, crucial for spotting co-crash risks (high positive R) or counter-trend hedges (negative R) in crypto's correlated environments
- Visual Heatmap Efficiency: Color gradients and symmetric layouts enable instant pattern recognition, from BTC-beta clusters to low-R diversification gems, accelerating portfolio optimization
- Scalable Asset Handling: Up to 20 symbols with invalid tolerance and dynamic sizing, supporting watchlist scans without performance hits or manual exclusions
- Top/Bottom Extremes: Dedicated tables flag strongest/weakest links, guiding quick rebalances toward uncorrelated assets for reduced drawdowns or amplified momentum plays
- Benchmark-Centric Flexibility: Custom primary symbol centers analysis on user priorities like ETH for DeFi focus, transforming raw R values into actionable relative performance hierarchies
Script sob convite
Somente usuários aprovados pelo autor podem acessar este script. Você precisará solicitar e obter permissão para usá-lo. Normalmente, essa permissão é concedida após o pagamento. Para obter mais detalhes, siga as instruções do autor abaixo ou entre em contato diretamente com PROFABIGHI_CAPITAL.
O TradingView NÃO recomenda pagar ou usar um script ao não ser que você confie totalmente no seu autor e compreende como isso funciona. Você pode também encontrar alternativas gratuitas e de código aberto em nossa comunidade de scripts.
Instruções do autor
Aviso legal
Script sob convite
Somente usuários aprovados pelo autor podem acessar este script. Você precisará solicitar e obter permissão para usá-lo. Normalmente, essa permissão é concedida após o pagamento. Para obter mais detalhes, siga as instruções do autor abaixo ou entre em contato diretamente com PROFABIGHI_CAPITAL.
O TradingView NÃO recomenda pagar ou usar um script ao não ser que você confie totalmente no seu autor e compreende como isso funciona. Você pode também encontrar alternativas gratuitas e de código aberto em nossa comunidade de scripts.