OPEN-SOURCE SCRIPT

Elite Risk-On/Risk-Off Oscillator (6 pairs)

92
The Elite Risk-On / Risk-Off Oscillator is a market-regime indicator designed to determine whether conditions favor aggressive risk-taking or defensive capital preservation rather than to predict price direction.

It combines six carefully selected relative-strength pairs that measure risk appetite across the most important parts of the market:

IEI/HYG (credit stress, weighted most heavily because credit often leads equities)
SPHB/SPLV (equity risk appetite via high-beta versus low-volatility stocks)
IWM/SPY (liquidity and growth sensitivity through small-caps versus large-caps)
MTUM/QUAL (trend durability versus balance-sheet quality)
XLY/XLP (consumer cyclicality, wants versus needs)
EEM/SPY (global risk and dollar-sensitive capital flows)

Each pair is evaluated using relative performance against a moving-average and slope filter to classify it as risk-on (+1), neutral (0), or risk-off (-1), with defensive ratios inverted so that positive readings always indicate risk-on conditions; the weighted signals are then aggregated, normalized to a -100 to +100 scale, and smoothed into a single oscillator. Readings above approximately +40 indicate a supportive risk-on environment where trends are more likely to persist, readings between -40 and +40 reflect transitional or choppy conditions with lower conviction, and readings below -40 signal a risk-off regime where capital preservation and defense should be prioritized.

The indicator is intended as a context and position-sizing tool, helping traders align strategy aggressiveness with underlying market conditions rather than relying on forecasts or narratives.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.