OpenGaps

OPENGAPS
New Week and New Day Opening Gaps · a Pine v6 library
OpenGaps maps the opening gaps ICT teaches: the space price leaves behind when CME index futures stop for the weekend or the daily halt and reopen somewhere else. It is built as a module (a zord). Used on its own it maps opening gaps; imported into larger indicators, it becomes one part of something bigger.
It is a context map, not a signal generator. It shows you where the gaps are and how price has dealt with them since they opened; what you do with that is your call.
WHAT IT TRACKS
- New Week Opening Gap (NWOG): Friday's 17:00 ET close to Sunday's 18:00 ET open.
- New Day Opening Gap (NDOG): the 17:00 ET close to the 18:00 ET reopen.
- Consequent encroachment (C.E.): the 50% level of each gap, plus optional 25% and 75% quadrants.
- Fill tracking: each gap records when price first reached its C.E. and when it filled the gap by trading back to the prior close. Labels sit on the right with the gap's open stamp, for example NWOG 18:00 10/05 · C.E. hit. Hover a label for the prior close, the open, the size and the times.
- Event Horizon: the midpoint of the space between the nearest NWOG above price and the nearest below it (the upper gap's low to the lower gap's high). It is hidden while price sits inside a gap.
- Keeps the most recent N gaps of each kind. ICT keeps the last five NWOGs, about a month's worth.
HOW GAPS ARE FOUND
- Week: the first bar after a halt of 36 hours or more. The weekend halt is 49 hours, and mid-week holiday closures are under 30, so holiday Fridays and Monday reopens are measured from the true last close before the weekend, not from a calendar guess.
- Day: a new trading date, or the 18:00 ET reopen after a holiday early close. Halts in the middle of a session, such as limit locks and outages, are ignored.
- Checked against NQ 1-minute data from 2018 to 2026, including Good Friday, July 4, Juneteenth, Thanksgiving and Christmas weeks. Every NDOG falls on the 18:00 ET reopen.
- Intraday charts only. Full trading day, 18:00–17:00 ET, with no RTH split.
USING THE LIBRARY
Pine Script®
- Types: Style, Gap, GapSet.
- Functions: newSet(), newWeek(), newDay(), haltMinutes().
- Methods: update() on every bar; draw() and drawEH() on the last bar; above(), below() and eventHorizon() for other modules to read.
- Gap fields are open to the importing script: top, bottom, C.E., prior close, open, open time, C.E. time and fill time.
- Drawings count against the importing script's limits, so set max_lines_count and max_labels_count.
- Adding the library itself to a chart runs a demo with the default settings.
WORK IN PROGRESS
How often price really returns to a gap's C.E., fills it, or crosses the Event Horizon will be measured on NQ and ES 1-minute data, each tested against how often price reaches the same distance anyway. The results will be added in an update, so the levels come with tested numbers rather than claims.
CREDITS AND HOMAGE
- ICT (Michael J. Huddleston) taught the concepts: New Week and New Day Opening Gaps, consequent encroachment and the Event Horizon. Any mistakes in turning them into code are mine.
- fadizeidan wrote the open-source "ICT NWOG/NDOG" script (MPL 2.0) that this grew from. It has been rewritten for Pine v6 as a library: new gap detection, fill tracking, quadrants and drawings anchored to time.
- Not affiliated with or endorsed by either.
Open source under the Mozilla Public License 2.0, the same as the original. Use it, build on it, improve it.
New Week and New Day Opening Gaps · a Pine v6 library
OpenGaps maps the opening gaps ICT teaches: the space price leaves behind when CME index futures stop for the weekend or the daily halt and reopen somewhere else. It is built as a module (a zord). Used on its own it maps opening gaps; imported into larger indicators, it becomes one part of something bigger.
It is a context map, not a signal generator. It shows you where the gaps are and how price has dealt with them since they opened; what you do with that is your call.
WHAT IT TRACKS
- New Week Opening Gap (NWOG): Friday's 17:00 ET close to Sunday's 18:00 ET open.
- New Day Opening Gap (NDOG): the 17:00 ET close to the 18:00 ET reopen.
- Consequent encroachment (C.E.): the 50% level of each gap, plus optional 25% and 75% quadrants.
- Fill tracking: each gap records when price first reached its C.E. and when it filled the gap by trading back to the prior close. Labels sit on the right with the gap's open stamp, for example NWOG 18:00 10/05 · C.E. hit. Hover a label for the prior close, the open, the size and the times.
- Event Horizon: the midpoint of the space between the nearest NWOG above price and the nearest below it (the upper gap's low to the lower gap's high). It is hidden while price sits inside a gap.
- Keeps the most recent N gaps of each kind. ICT keeps the last five NWOGs, about a month's worth.
HOW GAPS ARE FOUND
- Week: the first bar after a halt of 36 hours or more. The weekend halt is 49 hours, and mid-week holiday closures are under 30, so holiday Fridays and Monday reopens are measured from the true last close before the weekend, not from a calendar guess.
- Day: a new trading date, or the 18:00 ET reopen after a holiday early close. Halts in the middle of a session, such as limit locks and outages, are ignored.
- Checked against NQ 1-minute data from 2018 to 2026, including Good Friday, July 4, Juneteenth, Thanksgiving and Christmas weeks. Every NDOG falls on the 18:00 ET reopen.
- Intraday charts only. Full trading day, 18:00–17:00 ET, with no RTH split.
USING THE LIBRARY
- Types: Style, Gap, GapSet.
- Functions: newSet(), newWeek(), newDay(), haltMinutes().
- Methods: update() on every bar; draw() and drawEH() on the last bar; above(), below() and eventHorizon() for other modules to read.
- Gap fields are open to the importing script: top, bottom, C.E., prior close, open, open time, C.E. time and fill time.
- Drawings count against the importing script's limits, so set max_lines_count and max_labels_count.
- Adding the library itself to a chart runs a demo with the default settings.
WORK IN PROGRESS
How often price really returns to a gap's C.E., fills it, or crosses the Event Horizon will be measured on NQ and ES 1-minute data, each tested against how often price reaches the same distance anyway. The results will be added in an update, so the levels come with tested numbers rather than claims.
CREDITS AND HOMAGE
- ICT (Michael J. Huddleston) taught the concepts: New Week and New Day Opening Gaps, consequent encroachment and the Event Horizon. Any mistakes in turning them into code are mine.
- fadizeidan wrote the open-source "ICT NWOG/NDOG" script (MPL 2.0) that this grew from. It has been rewritten for Pine v6 as a library: new gap detection, fill tracking, quadrants and drawings anchored to time.
- Not affiliated with or endorsed by either.
Open source under the Mozilla Public License 2.0, the same as the original. Use it, build on it, improve it.
Haftungsausschluss
Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.
Haftungsausschluss
Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.