OPEN-SOURCE SCRIPT
Updated SPY Breadth Buy Signal

This indicator identifies potential reversal opportunities in SPY by combining five key market conditions into a composite buy signal. It's designed for swing traders and position traders looking to catch relief rallies during oversold conditions.
Key Features:
🎯 Five-Condition Buy Filter:
Volume confirmation (≥150M shares)
VIX elevated (≥30) indicating fear in the market
Market breadth oversold (≤30% of S&P 500 stocks above 50-day SMA)
RSI oversold (≤30)
Slow Stochastic in extreme territory (<20)
The signal triggers when 4 out of 5 conditions are met—providing a balance between sensitivity and false-signal reduction.
How It Works:
Volume - Ensures SPY has institutional participation
VIX - Confirms market-wide volatility spikes (fear gauge)
Breadth - Detects when fewer than 30% of S&P 500 stocks trade above their 50-day moving average (extreme oversold)
RSI - Individual momentum indicator on SPY
Slow Stochastic - Smoothed stochastic %K for momentum confirmation
Display Elements:
Green upward triangle below the bar on signal confirmation
"BUY" label with green background highlight
Debug panel (top-right) showing real-time condition status and count
Customizable Inputs:
Adjust thresholds for all five conditions
Set minimum required conditions (1-5)
Toggle debug panel on/off
Select breadth index (MMFI, S5FI, SPXA50R)
Best Used With:
Daily timeframe (optimal)
As a filter/confirmation tool, not a standalone system
Combine with your own risk management and entry/exit rules
Key Features:
🎯 Five-Condition Buy Filter:
Volume confirmation (≥150M shares)
VIX elevated (≥30) indicating fear in the market
Market breadth oversold (≤30% of S&P 500 stocks above 50-day SMA)
RSI oversold (≤30)
Slow Stochastic in extreme territory (<20)
The signal triggers when 4 out of 5 conditions are met—providing a balance between sensitivity and false-signal reduction.
How It Works:
Volume - Ensures SPY has institutional participation
VIX - Confirms market-wide volatility spikes (fear gauge)
Breadth - Detects when fewer than 30% of S&P 500 stocks trade above their 50-day moving average (extreme oversold)
RSI - Individual momentum indicator on SPY
Slow Stochastic - Smoothed stochastic %K for momentum confirmation
Display Elements:
Green upward triangle below the bar on signal confirmation
"BUY" label with green background highlight
Debug panel (top-right) showing real-time condition status and count
Customizable Inputs:
Adjust thresholds for all five conditions
Set minimum required conditions (1-5)
Toggle debug panel on/off
Select breadth index (MMFI, S5FI, SPXA50R)
Best Used With:
Daily timeframe (optimal)
As a filter/confirmation tool, not a standalone system
Combine with your own risk management and entry/exit rules
Release Notes
minor update removing SPXA50ROpen-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
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.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
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.