Black Friday: 2 years for the price of 1.Or 3 months for the price of 1. On Pro.2 d 5 hleftSee plans →
Free tool

Fair value gap plus VWAP on NQ: does the combination hold up?

The textbook fair value gap retest tested on MNQ from 4 November 2024 to 22 October 2026 with no filter and with the VWAP from 18:00 or 9:30. Written in Pine Script? Paste it here: a free account with no card runs it on CME Group futures with $2.50 a contract and a tick of slippage charged.

Free plan · unlimited backtests · no card
MNQ's fair value gap retest at 2R · the VWAP from 18:00 against no filterMNQ1! · 5-minute · 4 November 2024 → 22 October 2026
VWAP from 18:00 over 2 years
−$9,328
No filter over 2 years
−$17,228
VWAP from 18:00 before costs
−$1,292
No filter before costs
−$7,632
VWAP from 18:00−$9,328
No filter−$17,228
Nov 2024Feb 2026Oct 2026

The $50,000 account at each day's end. One MNQ contract pays $2.50 a contract each side and a tick of slippage. Dashed: no VWAP filter. Shaded: from 24 February 2026.

Paste your script

Pine v6, as TradingView has it.

MNQ's fair value gap retest at 2R · the VWAP from 18:00 against no filterMNQ1! · 5-minute · 4 November 2024 → 22 October 2026
VWAP from 18:00 over 2 years
−$9,328
No filter over 2 years
−$17,228
VWAP from 18:00 before costs
−$1,292
No filter before costs
−$7,632
VWAP from 18:00−$9,328
No filter−$17,228
Nov 2024Feb 2026Oct 2026

The $50,000 account at each day's end. One MNQ contract pays $2.50 a contract each side and a tick of slippage. Dashed: no VWAP filter. Shaded: from 24 February 2026.

Not in our test. None of the three runs made money.

We ran the textbook fair value gap retest on MNQ 5-minute bars in New York hours from 4 November 2024 to 22 October 2026. It ran with no filter and with a VWAP filter: longs only above the VWAP and shorts only below it. The VWAP from the futures day's 18:00 open lost the least: $9,328 against $17,228 with no filter. The VWAP from 9:30 lost $20,497.50. Before costs all three still lost: $1,292 with the 18:00 VWAP and $7,632 with none.

The 3 runs and the check

FILTER AND COSTSTRADESWON2 YEARS4 NOV 2024 → 23 FEB 202624 FEB 2026 → 22 OCT 2026WORST DRAWDOWN
No filter · with costs1,78934.4%−$17,228−$14,160−$3,068−$18,892
VWAP from 18:00 · with costs1,50035.9%−$9,328−$8,935−$393−$11,664.50
VWAP from 9:30 · with costs1,57633.8%−$20,497.50−$14,509.50−$5,988−$22,082.50
No filter · no costs1,78934.5%−$7,632−$7,615.50−$16.50−$10,684.50
VWAP from 18:00 · no costs1,50035.9%−$1,292−$3,511.50+$2,219.50−$7,099.50
VWAP from 9:30 · no costs1,57633.9%−$12,039.50−$8,794.50−$3,245−$14,949

One MNQ contract on a $50,000 account pays $2.50 a contract each side and a tick of slippage. The 3 runs with costs were fixed before they ran. The same 3 with no costs were added after them as a check. They are the same trades. The worst drawdown is the deepest fall from a high between 4 November 2024 and 22 October 2026.

What the 18:00 VWAP changed

It took 1,500 trades against 1,789 with no filter and won 35.9% of them against 34.4%. Its worst drawdown was $11,664.50 against $18,892. Costs came to $5.36 a trade: $5 of commission plus a tick of slippage when a trade ended at its stop or at the day's close. Entries and targets are limit orders and pay none. Over two years that was $8,036. 428 of its trades reached the 2R target, 912 hit the stop and 150 closed at 16:00. The other 10 closed before 16:00 on the last bar of a holiday half day.

The script as it ran

NQ fair value gap retest with the VWAP from 18:00

Three 5-minute candles in New York hours leave a gap. A limit order waits 12 bars at its near side, longs only above the VWAP from the futures day's 18:00 open and shorts only below it. The stop sits at the first candle's far side and the target at 2R. Flat by 16:00. Its VWAP filter input switches to Off or From 9:30.

Trades
1,500
Won
35.9%
Profit factor
0.92
Net
−18.7%
Worst drawdown
−22.9%
Worst trade
−$1,386.50

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

−$8,935 from 4 November 2024 to 23 February 2026, −$393 from 24 February 2026 to 22 October 2026.

