ETH to RTH Gap Detector

What It Does
This indicator identifies and tracks custom-defined gaps that form between Extended Trading Hours (ETH) and Regular Trading Hours (RTH). Unlike traditional gap definitions, this indicator uses a specialized approach - defining up gaps as the space between previous session close high to current session initial balance low, and down gaps as the space from previous session close low to current session initial balance high. Each detected gap is monitored until it's touched by price.
Key Features
- Detects custom-defined ETH-RTH gaps based on previous session close and current session initial balance
- Automatically identifies both up gaps and down gaps
- Visualizes gaps with color-coded boxes that extend until touched
- Tracks when gaps are filled (when price touches the gap area)
- Offers multiple display options for filled gaps (color change, border only, pattern, or delete)
- Provides comprehensive statistics including total gaps, up/down ratio, and touched gap percentage
- Includes customizable alert system for real-time gap filling notifications
- Features toggle options for dashboard visibility and weekend sessions
- Uses time-based box coordinates to avoid common TradingView drawing limitations
How To Use It
- Configure Session Times: Set your preferred RTH hours and timezone (default 9:30-16:00 America/New York)
- Set Initial Balance Period: Adjust the initial balance period (default 30 minutes) for gap detection sensitivity
- Monitor Gap Formation: The indicator automatically detects gaps between the previous session close and current session IB
- Watch For Gap Fills: Gaps change appearance or disappear when price touches them, based on your selected style
- Check Statistics: View the dashboard to see total gaps, directional distribution, and touched percentage
- Set Alerts: Enable alerts to receive notifications when gaps are filled
Settings Guide
- RTH Settings: Configure the start/end times and timezone for Regular Trading Hours
- Initial Balance Period: Controls how many minutes after market open to calculate the initial balance (1-240 minutes)
- Display Settings: Toggle gap boxes, extension behavior, and dashboard visibility
- Filled Box Style: Choose how filled gaps appear - Filled (color change), Border Only, Pattern, or Delete
- Color Settings: Customize colors for up gaps, down gaps, and filled gaps
- Alert Settings: Control when and how alerts are triggered for gap fills
- Weekend Session Toggle: Option to include or exclude weekend trading sessions
Technical Details
- The indicator uses time-based coordinates (xloc.bar_time) to prevent "bar index too far" errors
- Gap boxes are intelligently limited to avoid TradingView's 500-bar drawing limitation
- Box creation and fill detection use proper range intersection logic for accuracy
- Session detection is handled using TradingView's session string format for reliability
- Initial balance detection is precisely calculated based on time difference
- Statistics calculations exclude zero-division scenarios for stability
This indicator works best on futures markets with extended and regular trading hours, especially indices (ES, NQ, RTY) and commodities. Performs well on timeframes from 1-minute to 1-hour.
What Makes It Different
Most gap indicators focus on traditional open-to-previous-close gaps, but this tool offers a specialized definition more relevant to ETH/RTH transitions. By using the initial balance period to define gap edges, it captures meaningful price discrepancies that often provide trading opportunities. The indicator combines sophisticated gap detection logic with clean visualization and comprehensive tracking statistics. The customizable fill styles and integrated alert system make it practical for both chart analysis and active trading scenarios.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Untuk akses pantas pada carta, tambah skrip ini kepada kegemaran anda — ketahui lebih lanjut di sini.
Penafian
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Untuk akses pantas pada carta, tambah skrip ini kepada kegemaran anda — ketahui lebih lanjut di sini.