OPEN-SOURCE SCRIPT
ETH to RTH Gap Detector

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
How To Use It
Settings Guide
Technical Details
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.
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.
오픈 소스 스크립트
진정한 트레이딩뷰 정신에 따라 이 스크립트 작성자는 트레이더가 기능을 검토하고 검증할 수 있도록 오픈소스로 공개했습니다. 작성자에게 찬사를 보냅니다! 무료로 사용할 수 있지만 코드를 다시 게시할 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.
오픈 소스 스크립트
진정한 트레이딩뷰 정신에 따라 이 스크립트 작성자는 트레이더가 기능을 검토하고 검증할 수 있도록 오픈소스로 공개했습니다. 작성자에게 찬사를 보냅니다! 무료로 사용할 수 있지만 코드를 다시 게시할 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.