PROTECTED SOURCE SCRIPT
Overnight Gap Detector

Overnight Gap Detector - 4H Body to Body
What it detects:
The indicator finds overnight gaps - i.e., gaps between trading days based on 4-hour (4H) candle data.
Gap Definition (Wick to Wick):
Gap UP: When yesterday's 4H candle's highest point (high) is BELOW today's 4H candle's lowest point (low) - there's "air" between them
Gap DOWN: When yesterday's 4H candle's lowest point (low) is ABOVE today's 4H candle's highest point (high)
Rectangle Drawing (Body to Body):
Although the gap is detected via wicks, the rectangle is only drawn between the bodies:
Gap UP: Draws from today's open to yesterday's body top (max of open/close)
Gap DOWN: Draws from yesterday's body bottom (min of open/close) to today's open
This means the rectangle does NOT cover the wicks, only the actual gap between bodies.
Midline:
50% line between top and bottom of the gap rectangle
Continues to the right along with the rectangle
Stops when the gap is filled
Gap Filled:
A gap is marked as "filled" when:
Gap UP: Price's close goes DOWN and reaches yesterday's body top
Gap DOWN: Price's close goes UP and reaches yesterday's body bottom
Important: Only close body counts, not wicks!
Visual Elements:
Green box: Gap Up (upward gap)
Red box: Gap Down (downward gap)
Yellow box: Filled gap
Labels: "GAP HOLE" when active, "FILLED gap" when filled
Midline: Dotted line through the middle of the gap
Features:
✅ Works on all timeframes (5min, 15min, 1H, 2H, 4H, etc.) - always uses 4H data
✅ Rectangles expand bar by bar until filled
✅ Customizable colors for gaps, borders, midlines, and labels
✅ Label position (inside or outside box)
✅ Toggle to show/hide labels and midlines
✅ Minimum gap size filter (%)
What it detects:
The indicator finds overnight gaps - i.e., gaps between trading days based on 4-hour (4H) candle data.
Gap Definition (Wick to Wick):
Gap UP: When yesterday's 4H candle's highest point (high) is BELOW today's 4H candle's lowest point (low) - there's "air" between them
Gap DOWN: When yesterday's 4H candle's lowest point (low) is ABOVE today's 4H candle's highest point (high)
Rectangle Drawing (Body to Body):
Although the gap is detected via wicks, the rectangle is only drawn between the bodies:
Gap UP: Draws from today's open to yesterday's body top (max of open/close)
Gap DOWN: Draws from yesterday's body bottom (min of open/close) to today's open
This means the rectangle does NOT cover the wicks, only the actual gap between bodies.
Midline:
50% line between top and bottom of the gap rectangle
Continues to the right along with the rectangle
Stops when the gap is filled
Gap Filled:
A gap is marked as "filled" when:
Gap UP: Price's close goes DOWN and reaches yesterday's body top
Gap DOWN: Price's close goes UP and reaches yesterday's body bottom
Important: Only close body counts, not wicks!
Visual Elements:
Green box: Gap Up (upward gap)
Red box: Gap Down (downward gap)
Yellow box: Filled gap
Labels: "GAP HOLE" when active, "FILLED gap" when filled
Midline: Dotted line through the middle of the gap
Features:
✅ Works on all timeframes (5min, 15min, 1H, 2H, 4H, etc.) - always uses 4H data
✅ Rectangles expand bar by bar until filled
✅ Customizable colors for gaps, borders, midlines, and labels
✅ Label position (inside or outside box)
✅ Toggle to show/hide labels and midlines
✅ Minimum gap size filter (%)
受保護腳本
此腳本以閉源形式發佈。 不過,您可以自由且不受任何限制地使用它 — 在此處了解更多資訊。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。
受保護腳本
此腳本以閉源形式發佈。 不過,您可以自由且不受任何限制地使用它 — 在此處了解更多資訊。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。