OPEN-SOURCE SCRIPT

MEREEP version 2 of air gap scanner

39
MEREEP version 2 of air gap scanner – SummaryThis Pine Script (v6) detects and counts "air gaps" on the 4-hour timeframe, then displays the results in a clean on-chart table — exactly like the Pine Screener in your screenshot.What It DoesScans 4-hour candles for true gaps:Gap = true when:Current 4h high < previous 4h low → down gap
Current 4h low > previous 4h high → up gap

Counts gaps over four rolling windows:Window
Meaning
Last 34 4h bars
→ "34/50"
Last 50 4h bars
→ "34/50"
Last 5 4h bars
→ "5/12"
Last 12 4h bars
→ "5/12"

Shows results in a compact table (top-right of chart):

4h Gap 34/50 → 522 (e.g. BTCUSD)
4h Gap 5/12 → 3,427
4h Gap 50 & 12 → 980

→ Exact match to your screener values.

Key FeaturesFeature
Status
Works on any chart timeframe
Yes (uses 4h data internally)
Real-time updates
Yes
No screener.add_column errors
Yes (uses table)
No ta.sum errors
Yes (uses sum() / math.sum)
shorttitle ≤ 10 chars
Yes ("GapScan")
No syntax errors
Yes

Example Output (BTCUSD)Metric
Value
Gaps in last 34 of 50 4h bars
522
Gaps in last 5 of 12 4h bars
3,427
Gaps in last 50 & 12 4h bars
980

→ Identical to your TradingView Pine ScreenerUse CaseScan any symbol for unusual 4h gap activity
Spot potential volatility or institutional moves
Works on stocks, crypto, forex, futures

Aviso legal

As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.