Pine Script v6 · 73 linesRun this script
//@version=6
// Suggested timeframe: 5-minute
strategy("NQ fair value gap retest with a VWAP filter", 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 target, how long a gap waits and the VWAP filter, all on New York's clock
rr       = input.float(2.0, "Target (R)", minval=0.5, step=0.5)
maxWait  = input.int(12, "Bars a gap waits for price to come back", minval=1)
vwapFrom = input.string("From 18:00", "VWAP filter", options=["Off", "From 18:00", "From 9:30"])

gapOk  = not na(time(timeframe.period, "0940-1500", "America/New_York")) and not session.islastbar
lastNY = not na(time(timeframe.period, "1555-1600", "America/New_York"))

// The VWAP the filter reads: from the futures day's 18:00 New York open, or from 9:30 only
var float cumPV    = 0.0
var float cumV     = 0.0
var float cumPV930 = 0.0
var float cumV930  = 0.0
if session.isfirstbar
    cumPV    := 0.0
    cumV     := 0.0
    cumPV930 := 0.0
    cumV930  := 0.0
cumPV += hlc3 * volume
cumV  += volume
if not na(time(timeframe.period, "0930-1600", "America/New_York"))
    cumPV930 += hlc3 * volume
    cumV930  += volume
vwapDay = cumV > 0 ? cumPV / cumV : na
vwap930 = cumV930 > 0 ? cumPV930 / cumV930 : na
vwapNow = vwapFrom == "From 18:00" ? vwapDay : vwapFrom == "From 9:30" ? vwap930 : na
// Longs only above the VWAP and shorts only below it. With the filter off both sides trade
longOk  = vwapFrom == "Off" or (not na(vwapNow) and close > vwapNow)
shortOk = vwapFrom == "Off" or (not na(vwapNow) and close < vwapNow)

// Three candles in New York hours. Bullish: the third candle's low is above the first candle's high.
// Bearish: the third candle's high is below the first candle's low. A limit order waits at the gap's
// near side with the stop at the first candle's far side and the target at rr times the risk
var float zEntry = na
var float zStop  = na
var int   zDir   = 0
var int   zBar   = 0
flat = strategy.position_size == 0
if flat and gapOk
    if low > high[2] and longOk
        strategy.cancel_all()
        zDir   := 1
        zEntry := low
        zStop  := low[2]
        zBar   := bar_index
        strategy.entry("Long", strategy.long, limit=zEntry)
        strategy.exit("Long exit", "Long", stop=zStop, limit=zEntry + rr * (zEntry - zStop))
    else if high < low[2] and shortOk
        strategy.cancel_all()
        zDir   := -1
        zEntry := high
        zStop  := high[2]
        zBar   := bar_index
        strategy.entry("Short", strategy.short, limit=zEntry)
        strategy.exit("Short exit", "Short", stop=zStop, limit=zEntry - rr * (zStop - zEntry))

// A gap price has not come back to within maxWait bars is dropped, and so is any after 15:00
if flat and zDir != 0 and (bar_index - zBar >= maxWait or not gapOk)
    strategy.cancel_all()
    zDir := 0

// Flat at 16:00, or on the session's last bar when the market closes early (a holiday half day) or
// halts for a long weekend: no order is left to fill when it opens again
if lastNY or session.islastbar
    strategy.cancel_all()
    strategy.close_all("Close", immediately=true)

plot(vwapNow, "VWAP", color=color.new(#E5A50A, 0), style=plot.style_linebr)

The same rules on stocks are in our fair value gap guide. The two VWAPs filter NQ's opening range in Does a VWAP filter improve the NQ opening range breakout?

Free account

No card, no time limit.

$0
  • Unlimited backtests, costs charged, with the out-of-sample check
  • The Pine script audit and the full trade list
  • The Pine Copilot writes and edits your script
  • 50 AI credits a day
The Alpha Charts terminal a free account opens: the Pine Copilot beside the chart

Prop Ready opens all two years of futures minute bars on a computer for $39 paid once and has 7 days money back. Pro adds the optimiser and every AI tool and has 30 days money back. See the plans

Questions

Fair value gap plus VWAP on NQ: does the combination hold up?

Not in our test. None of the three runs made money on MNQ 5-minute bars from 4 November 2024 to 22 October 2026. The VWAP from the futures day's 18:00 open lost the least: $9,328 against $17,228 with no filter. The VWAP from 9:30 lost $20,497.50. Before costs all three still lost: $1,292 with the 18:00 VWAP and $7,632 with none.

Which VWAP did the test use?

Two. One is the volume-weighted average price from the futures day's 18:00 New York open, the other from 9:30 only. A long needs the gap's third candle to close above it and a short below it. They are the VWAPs of our VWAP filter test on NQ's opening range.

What counts as a fair value gap here?

Three 5-minute candles in New York hours. Bullish: the third candle's low is above the first candle's high. Bearish: the third candle's high is below the first candle's low. A limit order waits at the gap's near side for 12 bars. Its stop sits at the first candle's far side and its target at 2R. It is our fair value gap guide's textbook retest set to MNQ and New York hours.

Is it the costs?

Partly. Costs came to $5.36 a trade. Before costs the three still lost: $7,632 with no filter, $1,292 with the 18:00 VWAP and $12,039.50 with the 9:30 VWAP.

Did it make money in 2026?

Not with costs. From 24 February 2026 to 22 October 2026 the 18:00 VWAP lost $393. No filter lost $3,068 and the 9:30 VWAP lost $5,988. Before costs the 18:00 VWAP made $2,219.50 there.

Can I run it myself?

Yes. Run opens the script on MNQ 5-minute bars in the Alpha Charts terminal. On a computer, a free account with no card runs it as published on all two years. Its VWAP filter input switches to Off or From 9:30. A changed input or line makes it your own script: a free account then tests the newest 30 days of a chart under an hour. Prop Ready ($39 paid once) opens all two years for 30 days.

Is a backtest a prediction?

No. It is what a strategy's rules would have done on past prices with costs charged. Live fills, news and your own execution differ. Read it as a test of the rules and not as a forecast.

Every number comes from Alpha Charts' tester on MNQ 5-minute bars from 4 November 2024 to 22 October 2026. The runs were made on 27 November 2026. Alpha Charts is software for testing trading scripts and gives no investment advice. A backtest shows what rules would have done on past data. It does not show what they will do. Our methodology is in Data and methodology. Updated 28 November 2026.

Test your Pine Script freeFree account, no cardPaste your script