The paper's rule: long above VWAP, short below, 1-minute
VWAP from 9:30 New York; from the 9:31 close, long above it and short below, a 1-minute close on the other side turning the position over; flat at 16:00, one contract.
- Trades
- 8,194
- Won
- 16.5%
- Profit factor
- 0.93
- Net
- −32.8%
- Worst drawdown
- −41.6%
- Worst trade
- −$405
MNQ1! · 1-minute · 23 October 2024 → 22 October 2026 · 2 years · 517 sessions · $0.75 a contract each side, one tick of slippage, $50,000 account, one contract
-10.0% in the first 16 months, -25.4% in the last 8. $0.50 a trade before costs.
//@version=6
// Suggested timeframe: 1-minute
strategy("NQ VWAP trend, the Zarattini and Aziz rule", overlay=true, initial_capital=50000, default_qty_type=strategy.fixed, default_qty_value=1,
commission_type=strategy.commission.cash_per_contract, commission_value=0.75, slippage=1, margin_long=0, margin_short=0)
// The paper's rule (Zarattini and Aziz, 2023): VWAP from the regular session only, 9:30 to 16:00 New York, built
// from each 1-minute candle's (high + low + close) / 3. Once the first candle closes, long above VWAP and short
// below; a 1-minute close on the other side turns the position over; flat at 16:00. One contract a trade
contracts = input.int(1, "Contracts", minval=1)
// New York's clock on 1-minute candles
inRth = not na(time(timeframe.period, "0930-1600", "America/New_York"))
canOrder = not na(time(timeframe.period, "0930-1559", "America/New_York")) // the last order fills by 15:59
ends16 = not na(time(timeframe.period, "1559-1600", "America/New_York"))
// The session's VWAP, started again on its 9:30 candle
var float cumPV = 0.0
var float cumV = 0.0
if inRth and not inRth[1]
cumPV := 0.0
cumV := 0.0
if inRth
cumPV += hlc3 * volume
cumV += volume
vwapRth = inRth and cumV > 0 ? cumPV / cumV : na
// Long above VWAP, short below: the order goes in on a candle's close and fills at the next candle's open
if canOrder and barstate.isconfirmed and not na(vwapRth)
if close > vwapRth and strategy.position_size <= 0
strategy.entry("Long", strategy.long, qty=contracts)
else if close < vwapRth and strategy.position_size >= 0
strategy.entry("Short", strategy.short, qty=contracts)
// Flat at 16:00, or at a short session's last candle
if ends16 or session.islastbar
strategy.close_all("16:00", immediately=true)
plot(vwapRth, "VWAP (9:30 to 16:00)", color=color.new(#3D69A8, 0), style=plot.style_linebr)