OPEN-SOURCE SCRIPT

Gap Detector

66
Gap Detector — Multi-Timeframe Price Gap Scanner
Automatically detects and visualizes all price gaps across any timeframe — Daily, Weekly, Monthly, or Intraday.

📊 What It Does
This indicator identifies true price gaps where the current candle opens completely above (gap up) or below (gap down) the previous candle's range, with no price overlap between them.
Gap Up (Bullish): Current candle's low > Previous candle's high
Gap Down (Bearish): Current candle's high < Previous candle's low

✨ Key Features
✅ Auto-Detects Chart Timeframe — Works on any timeframe without manual selection (1min, 5min, 1H, 4H, Daily, Weekly, Monthly)
✅ Visual Gap Boxes — Green boxes for gap ups, red boxes for gap downs, drawn exactly across the gap zone
✅ Gap Size Labels — Shows gap percentage on each box for quick assessment
✅ Customizable Filters — Set minimum and maximum gap size % to filter noise
✅ Summary Statistics Table — Live count of bull gaps, bear gaps, and total gaps detected
✅ Pine Screener Compatible — Built-in signals for bulk scanning stocks with gaps
✅ Clean & Lightweight — No repainting, no lag, works on all markets (stocks, forex, crypto, indices)

🎯 Use Cases

Day/Swing Trading: Identify gap fill opportunities on intraday and daily charts
Earnings Plays: Track post-earnings gaps on daily/weekly timeframes
Breakout Confirmation: Gaps often signal strong momentum or trend continuation
Support/Resistance Zones: Unfilled gaps act as magnets for price action
Multi-Timeframe Analysis: Scan 4H gaps, daily gaps, or weekly gaps depending on your strategy


🛠️ Settings
Visibility Controls:

Toggle bull gaps, bear gaps, labels, and summary table on/off independently

Filter Settings:

Min Gap Size (%) — Ignore gaps smaller than this threshold (default 0.1%)
Max Gap Size (%) — Ignore abnormally large gaps like circuit breaker moves (default 5%)

Style Customization:

Gap box colors, border colors, and table position (Top Right, Top Left, Bottom Right, Bottom Left)


📈 How to Use with Pine Screener (TradingView Pro+)

Add indicator to any chart and set your desired timeframe (e.g., 4H for intraday gaps)
Open Pine Screener (bottom toolbar)
Select Gap Detector indicator
Choose Bull Gap Signal or Bear Gap Signal
Set condition: Above → 0
Click Scan to find all stocks with gaps on current candle

Screener Outputs:

Bull Gap Signal = 1 → Gap up formed on current candle
Bear Gap Signal = 1 → Gap down formed on current candle
Signal = 0 → No gap on current candle


📌 Notes

Gaps are detected based on previous candle close to current candle open — not wicks
Works on all markets and instruments where gaps occur (stocks, forex, crypto, futures, indices)
Signal plots appear in a separate pane below the chart for clean visualization
Gap count resets when you reload the chart or change timeframes


💡 Pro Tips

4H Timeframe: Great for intraday gap trading on volatile stocks
Daily Timeframe: Classic overnight gaps — ideal for gap fill strategies
Weekly/Monthly Timeframe: Macro trend analysis and major support/resistance zones
Combine with volume or momentum indicators for higher-probability setups


Created for traders who need fast, reliable gap detection without manual scanning.

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.