Here's a clean, ready-to-use Pine Script for a Candle Gap Scanner that draws zones (boxes) and keeps extending them to the right until the gap is filled.
Features
- Detects true gaps (no overlap between candles):
- Gap Up Current Low > Previous High
- Gap Down Current High < Previous Low
- Draws a colored zone for the empty space
- Zone extends to the right until price fills it
- Option to keep or remove filled gaps
- Minimum gap size filter (in points or %)
- Separate colors for Gap Up / Gap Down
- Optional labels showing gap size