OPEN-SOURCE SCRIPT
Gap Acceptance Guard

A gap is visible immediately. Whether the market accepts the new price area is only revealed by what happens next.
**Gap Acceptance Guard** tracks qualifying opening gaps through a fixed observation sequence. It separates continued acceptance from loss of the gap midpoint, a confirmed close through the previous close, and an unresolved timeout. The original gap, ATR reference, event extreme and decision levels are frozen when the episode begins.
## Visual guide
- **G+ / G−** — a bullish or bearish qualifying gap entered observation.
- **Shaded zone** — the active gap between the previous close and the new open.
- **Orange line** — the acceptance boundary inside the frozen gap.
- **Gray line** — the previous close and full-fill reference.
- **Blue line** — the minimum extension required beyond the event bar.
- **A+ / A−** — acceptance was confirmed.
- **R** — price closed back through the acceptance boundary.
- **X** — price closed beyond the previous close and invalidated the gap thesis.
- **T** — the observation window ended without a terminal decision.
- **Yellow diamond** — the gap-fill line was touched intrabar while the episode remained active.
The display is intentionally chart-first. It uses no table and requires no other indicator.
## Detection
By default, the absolute difference between the current open and previous close must be at least 0.50 times ATR measured on the previous completed bar. On intraday charts, detection is limited to the first bar of each exchange day. On daily and higher charts, each completed bar can be evaluated. An optional setting can require the open to clear the entire previous candle range.
## Acceptance test
Acceptance requires all three default conditions:
1. Two consecutive closes remain beyond the midpoint of the gap in its direction.
2. Price extends at least 0.25 frozen ATR beyond the event bar’s high or low.
3. Directional progress represents at least 45% of the cumulative close-to-close path after the event.
Path efficiency penalizes back-and-forth movement. A direct continuation scores higher than a noisy move that covers the same net distance.
## Example
Assume the previous close is 100, the new open is 104, the event high is 106 and frozen ATR is 4. With a 50% acceptance boundary, the orange line is 102. With a 0.25 ATR extension requirement, price must reach 107. If two closes hold above 102, price reaches 107 and path efficiency is at least 45%, **A+** is printed. A confirmed close below 102 prints **R**; a confirmed close below 100 prints **X** and takes priority.
## Behavior and limitations
State changes and markers occur only on confirmed bars. The script uses no future bars, pivot backdating or lookahead requests. One episode is tracked at a time.
Session structure depends on the exchange and chart timeframe. Extended-hours bars, synthetic candles and markets that trade continuously can change the meaning or frequency of gaps. The indicator describes observed conditions; it does not estimate probabilities, place trades, size positions or model fees, slippage, liquidity and execution.
BotTradeLab — Human judgment, AI-assisted analysis.
**Gap Acceptance Guard** tracks qualifying opening gaps through a fixed observation sequence. It separates continued acceptance from loss of the gap midpoint, a confirmed close through the previous close, and an unresolved timeout. The original gap, ATR reference, event extreme and decision levels are frozen when the episode begins.
## Visual guide
- **G+ / G−** — a bullish or bearish qualifying gap entered observation.
- **Shaded zone** — the active gap between the previous close and the new open.
- **Orange line** — the acceptance boundary inside the frozen gap.
- **Gray line** — the previous close and full-fill reference.
- **Blue line** — the minimum extension required beyond the event bar.
- **A+ / A−** — acceptance was confirmed.
- **R** — price closed back through the acceptance boundary.
- **X** — price closed beyond the previous close and invalidated the gap thesis.
- **T** — the observation window ended without a terminal decision.
- **Yellow diamond** — the gap-fill line was touched intrabar while the episode remained active.
The display is intentionally chart-first. It uses no table and requires no other indicator.
## Detection
By default, the absolute difference between the current open and previous close must be at least 0.50 times ATR measured on the previous completed bar. On intraday charts, detection is limited to the first bar of each exchange day. On daily and higher charts, each completed bar can be evaluated. An optional setting can require the open to clear the entire previous candle range.
## Acceptance test
Acceptance requires all three default conditions:
1. Two consecutive closes remain beyond the midpoint of the gap in its direction.
2. Price extends at least 0.25 frozen ATR beyond the event bar’s high or low.
3. Directional progress represents at least 45% of the cumulative close-to-close path after the event.
Path efficiency penalizes back-and-forth movement. A direct continuation scores higher than a noisy move that covers the same net distance.
## Example
Assume the previous close is 100, the new open is 104, the event high is 106 and frozen ATR is 4. With a 50% acceptance boundary, the orange line is 102. With a 0.25 ATR extension requirement, price must reach 107. If two closes hold above 102, price reaches 107 and path efficiency is at least 45%, **A+** is printed. A confirmed close below 102 prints **R**; a confirmed close below 100 prints **X** and takes priority.
## Behavior and limitations
State changes and markers occur only on confirmed bars. The script uses no future bars, pivot backdating or lookahead requests. One episode is tracked at a time.
Session structure depends on the exchange and chart timeframe. Extended-hours bars, synthetic candles and markets that trade continuously can change the meaning or frequency of gaps. The indicator describes observed conditions; it does not estimate probabilities, place trades, size positions or model fees, slippage, liquidity and execution.
BotTradeLab — Human judgment, AI-assisted analysis.
Script open-source
Dans l'esprit TradingView, le créateur de ce script l'a rendu open source afin que les traders puissent examiner et vérifier ses fonctionnalités. Bravo à l'auteur! Bien que vous puissiez l'utiliser gratuitement, n'oubliez pas que la republication du code est soumise à nos Règles.
Clause de non-responsabilité
Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.
Script open-source
Dans l'esprit TradingView, le créateur de ce script l'a rendu open source afin que les traders puissent examiner et vérifier ses fonctionnalités. Bravo à l'auteur! Bien que vous puissiez l'utiliser gratuitement, n'oubliez pas que la republication du code est soumise à nos Règles.
Clause de non-responsabilité
Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.