OPEN-SOURCE SCRIPT
Atualizado Gap Analysis

Description:
This indicator automates the tracking of session gaps, providing real-time data on gap fills, historical context, and exhaustion risk. It is built specifically for day traders and swing traders who use gap-fill strategies during Regular Trading Hours (RTH).
Core Functionality:
The script captures the closing price (settle) of the previous RTH session and measures it against the open of the current RTH session. If a gap exceeds your minimum point threshold, it maps the gap zone on your chart and tracks price action against the settle line until the gap is filled.
Key Features:
Dynamic Fill Tracking: Monitors unfilled gaps bar-by-bar. It calculates the exact percentage of the gap filled and displays how many bars it took to reach completion.
Exhaustion Risk Detection: Tracks consecutive gaps in the same direction. If the market gaps in the same direction three or more times consecutively, the script flags an "Elevated Exhaustion" risk on the display panel.
Clean Chart Management: Automatically shades the gap zone and draws the target settle line. You can toggle a setting to instantly hide gaps once they are 100% filled, preventing chart clutter.
Heads-Up Display Table: An on-chart dashboard provides immediate access to the current session's gap direction, fill status, specific target price, and elapsed time.
Historical Gap Review: Displays up to 20 historical session gaps, allowing you to backtest how often and how quickly an asset fills its gaps.
Integrated Alerts: Supports automated alerts for two conditions: when a new qualifying gap is formed at the session open, and the moment a gap is entirely filled.
Configuration & Setup:
RTH Session: Define your specific trading hours (default is 0830-1500 America/Chicago). The indicator requires this to accurately lock in the previous day's settle.
Minimum Gap Size: Filter out market noise by setting a minimum point threshold. Gaps smaller than this value will be ignored.
Visual Customization: Full control over bull/bear zone colors, line styles, text sizes, and table positioning.
Usage Notes:
This script relies on timeframe data to establish session boundaries. It is optimal for intraday timeframes (e.g., 1m, 5m, 15m, 1H).
This indicator automates the tracking of session gaps, providing real-time data on gap fills, historical context, and exhaustion risk. It is built specifically for day traders and swing traders who use gap-fill strategies during Regular Trading Hours (RTH).
Core Functionality:
The script captures the closing price (settle) of the previous RTH session and measures it against the open of the current RTH session. If a gap exceeds your minimum point threshold, it maps the gap zone on your chart and tracks price action against the settle line until the gap is filled.
Key Features:
Dynamic Fill Tracking: Monitors unfilled gaps bar-by-bar. It calculates the exact percentage of the gap filled and displays how many bars it took to reach completion.
Exhaustion Risk Detection: Tracks consecutive gaps in the same direction. If the market gaps in the same direction three or more times consecutively, the script flags an "Elevated Exhaustion" risk on the display panel.
Clean Chart Management: Automatically shades the gap zone and draws the target settle line. You can toggle a setting to instantly hide gaps once they are 100% filled, preventing chart clutter.
Heads-Up Display Table: An on-chart dashboard provides immediate access to the current session's gap direction, fill status, specific target price, and elapsed time.
Historical Gap Review: Displays up to 20 historical session gaps, allowing you to backtest how often and how quickly an asset fills its gaps.
Integrated Alerts: Supports automated alerts for two conditions: when a new qualifying gap is formed at the session open, and the moment a gap is entirely filled.
Configuration & Setup:
RTH Session: Define your specific trading hours (default is 0830-1500 America/Chicago). The indicator requires this to accurately lock in the previous day's settle.
Minimum Gap Size: Filter out market noise by setting a minimum point threshold. Gaps smaller than this value will be ignored.
Visual Customization: Full control over bull/bear zone colors, line styles, text sizes, and table positioning.
Usage Notes:
This script relies on timeframe data to establish session boundaries. It is optimal for intraday timeframes (e.g., 1m, 5m, 15m, 1H).
Notas de Lançamento
Fixed historical buffer bugNotas de Lançamento
Fixed runtime error on 1-minute charts caused by historical gap zones exceeding Pine Script's buffer limit. Drawing coordinates are now clamped to prevent overflow on low timeframes with deep history.Notas de Lançamento
Fixed historical buffer overflow error on lower timeframes by tightening draw-offset clamps.Script de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
Tatanka Trading | Futures Market Structure Automated Auction Theory & ML Levels for ES & NQ.
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.
Script de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
Tatanka Trading | Futures Market Structure Automated Auction Theory & ML Levels for ES & NQ.
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.