OPEN-SOURCE SCRIPT
Macro Panel - Risk-On 0-8 [Galin]

Macro Panel - Risk-On 0-8 [Galin]
What it does
Turns "how's the market feeling?" into a number, computed the same way every single day: eight binary rules, one point each. 8/8 = everything supports risk. 0/8 = nothing does. The panel shows the full checklist with a pass/fail mark per rule and a color-coded header; the score is also plotted as a stepline - a historical regime curve, so you can scroll back and see every transition of the past years. The indicator is symbol-independent: add it to any chart (a daily SPY chart is the natural home) and it reads the market, not the chart.
Why it matters
Setups don't fail because they were bad setups - they fail because they were taken in the wrong market. Position sizing needs a systematic input, and "feel" drifts exactly when it matters most: after a winning streak and during a scary tape. A fixed eight-rule score can't drift. It also can't be argued with at 9:31 AM.
The eight rules - one point each
1. SPY above its 20-day SMA - tactical trend
2. SPY above its 50-day SMA - intermediate trend
3. QQQ above its 20-day SMA - growth participating
4. IWM above its 50-day SMA - small-cap risk appetite
5. RSP beating SPY over 1 month - breadth beneath the megacaps
6. VIX below a threshold (default 20, adjustable) - volatility calm
7. HYG above its 50-day SMA - credit not stressed
8. SPY 1-month return positive - momentum
Four trend rules, one breadth, one volatility, one credit, one momentum - each catches a different way markets break. Oil, gold, the dollar and rates are deliberately NOT in the score: they are context, not gates. A real macro shock shows up through VIX and SPY anyway - counting it twice double-weights fear.
Reading it
The total is the throttle; the composition is the story. A 6/8 missing its trend points (SPY, QQQ) is a different market from a 6/8 missing its insurance points (VIX, HYG): the first says the tape is broken, the second says the tape is fine and the nerves haven't signed off yet. The panel shows you which mark is missing - that's why it displays all eight rows instead of just the sum.
Suggested bands: 7-8 full risk | 5-6 selective | 3-4 half size | 0-2 no new longs. One rule overrides the total: rule 1 off (SPY below its 20-day) = no new entries, whatever the sum says.
Alerts
Three built in: Kill switch - SPY lost its 20-day | Score dropped to 4 or below | Score entered the 7-8 band. The regime calls you; you don't have to check it.
Settings
VIX calm threshold (default 20) | checklist panel on/off | panel position.
Notes
Chart indicator, designed for daily charts. The score plots with dotted band lines at the 7-8 / 5-6 / 3-4 boundaries. Not intended for the Pine Screener - it needs six data requests and the screener allows five.
What it does
Turns "how's the market feeling?" into a number, computed the same way every single day: eight binary rules, one point each. 8/8 = everything supports risk. 0/8 = nothing does. The panel shows the full checklist with a pass/fail mark per rule and a color-coded header; the score is also plotted as a stepline - a historical regime curve, so you can scroll back and see every transition of the past years. The indicator is symbol-independent: add it to any chart (a daily SPY chart is the natural home) and it reads the market, not the chart.
Why it matters
Setups don't fail because they were bad setups - they fail because they were taken in the wrong market. Position sizing needs a systematic input, and "feel" drifts exactly when it matters most: after a winning streak and during a scary tape. A fixed eight-rule score can't drift. It also can't be argued with at 9:31 AM.
The eight rules - one point each
1. SPY above its 20-day SMA - tactical trend
2. SPY above its 50-day SMA - intermediate trend
3. QQQ above its 20-day SMA - growth participating
4. IWM above its 50-day SMA - small-cap risk appetite
5. RSP beating SPY over 1 month - breadth beneath the megacaps
6. VIX below a threshold (default 20, adjustable) - volatility calm
7. HYG above its 50-day SMA - credit not stressed
8. SPY 1-month return positive - momentum
Four trend rules, one breadth, one volatility, one credit, one momentum - each catches a different way markets break. Oil, gold, the dollar and rates are deliberately NOT in the score: they are context, not gates. A real macro shock shows up through VIX and SPY anyway - counting it twice double-weights fear.
Reading it
The total is the throttle; the composition is the story. A 6/8 missing its trend points (SPY, QQQ) is a different market from a 6/8 missing its insurance points (VIX, HYG): the first says the tape is broken, the second says the tape is fine and the nerves haven't signed off yet. The panel shows you which mark is missing - that's why it displays all eight rows instead of just the sum.
Suggested bands: 7-8 full risk | 5-6 selective | 3-4 half size | 0-2 no new longs. One rule overrides the total: rule 1 off (SPY below its 20-day) = no new entries, whatever the sum says.
Alerts
Three built in: Kill switch - SPY lost its 20-day | Score dropped to 4 or below | Score entered the 7-8 band. The regime calls you; you don't have to check it.
Settings
VIX calm threshold (default 20) | checklist panel on/off | panel position.
Notes
Chart indicator, designed for daily charts. The score plots with dotted band lines at the 7-8 / 5-6 / 3-4 boundaries. Not intended for the Pine Screener - it needs six data requests and the screener allows five.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.