OPEN-SOURCE SCRIPT
Elite Risk-On/Risk-Off Oscillator (6 pairs)

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.
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.
Açık kaynak kodlu komut dosyası
Gerçek TradingView ruhuyla, bu komut dosyasının mimarı, yatırımcıların işlevselliğini inceleyip doğrulayabilmesi için onu açık kaynaklı hale getirdi. Yazarı tebrik ederiz! Ücretsiz olarak kullanabilseniz de, kodu yeniden yayınlamanın Topluluk Kurallarımıza tabi olduğunu unutmayın.
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, alım satım veya diğer türden tavsiye veya öneriler anlamına gelmez ve teşkil etmez. Kullanım Koşulları bölümünde daha fazlasını okuyun.
Açık kaynak kodlu komut dosyası
Gerçek TradingView ruhuyla, bu komut dosyasının mimarı, yatırımcıların işlevselliğini inceleyip doğrulayabilmesi için onu açık kaynaklı hale getirdi. Yazarı tebrik ederiz! Ücretsiz olarak kullanabilseniz de, kodu yeniden yayınlamanın Topluluk Kurallarımıza tabi olduğunu unutmayın.
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, alım satım veya diğer türden tavsiye veya öneriler anlamına gelmez ve teşkil etmez. Kullanım Koşulları bölümünde daha fazlasını okuyun.