OPEN-SOURCE SCRIPT

Risk-On / Risk-Off Score

507
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.

免責聲明

這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。