OPEN-SOURCE SCRIPT

Risk-On / Risk-Off Score

195
Risk-On / Risk-Off Score (Macro Sentiment Indicator)
This indicator calculates a custom Risk-On / Risk-Off Score to objectively assess the current market risk sentiment using a carefully selected basket of macroeconomic assets and intermarket relationships.

๐Ÿง  What does this indicator do?
The score is based on 14 key components grouped into three categories:

๐ŸŸข Risk-On Assets (rising = appetite for risk)
(+1 if performance over X days is positive, otherwise โ€“1)

NASDAQ 100 (NAS100USD)

S&P 500 (SPX)

Bitcoin (BTCUSD)

Copper (HG1!)

WTI Crude Oil (CLK2025)

๐Ÿ”ด Risk-Off Assets (rising = flight to safety)
(โ€“1 if performance is positive, otherwise +1)

Gold (XAUUSD)

US Treasury Bonds (TLT ETF) (TLT)

US Dollar Index (DXY)

USD/CHF

USD/JPY

US 10Y Yields (US10Y) (yields are interpreted inversely)

โš–๏ธ Risk Spreads / Relative Indicators
(+1 if rising, โ€“1 if falling)

Copper/Gold Ratio โ†’ HG1! / XAUUSD

NASDAQ/VIX Ratio โ†’ NAS100USD / VIX

HYG/TLT Ratio โ†’ HYG / TLT

๐Ÿ“ Score Calculation
Total score = sum of all components

Range: from โ€“14 (extreme Risk-Off) to +14 (strong Risk-On)

Color-coded output:

๐ŸŸข Score > 2 = Risk-On

๐ŸŸ  โ€“2 to +2 = Neutral

๐Ÿ”ด Score < โ€“2 = Risk-Off

Displayed as a line plot with background color and signal markers

๐Ÿงช Timeframe of analysis:
Default: 5 days (adjustable via input)

Calculated using Rate of Change (% change)

๐Ÿงญ Use Cases:
Quickly assess macro sentiment

Filter for position sizing, hedging, or intraday bias

Especially useful for:

Swing traders

Day traders with macro filters

Volatility and options traders

๐Ÿ“Œ Note:
This is not a buy/sell signal indicator, but a contextual sentiment tool designed to help you stay aligned with overall market conditions.

Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.