OPEN-SOURCE SCRIPT
NY Open Range Gap Reversal (M1D)

M1D NY Open Range Gap Reversal
OVERVIEW
A reference and marking tool for the New York Regular Trading Hours (RTH) opening gap. It maps the price and time levels of the classic open-gap "manipulation then reversal" sequence so a discretionary trader can read the session at a glance. It draws levels and flags conditions on closed bars — it does not place orders, produce buy/sell calls, or predict outcomes.
THE IDEA
At the 09:30 ET cash open a gap frequently forms between the prior session's 16:15 ET RTH close and today's open. That gap often produces an early "judas swing": a first push off the open that raids liquidity, fails, and reverses back through the gap toward a gap-fill draw. This indicator frames that sequence with objective, repeatable levels and time windows so the read is consistent from day to day.
WHAT IT DRAWS
- RTH Open (True Day Open) line, annotated with the day's gap size and direction.
- Opening-gap retracement levels at 25%, 50% (the primary draw, emphasised), 75%, and 100% (full fill = the prior RTH close).
- Shading of the 09:30-10:00 gap-fill window and a 10:00 checkpoint line.
- Opening Range high and low (first N minutes of RTH; default 30).
- Liquidity Sweep flag when the opening-range extreme is taken and price closes back inside (the manipulation leg).
- SMT divergence flag against two correlated index futures (default YM and ES), pivot-based. Each flag names which comparison index diverged (e.g. "SMT - YM"), so a one-sided divergence is distinguishable from both indices disagreeing.
- An info panel showing gap size, live gap-fill percentage, a countdown to the RTH close, the day's directional bias, and which SMT comparison symbols are in play.
- Right-margin labels that sit within a configurable ATR distance of each other are merged into one line of text instead of overlapping illegibly.
HOW IT WORKS
Session handling uses the exchange clock in the America/New_York timezone, so it is daylight-saving safe with no fixed offset. The gap is measured from the prior RTH session's 16:15 ET futures close to the current 09:30 ET open; the electronic/Globex 17:00 ET close is intentionally not used. Directional bias is derived from gap direction: a gap up frames a bearish fade toward the fill, a gap down frames a bullish fade. The Sweep and SMT modules only evaluate on days whose gap is at or above a configurable minimum. The minimum can be expressed as a multiple of the previous day's ATR (the default, 0.15, so the threshold scales with each instrument's own volatility), as a percentage of price, or in raw points. Both modules arm only after the opening range locks (SMT pivot history is still tracked through the range, so the first pivot after the lock has a same-session reference; an input allows SMT inside the range). By default an SMT flag requires BOTH comparison symbols to fail to confirm the chart's pivot; an input relaxes this to either one. A comparison symbol that tracks the same index as the chart cannot diverge from it, so that leg is automatically excluded and the info panel reports which symbols remain active. Line and label activity (extension and new Sweep/SMT detection) stops at a configurable cutoff (default 11:30 ET) and resumes automatically at the next session's open; the info panel is unaffected and keeps updating through the close. All detection is evaluated on bar close (barstate.isconfirmed) to avoid repainting, and prior-day drawings are removed at the 16:15 ET boundary so nothing carries into the next session.
HOW TO USE IT
Apply to CME equity-index futures (for example MNQ/NQ, MES/ES, MYM/YM) on an intraday execution timeframe such as 1-5 minute. Read the levels as context: the gap-fill levels are potential draws, the opening range and its sweep mark the manipulation leg, and the SMT flag marks a confirming (or diverging) move in the correlated indices. The trader decides where and how to act — the script does not mark an entry. Every module, colour, time window, label size, and the SMT symbol pair are adjustable in the settings.
INPUTS
Grouped controls for session times, the gap minimum (ATR-relative, percent, or points) and which fib levels to show, opening-range length, timing references, and the Sweep / SMT modules (symbol pair, pivot length, both-or-either divergence, bias filter). Every drawn line and label has its own colour, line style, and label text, on top of global controls for the brand colours, line width, label size, right-margin offset, and info-table position.
NOTES
- This is an indicator, not a strategy: it does not generate orders, alerts to enter, or performance results.
- It evaluates conditions on closed bars and does not repaint.
- Descriptions of how gaps have tended to behave are informational, not predictive.
DISCLAIMER
This script is provided for educational and informational purposes only. It is not financial advice and is not a recommendation to buy or sell any instrument. Trading futures carries a substantial risk of loss. Past behaviour is not indicative of future results. You are solely responsible for your own trading decisions. Test thoroughly before relying on it in any live environment.
OVERVIEW
A reference and marking tool for the New York Regular Trading Hours (RTH) opening gap. It maps the price and time levels of the classic open-gap "manipulation then reversal" sequence so a discretionary trader can read the session at a glance. It draws levels and flags conditions on closed bars — it does not place orders, produce buy/sell calls, or predict outcomes.
THE IDEA
At the 09:30 ET cash open a gap frequently forms between the prior session's 16:15 ET RTH close and today's open. That gap often produces an early "judas swing": a first push off the open that raids liquidity, fails, and reverses back through the gap toward a gap-fill draw. This indicator frames that sequence with objective, repeatable levels and time windows so the read is consistent from day to day.
WHAT IT DRAWS
- RTH Open (True Day Open) line, annotated with the day's gap size and direction.
- Opening-gap retracement levels at 25%, 50% (the primary draw, emphasised), 75%, and 100% (full fill = the prior RTH close).
- Shading of the 09:30-10:00 gap-fill window and a 10:00 checkpoint line.
- Opening Range high and low (first N minutes of RTH; default 30).
- Liquidity Sweep flag when the opening-range extreme is taken and price closes back inside (the manipulation leg).
- SMT divergence flag against two correlated index futures (default YM and ES), pivot-based. Each flag names which comparison index diverged (e.g. "SMT - YM"), so a one-sided divergence is distinguishable from both indices disagreeing.
- An info panel showing gap size, live gap-fill percentage, a countdown to the RTH close, the day's directional bias, and which SMT comparison symbols are in play.
- Right-margin labels that sit within a configurable ATR distance of each other are merged into one line of text instead of overlapping illegibly.
HOW IT WORKS
Session handling uses the exchange clock in the America/New_York timezone, so it is daylight-saving safe with no fixed offset. The gap is measured from the prior RTH session's 16:15 ET futures close to the current 09:30 ET open; the electronic/Globex 17:00 ET close is intentionally not used. Directional bias is derived from gap direction: a gap up frames a bearish fade toward the fill, a gap down frames a bullish fade. The Sweep and SMT modules only evaluate on days whose gap is at or above a configurable minimum. The minimum can be expressed as a multiple of the previous day's ATR (the default, 0.15, so the threshold scales with each instrument's own volatility), as a percentage of price, or in raw points. Both modules arm only after the opening range locks (SMT pivot history is still tracked through the range, so the first pivot after the lock has a same-session reference; an input allows SMT inside the range). By default an SMT flag requires BOTH comparison symbols to fail to confirm the chart's pivot; an input relaxes this to either one. A comparison symbol that tracks the same index as the chart cannot diverge from it, so that leg is automatically excluded and the info panel reports which symbols remain active. Line and label activity (extension and new Sweep/SMT detection) stops at a configurable cutoff (default 11:30 ET) and resumes automatically at the next session's open; the info panel is unaffected and keeps updating through the close. All detection is evaluated on bar close (barstate.isconfirmed) to avoid repainting, and prior-day drawings are removed at the 16:15 ET boundary so nothing carries into the next session.
HOW TO USE IT
Apply to CME equity-index futures (for example MNQ/NQ, MES/ES, MYM/YM) on an intraday execution timeframe such as 1-5 minute. Read the levels as context: the gap-fill levels are potential draws, the opening range and its sweep mark the manipulation leg, and the SMT flag marks a confirming (or diverging) move in the correlated indices. The trader decides where and how to act — the script does not mark an entry. Every module, colour, time window, label size, and the SMT symbol pair are adjustable in the settings.
INPUTS
Grouped controls for session times, the gap minimum (ATR-relative, percent, or points) and which fib levels to show, opening-range length, timing references, and the Sweep / SMT modules (symbol pair, pivot length, both-or-either divergence, bias filter). Every drawn line and label has its own colour, line style, and label text, on top of global controls for the brand colours, line width, label size, right-margin offset, and info-table position.
NOTES
- This is an indicator, not a strategy: it does not generate orders, alerts to enter, or performance results.
- It evaluates conditions on closed bars and does not repaint.
- Descriptions of how gaps have tended to behave are informational, not predictive.
DISCLAIMER
This script is provided for educational and informational purposes only. It is not financial advice and is not a recommendation to buy or sell any instrument. Trading futures carries a substantial risk of loss. Past behaviour is not indicative of future results. You are solely responsible for your own trading decisions. Test thoroughly before relying on it in any live environment.
Script open-source
Dans l'esprit TradingView, le créateur de ce script l'a rendu open source afin que les traders puissent examiner et vérifier ses fonctionnalités. Bravo à l'auteur! Bien que vous puissiez l'utiliser gratuitement, n'oubliez pas que la republication du code est soumise à nos Règles.
Clause de non-responsabilité
Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.
Script open-source
Dans l'esprit TradingView, le créateur de ce script l'a rendu open source afin que les traders puissent examiner et vérifier ses fonctionnalités. Bravo à l'auteur! Bien que vous puissiez l'utiliser gratuitement, n'oubliez pas que la republication du code est soumise à nos Règles.
Clause de non-responsabilité
Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.