OPEN-SOURCE SCRIPT
Regime Correlation Matrix

Regime Correlation Matrix — TradingView Indicator
This indicator displays a real-time rolling Pearson correlation table between NQ (or any base chart symbol) and seven macro instruments: ES, CL (Crude Oil), 6C (Canadian Dollar), HG (Copper), GC (Gold), ZN (10-Year Treasury), and USD/CNH (Offshore Chinese Yuan). Each row shows the correlation coefficient, a dot-strength rating, and an auto-generated regime interpretation label.
Designed for intraday regime diagnosis. The default length of 78 bars covers one full RTH session on a 5-minute chart. Reducing to 20 bars produces a responsive rolling 2-hour window for real-time session reads. Increasing to 390 bars covers a full trading week for macro regime-level analysis.
Color coding: Bright green = strong positive correlation (r ≥ 0.6). Faded green = weak positive (r ≥ 0.2). Bright red = strong negative (r ≤ -0.6). Faded red = weak negative (r ≤ -0.2). Gray = neutral / no meaningful correlation.
Regime interpretation logic is instrument-specific:
CL: positive correlation = risk-on or geopolitical supply bid. Negative = stagflation regime, CL is the headwind.
6C: positive = tariff relief being priced. Negative = tariff fear active.
HG (Copper): positive = global growth and trade normalization. Negative = demand destruction.
GC (Gold): negative correlation to equities = uncertainty bid active, market does not trust the rally.
ZN (Bonds): negative = inflation/risk-on. Positive = deflation/risk-off flight to safety.
USD/CNH: this row is inverse — USD/CNH rising means CNH is weakening, meaning tariff fear is active. A negative correlation between NQ and USD/CNH therefore signals tariff relief. The regime label accounts for this inversion automatically.
ES: correlation to NQ reads index cohesion. Below 0.6 flags potential decoupling. Readings below 0.2 trigger a DECOUPLED label — the primary signal that session precision will be degraded and size should be reduced.
Primary use cases: Pre-session regime check, intraday regime shift detection, confirmation before adding size to a directional position, and identification of decoupled sessions where full-size trading is inappropriate. The footer row displays the current bar length, timeframe, and base symbol so the context is always visible at a glance.
This indicator displays a real-time rolling Pearson correlation table between NQ (or any base chart symbol) and seven macro instruments: ES, CL (Crude Oil), 6C (Canadian Dollar), HG (Copper), GC (Gold), ZN (10-Year Treasury), and USD/CNH (Offshore Chinese Yuan). Each row shows the correlation coefficient, a dot-strength rating, and an auto-generated regime interpretation label.
Designed for intraday regime diagnosis. The default length of 78 bars covers one full RTH session on a 5-minute chart. Reducing to 20 bars produces a responsive rolling 2-hour window for real-time session reads. Increasing to 390 bars covers a full trading week for macro regime-level analysis.
Color coding: Bright green = strong positive correlation (r ≥ 0.6). Faded green = weak positive (r ≥ 0.2). Bright red = strong negative (r ≤ -0.6). Faded red = weak negative (r ≤ -0.2). Gray = neutral / no meaningful correlation.
Regime interpretation logic is instrument-specific:
CL: positive correlation = risk-on or geopolitical supply bid. Negative = stagflation regime, CL is the headwind.
6C: positive = tariff relief being priced. Negative = tariff fear active.
HG (Copper): positive = global growth and trade normalization. Negative = demand destruction.
GC (Gold): negative correlation to equities = uncertainty bid active, market does not trust the rally.
ZN (Bonds): negative = inflation/risk-on. Positive = deflation/risk-off flight to safety.
USD/CNH: this row is inverse — USD/CNH rising means CNH is weakening, meaning tariff fear is active. A negative correlation between NQ and USD/CNH therefore signals tariff relief. The regime label accounts for this inversion automatically.
ES: correlation to NQ reads index cohesion. Below 0.6 flags potential decoupling. Readings below 0.2 trigger a DECOUPLED label — the primary signal that session precision will be degraded and size should be reduced.
Primary use cases: Pre-session regime check, intraday regime shift detection, confirmation before adding size to a directional position, and identification of decoupled sessions where full-size trading is inappropriate. The footer row displays the current bar length, timeframe, and base symbol so the context is always visible at a glance.
Script de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que cualquier republicación del código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como, asesoramiento o recomendaciones financieras, de inversión, de trading u otro tipo, proporcionadas o respaldadas por TradingView. Obtenga más información en Condiciones de uso.
Script de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que cualquier republicación del código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como, asesoramiento o recomendaciones financieras, de inversión, de trading u otro tipo, proporcionadas o respaldadas por TradingView. Obtenga más información en Condiciones de uso.