OPEN-SOURCE SCRIPT
Regular Trading Hours Opening Range Gap (RTH ORG)

### Regular Trading Hours (RTH) Gap Indicator with Quartile Levels
**Overview**
Discover overnight gaps in index futures like ES, YM, and NQ, or stocks like SPY, with this enhanced Pine Script v6 indicator. It visualizes the critical gap between the previous RTH close (4:15 PM ET for futures, 4:00 PM for SPY) and the next RTH open (9:30 AM ET), helping traders spot potential price sensitivity formed during after-hours trading.
**Key Features**
- **Standard Gap Boxes**: Semi-transparent boxes highlight the gap range, with optional text labels showing day-of-week and "RTH" identifier.
- **Midpoint Line**: A customizable dashed line at the 50% level, with price labels for quick reference.
- **New: Quartile Lines (25% & 75%)**: Dotted lines (default width 1) mark the quarter and three-quarter points within the gap, ideal for finer intraday analysis. Toggle on/off, adjust style/color/width, and add labels.
- **High-Low Gap Variant**: Optional boxes and midlines for gaps between the prior close's high/low and the open's high/low—perfect for wick-based overlaps on lower timeframes (5-min or below recommended).
- **RTH Close Lines**: Extend previous close levels with dotted lines and price tags.
- **Customization Galore**: Extend elements right, limit historical displays (default: 3 gaps), no-plot sessions (e.g., avoid weekends), and time offsets for non-US indices.
**How to Use**
Apply to 15-min or lower charts for best results. Toggle "extend right" for ongoing levels. SPY auto-adjusts for its 4 PM close.
Tested on major indices—enhance your gap trading strategy today! Questions? Drop a comment.
Thanks to twingall for supplying the original code.
Thanks to The Inner Circle Trader (ICT) for the logical and systematic application.
**Overview**
Discover overnight gaps in index futures like ES, YM, and NQ, or stocks like SPY, with this enhanced Pine Script v6 indicator. It visualizes the critical gap between the previous RTH close (4:15 PM ET for futures, 4:00 PM for SPY) and the next RTH open (9:30 AM ET), helping traders spot potential price sensitivity formed during after-hours trading.
**Key Features**
- **Standard Gap Boxes**: Semi-transparent boxes highlight the gap range, with optional text labels showing day-of-week and "RTH" identifier.
- **Midpoint Line**: A customizable dashed line at the 50% level, with price labels for quick reference.
- **New: Quartile Lines (25% & 75%)**: Dotted lines (default width 1) mark the quarter and three-quarter points within the gap, ideal for finer intraday analysis. Toggle on/off, adjust style/color/width, and add labels.
- **High-Low Gap Variant**: Optional boxes and midlines for gaps between the prior close's high/low and the open's high/low—perfect for wick-based overlaps on lower timeframes (5-min or below recommended).
- **RTH Close Lines**: Extend previous close levels with dotted lines and price tags.
- **Customization Galore**: Extend elements right, limit historical displays (default: 3 gaps), no-plot sessions (e.g., avoid weekends), and time offsets for non-US indices.
**How to Use**
Apply to 15-min or lower charts for best results. Toggle "extend right" for ongoing levels. SPY auto-adjusts for its 4 PM close.
Tested on major indices—enhance your gap trading strategy today! Questions? Drop a comment.
Thanks to twingall for supplying the original code.
Thanks to The Inner Circle Trader (ICT) for the logical and systematic application.
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้มันเป็นโอเพ่นซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันการทำงานของสคริปต์ได้ ขอแสดงความชื่นชมผู้เขียน! แม้ว่าคุณจะสามารถใช้งานได้ฟรี แต่อย่าลืมว่าการเผยแพร่โค้ดซ้ำนั้นจะต้องเป็นไปตามกฎระเบียบการใช้งานของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมที่ ข้อกำหนดการใช้งาน
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้มันเป็นโอเพ่นซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันการทำงานของสคริปต์ได้ ขอแสดงความชื่นชมผู้เขียน! แม้ว่าคุณจะสามารถใช้งานได้ฟรี แต่อย่าลืมว่าการเผยแพร่โค้ดซ้ำนั้นจะต้องเป็นไปตามกฎระเบียบการใช้งานของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมที่ ข้อกำหนดการใช้งาน