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.
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน