Gap & Base Breakout Screener

Finds stocks that gap up, go quiet in a tight sideways base, then break out of the top of that base on a wide-range bar. Built for the Pine Screener, and it also draws the setup on your chart.
How it works
Why the high and not the close: on the chart, MSFT's Sep 25, 2026 bar cleared its 38-day base intraday (high 519.40 vs base high 517.77) but closed at 516.17, just inside. A close-only trigger misses day one of the move. The strong-close filter keeps wicky fakeouts out.
How to use it (Pine Screener)
Settings: change the range width (for example 5% or 2%) with the gear icon. For tight widths, raise "Max bars from gap to base start" to about 40, because tight ranges usually form late in a longer consolidation.
Columns: Breakout (1/0), In Base (1/0), Base Days, Base Width %, Bars Since Gap, Gap %, Distance to Base High %, Bar Range x Average, Relative Volume, 20-day Dollar Volume ($M).
On the chart: the yellow box is the current base, labeled with its length and width. The green label marks the gap. The triangle marks the breakout bar. Two alerts: Gap Base Breakout and Gap Base Setup.
What makes it different: instead of measuring a fixed lookback, it searches for the longest base that fits your width, ties that base to a specific gap-up, and requires the base to hold the gap. The result is post-gap consolidations, not random tight ranges.
Limitations
How it works
- Gap: an open at least 4% above the prior close, on 1.5x the 50-day average volume.
- Base: the longest stretch of 5+ bars whose high-to-low range stays within your max width (default 10%). It must start within 10 bars of the gap and hold above the pre-gap close.
- Breakout: the high clears the base high, the bar closes in the top 30% of its range, the range is at least 1.5x the 20-day average, and volume is at least average.
Why the high and not the close: on the chart, MSFT's Sep 25, 2026 bar cleared its 38-day base intraday (high 519.40 vs base high 517.77) but closed at 516.17, just inside. A close-only trigger misses day one of the move. The strong-close filter keeps wicky fakeouts out.
How to use it (Pine Screener)
- Add the script to Favorites, open the Pine Screener and pick an index or watchlist.
- Add indicator, select this script and set the timeframe to 1D.
- Filter "1 Breakout" above 0.5 for today's breakouts, or "2 In Base" above 0.5 for stocks still basing.
- Click Scan. For In Base, sort "7 Dist To Base High pct" ascending: the names closest to the lid come first.
Settings: change the range width (for example 5% or 2%) with the gear icon. For tight widths, raise "Max bars from gap to base start" to about 40, because tight ranges usually form late in a longer consolidation.
Columns: Breakout (1/0), In Base (1/0), Base Days, Base Width %, Bars Since Gap, Gap %, Distance to Base High %, Bar Range x Average, Relative Volume, 20-day Dollar Volume ($M).
On the chart: the yellow box is the current base, labeled with its length and width. The green label marks the gap. The triangle marks the breakout bar. Two alerts: Gap Base Breakout and Gap Base Setup.
What makes it different: instead of measuring a fixed lookback, it searches for the longest base that fits your width, ties that base to a specific gap-up, and requires the base to hold the gap. The result is post-gap consolidations, not random tight ranges.
Limitations
- Cash buyouts gap up and then pin flat near the deal price, which looks like a base. A minimum 5-day average daily range (default 0.75%) removes most of them. Check the news on anything under about 3% wide.
- It cannot tell whether the gap came from a real earnings beat. Check the catalyst yourself.
- Pine Screener calculates on the last 500 bars. The base search looks back up to 120 bars by default.
- A setup is not a guarantee. Many bases fail or break down instead.
Day & swing trader. The market pays discipline, not opinions. USAF vet/aviator ✈️ Politics are for those who are asleep. Wake up.
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.
Day & swing trader. The market pays discipline, not opinions. USAF vet/aviator ✈️ Politics are for those who are asleep. Wake up.
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.