OPEN-SOURCE SCRIPT
CandelaCharts - RTH Gap

📝 Overview
The CandelaCharts - RTH Gap indicator is a professional technical tool designed to automatically identify, track, and visualize Regular Trading Hours (RTH) gaps. By targeting the exact NY close (4:00 PM for equities/ETFs like SPY, or 4:15 PM for futures) and open (9:30 AM), this indicator precisely maps out the untraded price voids between sessions, providing crucial intraday support and resistance levels.

Unlike standard gap indicators that fail on RTH-only charts, this script uses robust day-change logic to detect session transitions flawlessly. Unfilled gaps extend indefinitely across the chart, while filled gaps can be kept on the chart to serve as historical support/resistance.
📦 Features
⚙️ Settings
⚡️ Showcase
RTH Gap - Default View

RTH Gap - OTE Levels

RTH Gap - Quadrant Levels

🚨 Alerts
This indicator includes built-in alert conditions ensuring you never miss a critical gap test. Once "Enable Alerts" is checked in the settings, you can configure TradingView to notify you when:
⚠️ Disclaimer
Trading involves significant risk, and many participants may incur losses. The content on this site is not intended as financial advice and should not be interpreted as such. Decisions to buy, sell, hold, or trade securities, commodities, or other financial instruments carry inherent risks and are best made with guidance from qualified financial professionals. Past performance is not indicative of future results.
The CandelaCharts - RTH Gap indicator is a professional technical tool designed to automatically identify, track, and visualize Regular Trading Hours (RTH) gaps. By targeting the exact NY close (4:00 PM for equities/ETFs like SPY, or 4:15 PM for futures) and open (9:30 AM), this indicator precisely maps out the untraded price voids between sessions, providing crucial intraday support and resistance levels.
Unlike standard gap indicators that fail on RTH-only charts, this script uses robust day-change logic to detect session transitions flawlessly. Unfilled gaps extend indefinitely across the chart, while filled gaps can be kept on the chart to serve as historical support/resistance.
📦 Features
- Exact RTH Logic: Automatically anchors session closings (16:00/16:15 NY time) and openings (09:30 NY time) to measure the exact RTH gap size, regardless of whether you have Extended Trading Hours (ETH) turned on or off.
- Customizable Inner Levels: Break down gap zones into mathematically significant price levels:
- Midline (50% Mean): Plots the exact middle of the gap, a highly respected level for intraday rejections.
- Quadrants: Divides the gap into 25%, 50%, and 75% retracement levels.
- OTE (Optimal Trade Entry): Plots the 0.618, 0.705, and 0.786 Fibonacci levels to find high-probability reversal zones.
- Dynamic Labels: Displays dynamic price labels on the chart axis. When Inner Levels (OTE or Quadrants) are enabled, the top, bottom, and midline labels automatically update to show percentages/ratios (e.g. 100%, 50%, 0% or 0.0, 0.5, 1.0) rather than raw prices to keep the charts clean.
- Post-Fill Extensions: When a gap is filled, the main box stops extending to mark where the mitigation happened. However, if enabled, the levels (Top, Bottom, Midline, and Inner Levels) will convert to dashed lines and continue to extend to the current candle as historical support/resistance.
- Filter by Bias: Clean up your chart layout by choosing to display only Bullish gaps, Bearish gaps, or Both.
- Historical Tracking: Keep the last N gaps visible on the chart for history and context.
⚙️ Settings
- Session: Define the exact RTH Session hours (default is 09:30-16:00).
- History: Define how many historical gaps to keep on the chart.
- Gap Up / Gap Down: Toggle visibility and customize colors, fill transparency, and border styles.
- Midline: Toggle the visibility of the gap's 50% midline, and customize its style and color.
- Inner Levels: Toggle Quadrants or OTE subdivisions, and customize their styles and colors.
- Show Labels: Toggle price/ratio axis labels.
- Show Filled Gaps: When enabled, filled gaps turn gray and extend as dashed lines to the current candle. When disabled, filled gaps are completely removed from the chart.
- Alerts: Toggle the ability for the indicator to fire programmatic alerts.
⚡️ Showcase
RTH Gap - Default View
RTH Gap - OTE Levels
RTH Gap - Quadrant Levels
🚨 Alerts
This indicator includes built-in alert conditions ensuring you never miss a critical gap test. Once "Enable Alerts" is checked in the settings, you can configure TradingView to notify you when:
- An RTH Gap Up is fully filled.
- An RTH Gap Down is fully filled.
⚠️ Disclaimer
Trading involves significant risk, and many participants may incur losses. The content on this site is not intended as financial advice and should not be interpreted as such. Decisions to buy, sell, hold, or trade securities, commodities, or other financial instruments carry inherent risks and are best made with guidance from qualified financial professionals. Past performance is not indicative of future results.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
🔵 Tools that give you the edge: candelacharts.com/.
🔵 Join our free discord for updates: candelacharts.com/community
🔵 Join our free discord for updates: candelacharts.com/community
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
🔵 Tools that give you the edge: candelacharts.com/.
🔵 Join our free discord for updates: candelacharts.com/community
🔵 Join our free discord for updates: candelacharts.com/community
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.