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.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.