OPEN-SOURCE SCRIPT
Supply & Demand Zones

This indicator detects high-probability supply and demand zones using a multi-step smart money concept approach:
Liquidity Sweep Detection: Identifies when price sweeps above a pivot high (supply setup) or below a pivot low (demand setup), capturing liquidity grabs by institutional traders.
Displacement Confirmation: Requires a strong displacement candle (measured by ATR and body percentage) or fair value gap (FVG/imbalance) in the opposite direction after the sweep.
Volume Confirmation: Optional filter ensures zones form only when volume exceeds the user-defined threshold, indicating institutional participation.
Smart Filtering: Built-in logic prevents overlapping zones, enforces minimum spacing between signals, and requires confirmation bars to eliminate false signals.
Zone Lifecycle Management: Zones are automatically removed when price closes through them with momentum. Breached zones can optionally "flip" to the opposite type when re-tested with strong displacement.
✨ Key Features
🎯 How to Add to Your Chart
📖 How to Use
Demand Zones (Green "D" Labels):
Price swept below a swing low (liquidity grab)
Strong bullish displacement or imbalance followed
Trading Action: Look for LONG entries when price returns to the zone or on immediate continuation
Stop Loss: Place just below the zone or sweep low
Target: Next resistance level, supply zone, or risk-reward ratio target
Supply Zones (Red "S" Labels):
Price swept above a swing high (liquidity grab)
Strong bearish displacement or imbalance followed
Trading Action: Look for SHORT entries when price returns to the zone or on immediate continuation
Stop Loss: Place just above the zone or sweep high
Target: Next support level, demand zone, or risk-reward ratio target
Flipped Zones (Orange Labels):
Previous demand/supply zone was broken with strong momentum
Zone has flipped polarity and may now act as the opposite type
Trading Action: Exercise caution—wait for additional confirmation before trading flipped zones
🔍 What to Look For
High-Quality Setups:
Avoid These Setups:
⚙️ Recommended Settings by Timeframe
5-Minute Charts (Scalping):
Pivot Lookback: 3/3
Min Displacement ATR: 0.9
Confirmation Bars: 1
Min Zone Spacing: 3-5 bars
Volume Threshold: 1.2x
15-Minute Charts (Intraday):
Pivot Lookback: 4/4 (default)
Min Displacement ATR: 1.0 (default)
Confirmation Bars: 2 (default)
Min Zone Spacing: 5-8 bars
Volume Threshold: 1.2x
1-Hour Charts (Swing Trading):
Pivot Lookback: 5/5
Min Displacement ATR: 1.2-1.5
Confirmation Bars: 3
Min Zone Spacing: 8-12 bars
Volume Threshold: 1.3x
💡 Trading Tips & Best Practices
⚠️ Important Disclaimers
Educational Purpose Only: This indicator is provided for educational and informational purposes. It does not constitute financial advice, investment recommendations, or trading signals.
No Guarantees: Past performance and backtested results do not guarantee future results. Trading involves substantial risk of loss.
Liquidity Sweep Detection: Identifies when price sweeps above a pivot high (supply setup) or below a pivot low (demand setup), capturing liquidity grabs by institutional traders.
Displacement Confirmation: Requires a strong displacement candle (measured by ATR and body percentage) or fair value gap (FVG/imbalance) in the opposite direction after the sweep.
Volume Confirmation: Optional filter ensures zones form only when volume exceeds the user-defined threshold, indicating institutional participation.
Smart Filtering: Built-in logic prevents overlapping zones, enforces minimum spacing between signals, and requires confirmation bars to eliminate false signals.
Zone Lifecycle Management: Zones are automatically removed when price closes through them with momentum. Breached zones can optionally "flip" to the opposite type when re-tested with strong displacement.
✨ Key Features
- Clean Visual Display: Small "D" (Demand) and "S" (Supply) labels with shaded zone boxes
- Non-Repainting: All signals use confirmed historical data—no lookahead or repainting
- Volume Filter: Optional confirmation using volume spike detection
- Zone Flip Logic: Breached demand zones can become supply (and vice versa) when violated
- Overlap Prevention: Smart algorithm prevents clustered or duplicate zones
- Confirmation Delay: Configurable wait period after sweep to confirm genuine setups
- Customizable Inputs: Adjust pivot sensitivity, displacement thresholds, volume filters, and more
- Alert Ready: Built-in alert conditions for new supply and demand zone formations
🎯 How to Add to Your Chart
- Favorite the Indicator: Click the star icon to add this script to your favorites
- Open Your Chart: Navigate to the asset and timeframe you want to trade (works best on 5m-1H intraday charts)
- Add Indicator: Click "Indicators" at the top, search for "Supply & Demand Zones (Smart Filtered)", and add to chart
- Customize Settings: Click the gear icon ⚙️ to adjust inputs based on your trading style and instrument volatility
- Set Alerts: Right-click the indicator name → "Add alert" → Select "Supply Zone" or "Demand Zone" conditions
📖 How to Use
Demand Zones (Green "D" Labels):
Price swept below a swing low (liquidity grab)
Strong bullish displacement or imbalance followed
Trading Action: Look for LONG entries when price returns to the zone or on immediate continuation
Stop Loss: Place just below the zone or sweep low
Target: Next resistance level, supply zone, or risk-reward ratio target
Supply Zones (Red "S" Labels):
Price swept above a swing high (liquidity grab)
Strong bearish displacement or imbalance followed
Trading Action: Look for SHORT entries when price returns to the zone or on immediate continuation
Stop Loss: Place just above the zone or sweep high
Target: Next support level, demand zone, or risk-reward ratio target
Flipped Zones (Orange Labels):
Previous demand/supply zone was broken with strong momentum
Zone has flipped polarity and may now act as the opposite type
Trading Action: Exercise caution—wait for additional confirmation before trading flipped zones
🔍 What to Look For
High-Quality Setups:
- Zone forms with above-average volume (check volume filter is enabled)
- Clear liquidity sweep visible on the chart
- Strong displacement candle with large body percentage
- Zone aligns with overall market trend or key structure levels
- Multiple timeframe confirmation (check higher timeframe for context)
Avoid These Setups:
- Zones forming in choppy, low-volume conditions
- Multiple overlapping zones in the same area (indicator filters these automatically)
- Zones that appear immediately after news events (set confirmation bars higher)
- Counter-trend zones without additional confluence
⚙️ Recommended Settings by Timeframe
5-Minute Charts (Scalping):
Pivot Lookback: 3/3
Min Displacement ATR: 0.9
Confirmation Bars: 1
Min Zone Spacing: 3-5 bars
Volume Threshold: 1.2x
15-Minute Charts (Intraday):
Pivot Lookback: 4/4 (default)
Min Displacement ATR: 1.0 (default)
Confirmation Bars: 2 (default)
Min Zone Spacing: 5-8 bars
Volume Threshold: 1.2x
1-Hour Charts (Swing Trading):
Pivot Lookback: 5/5
Min Displacement ATR: 1.2-1.5
Confirmation Bars: 3
Min Zone Spacing: 8-12 bars
Volume Threshold: 1.3x
💡 Trading Tips & Best Practices
- Combine with Price Action: Use this indicator alongside candlestick patterns, support/resistance, and trendlines for confirmation
- Multiple Timeframe Analysis: Check higher timeframes for overall bias and major zones
- Volume is Key: Enable volume filter to focus on institutional-backed moves
- Risk Management: Always use stop losses and proper position sizing
- Backtesting: Test settings on your preferred instruments and timeframes before live trading
- Context Matters: Consider market conditions, news events, and session times
- Wait for Confirmation: Don't rush entries—wait for price reaction at the zone
⚠️ Important Disclaimers
Educational Purpose Only: This indicator is provided for educational and informational purposes. It does not constitute financial advice, investment recommendations, or trading signals.
No Guarantees: Past performance and backtested results do not guarantee future results. Trading involves substantial risk of loss.
Script open-source
Nello spirito di TradingView, l'autore di questo script lo ha reso open source, in modo che i trader possano esaminarne e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricordiamo che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.
Script open-source
Nello spirito di TradingView, l'autore di questo script lo ha reso open source, in modo che i trader possano esaminarne e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricordiamo che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.