NQ 15-minute opening range: the retest from 10:00 at 2R
The range is 9:30 to 9:45 New York. The day's first 5-minute close outside it is the break. A limit order then waits at the broken level while the break holds. It fills only from the 10:00 bar on. The stop sits at the range's other side and the target at 2R. One trade a day until 12:00. Its Entry input switches to Break or Retest at any time.
- Trades
- 370
- Won
- 44.3%
- Profit factor
- 1.11
- Net
- +9.1%
- Worst drawdown
- −9.6%
- Worst trade
- −$646
MNQ1! · 5-minute · 4 Nov 2024 → 22 Oct 2026 · $2.50 a contract each side and a tick of slippage · one contract on a $50,000 account
+$6,770.50 from 4 November 2024 to 23 February 2026, −$2,228.50 from 24 February 2026 to 22 October 2026.
//@version=6
// Suggested timeframe: 5-minute
strategy("NQ Opening Range: the retest from 10:00", overlay=true, initial_capital=50000, default_qty_type=strategy.fixed, default_qty_value=1,
commission_type=strategy.commission.cash_per_contract, commission_value=2.5, slippage=1, margin_long=0, margin_short=0)
// Inputs: the opening range, the entry window, the target and how to enter, all on New York's clock
orSess = input.session("0930-0945", "Opening range (New York)")
tradeSess = input.session("0945-1200", "Entry window (New York)")
rMult = input.float(2.0, "Target (R)", minval=0.5, step=0.5)
entryMode = input.string("Retest from 10:00", "Entry", options=["Break", "Retest at any time", "Retest from 10:00"])
inOR = not na(time(timeframe.period, orSess, "America/New_York"))
inTrade = not na(time(timeframe.period, tradeSess, "America/New_York"))
// An order placed at this bar's close can fill from the next bar, which opens when this one closes
nextOpen = hour(time_close, "America/New_York") * 60 + minute(time_close, "America/New_York")
fillOk = entryMode == "Retest at any time" or nextOpen >= 600
// The day's state, set back on the futures day's first bar (18:00 New York)
var float orHigh = na
var float orLow = na
var int tradesToday = 0
var int breakDir = 0
var int dayStart = 0
var float stopLevel = na
var float targetLevel = na
if session.isfirstbar
orHigh := na
orLow := na
tradesToday := 0
breakDir := 0
dayStart := strategy.closedtrades + strategy.opentrades
if inOR
orHigh := na(orHigh) ? high : math.max(orHigh, high)
orLow := na(orLow) ? low : math.min(orLow, low)
rangeSet = not inOR and not na(orHigh)
breakUp = rangeSet and close > orHigh and close[1] <= orHigh
breakDn = rangeSet and close < orLow and close[1] >= orLow
// The day's first break inside the window sets the side. Only that break is traded
if inTrade and barstate.isconfirmed and breakDir == 0 and tradesToday < 1
breakDir := breakUp ? 1 : breakDn ? -1 : 0
if breakDir != 0 and entryMode == "Break"
// Break: enter at the next bar's open with the stop at the range's other side
if breakDir == 1 and orLow < close
stopLevel := orLow
targetLevel := close + (close - orLow) * rMult
strategy.entry("Long", strategy.long)
strategy.exit("Long exit", from_entry="Long", stop=stopLevel, limit=targetLevel)
tradesToday := 1
if breakDir == -1 and orHigh > close
stopLevel := orHigh
targetLevel := close - (orHigh - close) * rMult
strategy.entry("Short", strategy.short)
strategy.exit("Short exit", from_entry="Short", stop=stopLevel, limit=targetLevel)
tradesToday := 1
// A filled retest is the day's one trade, even one that hits its stop or target on the bar it fills
if strategy.closedtrades + strategy.opentrades > dayStart
tradesToday := 1
// Retest: after the break, a limit order at the broken level until 12:00. It is placed only while
// the break holds (this bar closed beyond the level). From 10:00 it can fill only from the 10:00 bar
// on. The stop sits at the range's other side and the risk is the range itself
if entryMode != "Break" and inTrade and tradesToday < 1 and strategy.position_size == 0 and breakDir != 0
holds = breakDir == 1 ? close > orHigh : close < orLow
if fillOk and holds
if breakDir == 1
stopLevel := orLow
targetLevel := orHigh + (orHigh - orLow) * rMult
strategy.entry("Long", strategy.long, limit=orHigh)
strategy.exit("Long exit", from_entry="Long", stop=stopLevel, limit=targetLevel)
if breakDir == -1
stopLevel := orHigh
targetLevel := orLow - (orHigh - orLow) * rMult
strategy.entry("Short", strategy.short, limit=orLow)
strategy.exit("Short exit", from_entry="Short", stop=stopLevel, limit=targetLevel)
else
strategy.cancel("Long")
strategy.cancel("Short")
// An unfilled retest is cancelled when the window closes
if not inTrade and strategy.position_size == 0
strategy.cancel("Long")
strategy.cancel("Short")
// The same stop and target on every bar of the trade, and flat on the session's last bar
if strategy.position_size > 0
strategy.exit("Long exit", from_entry="Long", stop=stopLevel, limit=targetLevel)
if strategy.position_size < 0
strategy.exit("Short exit", from_entry="Short", stop=stopLevel, limit=targetLevel)
if session.islastbar
strategy.close_all("Session end", immediately=true)
plot(rangeSet ? orHigh : na, "Range high", color=color.new(#16A56A, 0), style=plot.style_linebr)
plot(rangeSet ? orLow : na, "Range low", color=color.new(#E5484D, 0), style=plot.style_linebr)
