OPEN-SOURCE SCRIPT
NQ Hourly Retracement Levels

# NQ Hourly Retracement Levels
## Overview
This indicator identifies key price levels derived from hourly opens and midpoints formed during the overnight session (6:00 PM – 7:00 AM New York time) and displays them at the start of the New York futures session (8:00 AM ET). Each level is annotated with a statistically-derived hit rate — the historical probability that price will retrace to that level at some point during the 8:00 AM – 4:00 PM NY futures session.
⚠️ IMPORTANT: These statistics are derived exclusively from NQ (Nasdaq 100 E-mini futures) 1-minute data spanning 2013–2025 (~3,785 trading days). They are only valid when applied to NQ futures. Do not use this indicator on ES, YM, RTY, equities, forex, crypto, or any other instrument — the hit rates will not apply.
---
## What Problem Does This Solve?
During the NY futures session, price frequently retraces to levels established in the overnight session before making its directional move. Knowing which overnight levels have the highest historical probability of being touched — and how far away price currently is from them — helps traders identify high-probability targets and plan entries accordingly.
Rather than eyeballing overnight structure, this indicator quantifies it: each level shown on the chart has been tested across thousands of sessions to determine how reliably price returns to it.
---
## How the Statistics Were Calculated
### Data
- Instrument: NQ (Nasdaq 100 E-mini Futures, continuous contract)
- Source data timeframe: 1-minute bars
- Date range: January 2013 – March 2025
- Total days analysed: ~3,785 NY trading sessions
### Methodology
For each trading day, the following were calculated for every hourly level from 12:00 AM through 7:00 AM NY time (opens and midpoints):
1. Level price — For opens, the first 1-minute bar's open at the start of that hour. For midpoints, the high-to-low midpoint of the entire hourly candle ((high + low) / 2).
2. Retracement check — During the NY futures session (8:00 AM – 4:00 PM ET), every 1-minute bar was checked to see if its high-low range contained the level price (i.e., low ≤ level ≤ high). If yes, the level was marked as "hit" for that day.
3. Hit rate — The percentage of days on which the level was hit: retraced_days / total_days × 100.
4. Session pattern — Each day was classified into one of four patterns based on the relationship between the London session range (2:00 AM – 8:00 AM) and the Asia session range (8:00 PM – 2:00 AM):
- London Engulfs Asia: London high > Asia high AND London low < Asia low
- Asia Engulfs London: Asia high ≥ London high AND Asia low ≤ London low
- London Partial Up: London high > Asia high AND London low ≥ Asia low
- London Partial Down: London low < Asia low AND London high ≤ Asia high
5. Pattern-conditional hit rates — Hit rates were recalculated separately within each of the four session patterns, giving more precise probabilities when the morning pattern is known.
6. Adverse Excursion (MAE) — For each retracement, the maximum adverse move was tracked: how far price moved away from the level (in % terms) before eventually hitting it. This was used to derive a typical "tolerance band" per level — the MAE % shown in the table. In the indicator, this value serves as a reference threshold: the Distance from Level column uses it to colour-code how close current price is to each level, giving a sense of whether the level is immediately in play or still some distance away.
### Important Caveats
- Hit rates are historical averages. Any individual session can and will deviate.
- Hit rates do not indicate direction — they only say that price touched the level, not whether it reversed or broke through.
- A level being "hit" does not constitute a trade signal. It is one input among many.
- Statistics are based on the continuous NQ futures contract. Minor differences may exist between contract months or between NQ and MNQ (Micro NQ).
---
## Levels Displayed
At 8:00 AM NY time, the indicator draws horizontal lines for up to 16 overnight levels, subject to the Minimum Hit Rate % filter. Levels are drawn from most recent to oldest:
- 7–8am Mid — High/low midpoint of the 7:00–8:00 AM hourly candle
- 7am Open — Open price of the 7:00 AM hour
- 6–7am Mid — High/low midpoint of the 6:00–7:00 AM hourly candle
- 6am Open — Open price of the 6:00 AM hour
- 5–6am Mid — High/low midpoint of the 5:00–6:00 AM hourly candle
- 5am Open — Open price of the 5:00 AM hour
- 4–5am Mid — High/low midpoint of the 4:00–5:00 AM hourly candle
- 4am Open — Open price of the 4:00 AM hour
- 3–4am Mid — High/low midpoint of the 3:00–4:00 AM hourly candle
- 3am Open — Open price of the 3:00 AM hour
- 2–3am Mid — High/low midpoint of the 2:00–3:00 AM hourly candle
- 2am Open — Open price of the 2:00 AM hour
- 1–2am Mid — High/low midpoint of the 1:00–2:00 AM hourly candle
- 1am Open — Open price of the 1:00 AM hour
- 12–1am Mid — High/low midpoint of the 12:00–1:00 AM hourly candle
- 12am Open — Open price of the 12:00 AM hour
Lines are colour-coded by their MAE tier (see MAE % explanation below) so you can visually distinguish tighter from wider levels at a glance. Each line is labelled with the level name and its hit rate percentage.
Lines extend bar-by-bar through the NY session and are optionally removed when price touches them (see Remove Level When Hit input).
---
## The Statistics Table
The table (displayed during the NY session) provides a live, per-bar reference for the top 11 levels. It has five columns:
### Column 1 — Level
The name of the overnight level (e.g. "7-8am Mid", "6am Open").
### Column 2 — Hit %
The historical hit rate for this level given today's session pattern. If the pattern cannot yet be determined, the overall (pattern-agnostic) hit rate is shown instead. Levels are listed in descending order of hit rate.
### Column 3 — MAE %
The typical Maximum Adverse Excursion tier for this level. This is the approximate percentage move away from the level that was observed in historical data before price eventually retraced — a rough guide to how much drawdown a position targeting this level may experience before it pays off.
MAE colour coding (also applied to the level lines on the chart):
- Blue (≤ 0.25%) — Very tight. Price tended to reach the level quickly with minimal adverse move.
- Purple (≤ 0.30%) — Tight. Small adverse excursion typical.
- Deep Orange (≤ 0.35%) — Moderate. Some heat expected.
- Teal (≤ 0.40%) — Moderate-wide.
- Orange (≤ 0.45%) — Wide. Requires more tolerance.
- Pink (≤ 0.50%) — Wide. Older or more distant levels.
### Column 4 — Dist Now (live, updates every bar)
The current distance between the last close price and the level, expressed as a percentage: abs(close − level) / close × 100.
Colour coding:
- Green — Distance ≤ MAE %. Price is within the typical adverse excursion range. Level is right here and very much in play.
- Yellow — Distance ≤ 2× MAE %. Price is approaching. Worth watching closely.
- Orange — Distance ≤ 3× MAE %. Level is possible but price needs to travel further to reach it.
- Grey — Distance > 3× MAE %. Level is far away, lower priority for the current bar.
Once a level has been hit, this cell shows "Hit ✓" in teal rather than a distance.
### Column 5 — Status
- Pending (yellow) — Level has not yet been touched this session.
- Hit ✓ (teal) — Price has traded through this level at some point during today's NY session.
### Header rows
- Active Session — Confirms the NY session is live (shown in red). Outside NY hours the table shows "Closed".
- Pattern — The detected London/Asia session pattern for today. This determines which set of conditional hit rates is shown.
- Active Levels — The number of level lines currently drawn on the chart (decreases as levels are hit and removed, if that option is enabled).
---
## Session Boxes
In addition to the level lines, the indicator draws session range boxes for three sessions:
- NY Session (8:00 AM – 4:00 PM ET) — Red by default
- London Session (2:00 AM – 8:00 AM ET) — Blue by default
- Asia Session (8:00 PM – 2:00 AM ET) — Orange by default
Each box tracks the high and low of its session in real time. These boxes serve both as visual context and as the input to the London/Asia pattern detection logic.
---
## Inputs Reference
### Trading Sessions
- Show NY Session (default: On) — Draws the NY session range box.
- NY Session Colour (default: Red) — Colour of the NY box border and background tint.
- Show London Session (default: On) — Draws the London session range box.
- London Session Colour (default: Blue) — Colour of the London box.
- Show Asia Session (default: On) — Draws the Asia session range box.
- Asia Session Colour (default: Orange) — Colour of the Asia box.
- Range Area Transparency (default: 90) — Opacity of the session box fill. 0 = fully opaque, 100 = invisible.
- Range Outline (default: On) — Whether to draw the session box border.
### Hourly Levels
- Show Hourly Levels at NY Open (default: On) — Master toggle. Draws all overnight levels at 8:00 AM.
- Show Hourly Opens (default: On) — Whether to include hourly open levels.
- Show Hourly Midpoints (default: On) — Whether to include hourly midpoint levels.
- Minimum Hit Rate % to Display (default: 75%) — Only levels with a hit rate at or above this threshold are drawn. Raise it to reduce clutter; lower it to see more levels. 75% is a reasonable default for NQ.
- Line Width (default: 1) — Thickness of the level lines. Range: 1–5.
- Retracement Line Style (default: Dashed) — Visual style of the level lines: Solid, Dashed, or Dotted.
- Label Size (default: Small) — Size of the text labels on each line: Tiny, Small, Normal, or Large.
- Remove Level When Hit (default: On) — When enabled, a level line and its label are deleted the moment price touches the level. Keeps the chart clean as the session progresses. Disable if you want all levels to remain visible throughout the session.
### Table Settings
- Show Statistics Table (default: On) — Master toggle for the stats table.
- Stats Table Position (default: Bottom Right) — Where the table appears on the chart. Options: Bottom/Middle/Top combined with Left/Center/Right.
- Stats Table Size (default: Small) — Text size inside the table: Auto, Tiny, Small, Normal, Large, or Huge.
---
## Recommended Usage
1. Apply only to NQ futures (CME: NQ1!, NQ continuous, or a specific front-month contract). The statistics do not transfer to other instruments.
2. Use on a timeframe of 1 minute to 15 minutes for the level lines and distance column to be most meaningful. On higher timeframes, individual bars may span several levels simultaneously.
3. Check the Pattern row in the table at the NY open. The indicator automatically applies pattern-conditional hit rates — so the percentages shown already reflect the historical accuracy for today's specific London/Asia relationship. The Asia Engulfs London pattern historically produces the highest hit rates across nearly all levels; London Engulfs Asia tends to produce the lowest. If the pattern shows as "Unknown" (rare, typically on the first bars of a chart load), the indicator falls back to overall hit rates.
4. Focus on green Dist Now cells at the NY open — these are levels price is already at or very close to. Green means you are within the typical adverse excursion zone, so risk is relatively defined.
5. Use the MAE % as a stop/risk guide — if price is at a level with a 0.25% MAE, a stop placed beyond 0.25% from the level is consistent with how the historical data behaved. This is not a hard rule but a statistical reference point.
6. Hit rate ≠ trade signal. A 94% hit rate on the 7–8am midpoint means price touched that level on 94% of historical days. It says nothing about whether price reversed, broke through, or what the risk/reward of any particular trade was.
---
## Known Limitations
- Replay / historical bars: The Dist Now column is live and reflects the current bar's close. On historical bars it will show the closing price of that bar, not today's live price.
- Pattern detection requires completed sessions: If the London or Asia session data is incomplete (e.g. on the first few bars of a new chart load), the pattern may show as "Unknown" and overall hit rates will be used instead of pattern-conditional rates.
- Level collisions: If two levels are very close in price (within ~0.5 points), their labels may overlap. Switching Label Size to Tiny can help if this is an issue on your layout.
- Contract rollovers: Around futures contract expiry, price gaps can cause overnight levels to be further from price than usual. Exercise judgement during roll weeks.
---
## Methodology Notes
Pattern classification, hit rate calculation, and adverse excursion analysis were computed from 12 years of NQ 1-minute data using Python (pandas). All times are New York (Eastern) time.
## Overview
This indicator identifies key price levels derived from hourly opens and midpoints formed during the overnight session (6:00 PM – 7:00 AM New York time) and displays them at the start of the New York futures session (8:00 AM ET). Each level is annotated with a statistically-derived hit rate — the historical probability that price will retrace to that level at some point during the 8:00 AM – 4:00 PM NY futures session.
⚠️ IMPORTANT: These statistics are derived exclusively from NQ (Nasdaq 100 E-mini futures) 1-minute data spanning 2013–2025 (~3,785 trading days). They are only valid when applied to NQ futures. Do not use this indicator on ES, YM, RTY, equities, forex, crypto, or any other instrument — the hit rates will not apply.
---
## What Problem Does This Solve?
During the NY futures session, price frequently retraces to levels established in the overnight session before making its directional move. Knowing which overnight levels have the highest historical probability of being touched — and how far away price currently is from them — helps traders identify high-probability targets and plan entries accordingly.
Rather than eyeballing overnight structure, this indicator quantifies it: each level shown on the chart has been tested across thousands of sessions to determine how reliably price returns to it.
---
## How the Statistics Were Calculated
### Data
- Instrument: NQ (Nasdaq 100 E-mini Futures, continuous contract)
- Source data timeframe: 1-minute bars
- Date range: January 2013 – March 2025
- Total days analysed: ~3,785 NY trading sessions
### Methodology
For each trading day, the following were calculated for every hourly level from 12:00 AM through 7:00 AM NY time (opens and midpoints):
1. Level price — For opens, the first 1-minute bar's open at the start of that hour. For midpoints, the high-to-low midpoint of the entire hourly candle ((high + low) / 2).
2. Retracement check — During the NY futures session (8:00 AM – 4:00 PM ET), every 1-minute bar was checked to see if its high-low range contained the level price (i.e., low ≤ level ≤ high). If yes, the level was marked as "hit" for that day.
3. Hit rate — The percentage of days on which the level was hit: retraced_days / total_days × 100.
4. Session pattern — Each day was classified into one of four patterns based on the relationship between the London session range (2:00 AM – 8:00 AM) and the Asia session range (8:00 PM – 2:00 AM):
- London Engulfs Asia: London high > Asia high AND London low < Asia low
- Asia Engulfs London: Asia high ≥ London high AND Asia low ≤ London low
- London Partial Up: London high > Asia high AND London low ≥ Asia low
- London Partial Down: London low < Asia low AND London high ≤ Asia high
5. Pattern-conditional hit rates — Hit rates were recalculated separately within each of the four session patterns, giving more precise probabilities when the morning pattern is known.
6. Adverse Excursion (MAE) — For each retracement, the maximum adverse move was tracked: how far price moved away from the level (in % terms) before eventually hitting it. This was used to derive a typical "tolerance band" per level — the MAE % shown in the table. In the indicator, this value serves as a reference threshold: the Distance from Level column uses it to colour-code how close current price is to each level, giving a sense of whether the level is immediately in play or still some distance away.
### Important Caveats
- Hit rates are historical averages. Any individual session can and will deviate.
- Hit rates do not indicate direction — they only say that price touched the level, not whether it reversed or broke through.
- A level being "hit" does not constitute a trade signal. It is one input among many.
- Statistics are based on the continuous NQ futures contract. Minor differences may exist between contract months or between NQ and MNQ (Micro NQ).
---
## Levels Displayed
At 8:00 AM NY time, the indicator draws horizontal lines for up to 16 overnight levels, subject to the Minimum Hit Rate % filter. Levels are drawn from most recent to oldest:
- 7–8am Mid — High/low midpoint of the 7:00–8:00 AM hourly candle
- 7am Open — Open price of the 7:00 AM hour
- 6–7am Mid — High/low midpoint of the 6:00–7:00 AM hourly candle
- 6am Open — Open price of the 6:00 AM hour
- 5–6am Mid — High/low midpoint of the 5:00–6:00 AM hourly candle
- 5am Open — Open price of the 5:00 AM hour
- 4–5am Mid — High/low midpoint of the 4:00–5:00 AM hourly candle
- 4am Open — Open price of the 4:00 AM hour
- 3–4am Mid — High/low midpoint of the 3:00–4:00 AM hourly candle
- 3am Open — Open price of the 3:00 AM hour
- 2–3am Mid — High/low midpoint of the 2:00–3:00 AM hourly candle
- 2am Open — Open price of the 2:00 AM hour
- 1–2am Mid — High/low midpoint of the 1:00–2:00 AM hourly candle
- 1am Open — Open price of the 1:00 AM hour
- 12–1am Mid — High/low midpoint of the 12:00–1:00 AM hourly candle
- 12am Open — Open price of the 12:00 AM hour
Lines are colour-coded by their MAE tier (see MAE % explanation below) so you can visually distinguish tighter from wider levels at a glance. Each line is labelled with the level name and its hit rate percentage.
Lines extend bar-by-bar through the NY session and are optionally removed when price touches them (see Remove Level When Hit input).
---
## The Statistics Table
The table (displayed during the NY session) provides a live, per-bar reference for the top 11 levels. It has five columns:
### Column 1 — Level
The name of the overnight level (e.g. "7-8am Mid", "6am Open").
### Column 2 — Hit %
The historical hit rate for this level given today's session pattern. If the pattern cannot yet be determined, the overall (pattern-agnostic) hit rate is shown instead. Levels are listed in descending order of hit rate.
### Column 3 — MAE %
The typical Maximum Adverse Excursion tier for this level. This is the approximate percentage move away from the level that was observed in historical data before price eventually retraced — a rough guide to how much drawdown a position targeting this level may experience before it pays off.
MAE colour coding (also applied to the level lines on the chart):
- Blue (≤ 0.25%) — Very tight. Price tended to reach the level quickly with minimal adverse move.
- Purple (≤ 0.30%) — Tight. Small adverse excursion typical.
- Deep Orange (≤ 0.35%) — Moderate. Some heat expected.
- Teal (≤ 0.40%) — Moderate-wide.
- Orange (≤ 0.45%) — Wide. Requires more tolerance.
- Pink (≤ 0.50%) — Wide. Older or more distant levels.
### Column 4 — Dist Now (live, updates every bar)
The current distance between the last close price and the level, expressed as a percentage: abs(close − level) / close × 100.
Colour coding:
- Green — Distance ≤ MAE %. Price is within the typical adverse excursion range. Level is right here and very much in play.
- Yellow — Distance ≤ 2× MAE %. Price is approaching. Worth watching closely.
- Orange — Distance ≤ 3× MAE %. Level is possible but price needs to travel further to reach it.
- Grey — Distance > 3× MAE %. Level is far away, lower priority for the current bar.
Once a level has been hit, this cell shows "Hit ✓" in teal rather than a distance.
### Column 5 — Status
- Pending (yellow) — Level has not yet been touched this session.
- Hit ✓ (teal) — Price has traded through this level at some point during today's NY session.
### Header rows
- Active Session — Confirms the NY session is live (shown in red). Outside NY hours the table shows "Closed".
- Pattern — The detected London/Asia session pattern for today. This determines which set of conditional hit rates is shown.
- Active Levels — The number of level lines currently drawn on the chart (decreases as levels are hit and removed, if that option is enabled).
---
## Session Boxes
In addition to the level lines, the indicator draws session range boxes for three sessions:
- NY Session (8:00 AM – 4:00 PM ET) — Red by default
- London Session (2:00 AM – 8:00 AM ET) — Blue by default
- Asia Session (8:00 PM – 2:00 AM ET) — Orange by default
Each box tracks the high and low of its session in real time. These boxes serve both as visual context and as the input to the London/Asia pattern detection logic.
---
## Inputs Reference
### Trading Sessions
- Show NY Session (default: On) — Draws the NY session range box.
- NY Session Colour (default: Red) — Colour of the NY box border and background tint.
- Show London Session (default: On) — Draws the London session range box.
- London Session Colour (default: Blue) — Colour of the London box.
- Show Asia Session (default: On) — Draws the Asia session range box.
- Asia Session Colour (default: Orange) — Colour of the Asia box.
- Range Area Transparency (default: 90) — Opacity of the session box fill. 0 = fully opaque, 100 = invisible.
- Range Outline (default: On) — Whether to draw the session box border.
### Hourly Levels
- Show Hourly Levels at NY Open (default: On) — Master toggle. Draws all overnight levels at 8:00 AM.
- Show Hourly Opens (default: On) — Whether to include hourly open levels.
- Show Hourly Midpoints (default: On) — Whether to include hourly midpoint levels.
- Minimum Hit Rate % to Display (default: 75%) — Only levels with a hit rate at or above this threshold are drawn. Raise it to reduce clutter; lower it to see more levels. 75% is a reasonable default for NQ.
- Line Width (default: 1) — Thickness of the level lines. Range: 1–5.
- Retracement Line Style (default: Dashed) — Visual style of the level lines: Solid, Dashed, or Dotted.
- Label Size (default: Small) — Size of the text labels on each line: Tiny, Small, Normal, or Large.
- Remove Level When Hit (default: On) — When enabled, a level line and its label are deleted the moment price touches the level. Keeps the chart clean as the session progresses. Disable if you want all levels to remain visible throughout the session.
### Table Settings
- Show Statistics Table (default: On) — Master toggle for the stats table.
- Stats Table Position (default: Bottom Right) — Where the table appears on the chart. Options: Bottom/Middle/Top combined with Left/Center/Right.
- Stats Table Size (default: Small) — Text size inside the table: Auto, Tiny, Small, Normal, Large, or Huge.
---
## Recommended Usage
1. Apply only to NQ futures (CME: NQ1!, NQ continuous, or a specific front-month contract). The statistics do not transfer to other instruments.
2. Use on a timeframe of 1 minute to 15 minutes for the level lines and distance column to be most meaningful. On higher timeframes, individual bars may span several levels simultaneously.
3. Check the Pattern row in the table at the NY open. The indicator automatically applies pattern-conditional hit rates — so the percentages shown already reflect the historical accuracy for today's specific London/Asia relationship. The Asia Engulfs London pattern historically produces the highest hit rates across nearly all levels; London Engulfs Asia tends to produce the lowest. If the pattern shows as "Unknown" (rare, typically on the first bars of a chart load), the indicator falls back to overall hit rates.
4. Focus on green Dist Now cells at the NY open — these are levels price is already at or very close to. Green means you are within the typical adverse excursion zone, so risk is relatively defined.
5. Use the MAE % as a stop/risk guide — if price is at a level with a 0.25% MAE, a stop placed beyond 0.25% from the level is consistent with how the historical data behaved. This is not a hard rule but a statistical reference point.
6. Hit rate ≠ trade signal. A 94% hit rate on the 7–8am midpoint means price touched that level on 94% of historical days. It says nothing about whether price reversed, broke through, or what the risk/reward of any particular trade was.
---
## Known Limitations
- Replay / historical bars: The Dist Now column is live and reflects the current bar's close. On historical bars it will show the closing price of that bar, not today's live price.
- Pattern detection requires completed sessions: If the London or Asia session data is incomplete (e.g. on the first few bars of a new chart load), the pattern may show as "Unknown" and overall hit rates will be used instead of pattern-conditional rates.
- Level collisions: If two levels are very close in price (within ~0.5 points), their labels may overlap. Switching Label Size to Tiny can help if this is an issue on your layout.
- Contract rollovers: Around futures contract expiry, price gaps can cause overnight levels to be further from price than usual. Exercise judgement during roll weeks.
---
## Methodology Notes
Pattern classification, hit rate calculation, and adverse excursion analysis were computed from 12 years of NQ 1-minute data using Python (pandas). All times are New York (Eastern) time.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.