OPEN-SOURCE SCRIPT
Global Risk Terminal – Multi-Asset Macro Sentiment Indicator

Description:
The Global Risk Terminal is a sophisticated macro sentiment indicator that synthesizes signals from three key cross-asset relationships to produce a single, actionable risk appetite score. It is designed to help traders and investors identify whether global markets are in a risk-on (growth-seeking) or risk-off (defensive) regime. The indicator analyzes the behavior of commodities, equities, bonds, and currencies to generate a comprehensive view of market conditions.

Indicator Output:
The Global Risk Terminal produces a normalized risk score ranging from -1 to +1:
Positive values indicate risk-on conditions (growth assets favored)
Negative values indicate risk-off conditions (safe-haven assets favored)
Core Components:
Growth Pulse (Copper to Gold Ratio, HG/GC)
Purpose: Measures investor preference for industrial growth versus safe-haven assets.
Interpretation:
Rising ratio → Copper outperforming gold → Risk-on environment
Falling ratio → Gold outperforming copper → Risk-off environment
Flat ratio → Transitional market phase
Technical Implementation: Dual moving average slope method (fast MA default 20, slow MA default 40). Positive slope = +1, negative slope = -1, flat slope = 0
Equity Rotation (Russell 2000 to S&P 500 Ratio, RTY/ES)
Purpose: Tracks rotation between small-cap and large-cap equities, revealing market risk appetite.
Interpretation:
Rising ratio → Small-caps outperforming → Strong risk-on
Falling ratio → Large-caps outperforming → Defensive positioning
Technical Implementation: Dual moving average slope method (same as Growth Pulse)
Flow Gauge (10-Year Treasury to US Dollar Index, ZN/DXY)
Purpose: Captures liquidity conditions and cross-asset capital flows.
Interpretation:
Rising ratio → Treasury prices rising or USD weakening → Liquidity expansion, risk-on environment
Falling ratio → Treasury prices falling or USD strengthening → Liquidity contraction, risk-off environment
Technical Implementation: Dual moving average slope method
Composite Risk Score Calculation:
Analyze each component for trend using dual moving averages
Assign signal values: +1 (risk-on), -1 (risk-off), 0 (neutral)
Average the three signals:
Risk Score = (Growth Pulse + Equity Rotation + Flow Gauge) / 3
Optional smoothing with exponential moving average (default 3 periods) to reduce noise
Interpreting the Risk Score:
+0.66 to +1.0: Full risk-on – favor cyclical sectors, small-caps, growth strategies
+0.33 to +0.66: Moderate risk-on – mostly bullish environment, watch for fading momentum
-0.33 to +0.33: Neutral/transition – markets in flux, signals mixed, exercise caution
-0.66 to -0.33: Cautious risk-off – favor defensive sectors, reduce high-beta exposure
-1.0 to -0.66: Full risk-off – strong defensive positioning, prioritize safe-haven assets
How to Use the Global Risk Terminal to Frame Trades:
Aligning Trades with Market Regime
Risk-On (+0.33 and above): Look for buying opportunities in cyclical stocks, high-beta equities, commodities, and emerging markets. Use long entries for swing trades or intraday positions, following confirmed price action.
Risk-Off (-0.33 and below): Shift focus to defensive sectors, large-cap quality stocks, U.S. Treasuries, and safe-haven currencies. Prefer short entries or reduced exposure in risky assets.
Entry and Exit Framing
Use the risk score as a macro filter before executing trades:
Example: The risk score is +0.7 (strong risk-on). Prefer long positions in equities or commodities that are showing bullish confirmation on your regular chart.
Conversely, if the risk score is -0.7 (strong risk-off), avoid aggressive longs and consider short or defensive trades.
Watch for threshold crossings (+/-0.33, +/-0.66) as potential inflection points for adjusting position size, stop-loss levels, or sector rotation.
Confirming Trade Decisions
Combine the Global Risk Terminal with price action, volume, and trend indicators:
If equities rally but the risk score is declining, this may indicate a fragile rally driven by few leaders—trade cautiously.
If equities fall but the risk score is rising, consider counter-trend entries or buying dips.
Risk Management and Position Sizing
Strong alignment across components → increase position size and hold with wider stops
Mixed or neutral signals → reduce exposure, tighten stops, or avoid new trades
Defensive regimes → rotate into stable, low-volatility assets and increase cash buffer
Framing Trades Across Timeframes
Use the indicator as a strategic guide rather than a precise timing tool. Even without the MTF table:
Daily trend alignment → Guide swing trade bias
Shorter timeframe price action → Refine entry points and stop placement
Example: Daily chart shows +0.6 risk score → identify high-probability long setups using intraday technical patterns (breakouts, trend continuation).
Sector and Asset Rotation
Risk-On: Focus on cyclical sectors (financials, industrials, materials, energy), small-caps, high-beta instruments
Risk-Off: Focus on defensive sectors (utilities, consumer staples, healthcare), large-caps, safe-haven instruments
Alert Integration
Set alerts on the risk score to notify you when markets move from neutral to risk-on or risk-off regimes. Use these alerts to plan entries, exits, or portfolio adjustments in advance.
Customization Options:
Moving Average Length (5–100): Adjust sensitivity of trend detection
Score Smoothing (1–10): Reduce noise or see raw risk score
Visual Themes: Six preset themes (Cyber, Ocean, Sunset, Monochrome, Matrix, Custom)
Display Options: Show or hide component dashboards, main header, risk level lines, gradient fill, and component signals
Label Size: Tiny, Small, Normal, Large
Alert Conditions:
Risk score crosses above +0.66 → Strong risk-on
Risk score crosses below -0.66 → Strong risk-off
Risk score crosses zero → Neutral line
Risk score crosses above +0.33 → Moderate risk-on
Risk score crosses below -0.33 → Moderate risk-off
Data Sources:
HG1! – Copper Futures (COMEX)
GC1! – Gold Futures (COMEX)
RTY1! – Russell 2000 E-mini Futures (CME)
ES1! – S&P 500 E-mini Futures (CME)
ZN1! – 10-Year U.S. Treasury Note Futures (CBOT)
DXY – U.S. Dollar Index (ICE)
Notes and Limitations:
Works best during clear macro regimes and aligned trends
Use with price action, volume, and other technical tools
Not a standalone trading system; serves as a macro context filter
Equal weighting assumes all three components are equally important, but market conditions may vary
Past performance does not guarantee future results
Conclusion:
The Global Risk Terminal consolidates complex cross-asset signals into a simple, actionable score that informs market regime, portfolio positioning, sector rotation, and trading decisions. Its user-friendly layout and extensive customization options make it suitable for traders of all experience levels seeking macro-driven insights. By framing trades around risk score thresholds and combining macro context with tactical execution, traders can identify higher-probability opportunities and optimize position sizing, entries, and exits across a wide range of market conditions.
The Global Risk Terminal is a sophisticated macro sentiment indicator that synthesizes signals from three key cross-asset relationships to produce a single, actionable risk appetite score. It is designed to help traders and investors identify whether global markets are in a risk-on (growth-seeking) or risk-off (defensive) regime. The indicator analyzes the behavior of commodities, equities, bonds, and currencies to generate a comprehensive view of market conditions.
Indicator Output:
The Global Risk Terminal produces a normalized risk score ranging from -1 to +1:
Positive values indicate risk-on conditions (growth assets favored)
Negative values indicate risk-off conditions (safe-haven assets favored)
Core Components:
Growth Pulse (Copper to Gold Ratio, HG/GC)
Purpose: Measures investor preference for industrial growth versus safe-haven assets.
Interpretation:
Rising ratio → Copper outperforming gold → Risk-on environment
Falling ratio → Gold outperforming copper → Risk-off environment
Flat ratio → Transitional market phase
Technical Implementation: Dual moving average slope method (fast MA default 20, slow MA default 40). Positive slope = +1, negative slope = -1, flat slope = 0
Equity Rotation (Russell 2000 to S&P 500 Ratio, RTY/ES)
Purpose: Tracks rotation between small-cap and large-cap equities, revealing market risk appetite.
Interpretation:
Rising ratio → Small-caps outperforming → Strong risk-on
Falling ratio → Large-caps outperforming → Defensive positioning
Technical Implementation: Dual moving average slope method (same as Growth Pulse)
Flow Gauge (10-Year Treasury to US Dollar Index, ZN/DXY)
Purpose: Captures liquidity conditions and cross-asset capital flows.
Interpretation:
Rising ratio → Treasury prices rising or USD weakening → Liquidity expansion, risk-on environment
Falling ratio → Treasury prices falling or USD strengthening → Liquidity contraction, risk-off environment
Technical Implementation: Dual moving average slope method
Composite Risk Score Calculation:
Analyze each component for trend using dual moving averages
Assign signal values: +1 (risk-on), -1 (risk-off), 0 (neutral)
Average the three signals:
Risk Score = (Growth Pulse + Equity Rotation + Flow Gauge) / 3
Optional smoothing with exponential moving average (default 3 periods) to reduce noise
Interpreting the Risk Score:
+0.66 to +1.0: Full risk-on – favor cyclical sectors, small-caps, growth strategies
+0.33 to +0.66: Moderate risk-on – mostly bullish environment, watch for fading momentum
-0.33 to +0.33: Neutral/transition – markets in flux, signals mixed, exercise caution
-0.66 to -0.33: Cautious risk-off – favor defensive sectors, reduce high-beta exposure
-1.0 to -0.66: Full risk-off – strong defensive positioning, prioritize safe-haven assets
How to Use the Global Risk Terminal to Frame Trades:
Aligning Trades with Market Regime
Risk-On (+0.33 and above): Look for buying opportunities in cyclical stocks, high-beta equities, commodities, and emerging markets. Use long entries for swing trades or intraday positions, following confirmed price action.
Risk-Off (-0.33 and below): Shift focus to defensive sectors, large-cap quality stocks, U.S. Treasuries, and safe-haven currencies. Prefer short entries or reduced exposure in risky assets.
Entry and Exit Framing
Use the risk score as a macro filter before executing trades:
Example: The risk score is +0.7 (strong risk-on). Prefer long positions in equities or commodities that are showing bullish confirmation on your regular chart.
Conversely, if the risk score is -0.7 (strong risk-off), avoid aggressive longs and consider short or defensive trades.
Watch for threshold crossings (+/-0.33, +/-0.66) as potential inflection points for adjusting position size, stop-loss levels, or sector rotation.
Confirming Trade Decisions
Combine the Global Risk Terminal with price action, volume, and trend indicators:
If equities rally but the risk score is declining, this may indicate a fragile rally driven by few leaders—trade cautiously.
If equities fall but the risk score is rising, consider counter-trend entries or buying dips.
Risk Management and Position Sizing
Strong alignment across components → increase position size and hold with wider stops
Mixed or neutral signals → reduce exposure, tighten stops, or avoid new trades
Defensive regimes → rotate into stable, low-volatility assets and increase cash buffer
Framing Trades Across Timeframes
Use the indicator as a strategic guide rather than a precise timing tool. Even without the MTF table:
Daily trend alignment → Guide swing trade bias
Shorter timeframe price action → Refine entry points and stop placement
Example: Daily chart shows +0.6 risk score → identify high-probability long setups using intraday technical patterns (breakouts, trend continuation).
Sector and Asset Rotation
Risk-On: Focus on cyclical sectors (financials, industrials, materials, energy), small-caps, high-beta instruments
Risk-Off: Focus on defensive sectors (utilities, consumer staples, healthcare), large-caps, safe-haven instruments
Alert Integration
Set alerts on the risk score to notify you when markets move from neutral to risk-on or risk-off regimes. Use these alerts to plan entries, exits, or portfolio adjustments in advance.
Customization Options:
Moving Average Length (5–100): Adjust sensitivity of trend detection
Score Smoothing (1–10): Reduce noise or see raw risk score
Visual Themes: Six preset themes (Cyber, Ocean, Sunset, Monochrome, Matrix, Custom)
Display Options: Show or hide component dashboards, main header, risk level lines, gradient fill, and component signals
Label Size: Tiny, Small, Normal, Large
Alert Conditions:
Risk score crosses above +0.66 → Strong risk-on
Risk score crosses below -0.66 → Strong risk-off
Risk score crosses zero → Neutral line
Risk score crosses above +0.33 → Moderate risk-on
Risk score crosses below -0.33 → Moderate risk-off
Data Sources:
HG1! – Copper Futures (COMEX)
GC1! – Gold Futures (COMEX)
RTY1! – Russell 2000 E-mini Futures (CME)
ES1! – S&P 500 E-mini Futures (CME)
ZN1! – 10-Year U.S. Treasury Note Futures (CBOT)
DXY – U.S. Dollar Index (ICE)
Notes and Limitations:
Works best during clear macro regimes and aligned trends
Use with price action, volume, and other technical tools
Not a standalone trading system; serves as a macro context filter
Equal weighting assumes all three components are equally important, but market conditions may vary
Past performance does not guarantee future results
Conclusion:
The Global Risk Terminal consolidates complex cross-asset signals into a simple, actionable score that informs market regime, portfolio positioning, sector rotation, and trading decisions. Its user-friendly layout and extensive customization options make it suitable for traders of all experience levels seeking macro-driven insights. By framing trades around risk score thresholds and combining macro context with tactical execution, traders can identify higher-probability opportunities and optimize position sizing, entries, and exits across a wide range of market conditions.
開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。
開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。