OPEN-SOURCE SCRIPT
Market Regime Index

The Market Regime Index is a top-down macro regime nowcasting tool that offers a consolidated view of the market’s risk appetite. It tracks 32 of the world’s most influential markets across asset classes to determine investor sentiment by applying trend-following signals to each independent asset. It features adjustable parameters and a built-in alert system that notifies investors when conditions transition between Risk-On and Risk-Off regimes. The selected markets are grouped into equities (7), fixed income (9), currencies (7), commodities (5), and derivatives (4):
All assets are directionally aligned with their historical correlation to the S&P 500. Each asset contributes equally based on its individual bullish or bearish signal. The overall market regime is calculated as the difference between the number of Risk-On and Risk-Off signals divided by the total number of assets, displayed as the percentage of markets confirming each regime. Green indicates Risk-On and occurs when the number of Risk-On signals exceeds Risk-Off signals, while red indicates Risk-Off and occurs when the number of Risk-Off signals exceeds Risk-On signals.
This indicator is designed with flexibility in mind, allowing users to include or exclude individual assets that contribute to the market regime and adjust the input parameters used for trend signal detection. These parameters apply to each independent asset, and the overall regime signal is smoothed by the signal length to reduce noise and enhance reliability. Investors can position according to the prevailing market regime by selecting factors that have historically outperformed under each regime environment to minimise downside risk and maximise upside potential:
In summary, the Market Regime Index is a comprehensive macro risk-management tool that identifies the current market regime and helps investors align portfolio risk with the market’s underlying risk appetite. Its intuitive, color-coded design makes it an indispensable resource for investors seeking to navigate shifting market conditions and enhance risk-adjusted performance by selecting factors that have historically outperformed. While it has proven historically valuable, asset-specific characteristics and correlations evolve over time as market dynamics change.
- Equities = S&P 500 E-mini Index Futures, Nasdaq-100 E-mini Index Futures, Russell 2000 E-mini Index Futures, STOXX Europe 600 Index Futures, Nikkei 225 Index Futures, MSCI Emerging Markets Index Futures, and S&P 500 High Beta (SPHB)/Low Beta (SPLV) Ratio.
- Fixed Income = US 10Y Treasury Yield, US 2Y Treasury Yield, US 10Y-02Y Yield Spread, German 10Y Bund Yield, UK 10Y Gilt Yield, US 10Y Breakeven Inflation Rate, US 10Y TIPS Yield, US High Yield Option-Adjusted Spread, and US Corporate Option-Adjusted Spread.
- Currencies = US Dollar Index (DXY), Australian Dollar/US Dollar, Euro/US Dollar, Chinese Yuan/US Dollar, Pound Sterling/US Dollar, Japanese Yen/US Dollar, and Bitcoin/US Dollar.
- Commodities = ICE Brent Crude Oil Futures, COMEX Gold Futures, COMEX Silver Futures, COMEX Copper Futures, and S&P Goldman Sachs Commodity Index (GSCI) Futures.
- Derivatives = CBOE S&P 500 Volatility Index (VIX), ICE US Bond Market Volatility Index (MOVE), CBOE 3M Implied Correlation Index, and CBOE VIX Volatility Index (VVIX)/VIX.
All assets are directionally aligned with their historical correlation to the S&P 500. Each asset contributes equally based on its individual bullish or bearish signal. The overall market regime is calculated as the difference between the number of Risk-On and Risk-Off signals divided by the total number of assets, displayed as the percentage of markets confirming each regime. Green indicates Risk-On and occurs when the number of Risk-On signals exceeds Risk-Off signals, while red indicates Risk-Off and occurs when the number of Risk-Off signals exceeds Risk-On signals.
- Bullish Signal = (Fast MA – Slow MA) > (ATR × ATR Margin)
- Bearish Signal = (Fast MA – Slow MA) < –(ATR × ATR Margin)
- Market Regime = (Risk-On signals – Risk-Off signals) ÷ Total assets
This indicator is designed with flexibility in mind, allowing users to include or exclude individual assets that contribute to the market regime and adjust the input parameters used for trend signal detection. These parameters apply to each independent asset, and the overall regime signal is smoothed by the signal length to reduce noise and enhance reliability. Investors can position according to the prevailing market regime by selecting factors that have historically outperformed under each regime environment to minimise downside risk and maximise upside potential:
- Risk-On Equity Factors = High Beta > Cyclicals > Low Volatility > Defensives.
- Risk-Off Equity Factors = Defensives > Low Volatility > Cyclicals > High Beta.
- Risk-On Fixed Income Factors = High Yield > Investment Grade > Treasuries.
- Risk-Off Fixed Income Factors = Treasuries > Investment Grade > High Yield.
- Risk-On Commodity Factors = Industrial Metals > Energy > Agriculture > Gold.
- Risk-Off Commodity Factors = Gold > Agriculture > Energy > Industrial Metals.
- Risk-On Currency Factors = Cryptocurrencies > Foreign Currencies > US Dollar.
- Risk-Off Currency Factors = US Dollar > Foreign Currencies > Cryptocurrencies.
In summary, the Market Regime Index is a comprehensive macro risk-management tool that identifies the current market regime and helps investors align portfolio risk with the market’s underlying risk appetite. Its intuitive, color-coded design makes it an indispensable resource for investors seeking to navigate shifting market conditions and enhance risk-adjusted performance by selecting factors that have historically outperformed. While it has proven historically valuable, asset-specific characteristics and correlations evolve over time as market dynamics change.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
👉 Unlock exclusive indicators for free: join.quantitativealpha.com/
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.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
👉 Unlock exclusive indicators for free: join.quantitativealpha.com/
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.