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.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.