QuantForge
en

How to build a VWAP pullback EA for MetaTrader

Automate a session-VWAP pullback strategy in MT4 or MT5: trend filter, pullback to VWAP, volume confirmation and risk sizing, built from blocks and backtested on your own data.

Start freeRead the docsFree plan, no card needed.

Updated 5 November 2026

The session VWAP is a moving reference that resets every day. A pullback strategy waits for the day’s trend, then buys a dip back to VWAP (or sells a rally up to it). This guide builds one from blocks, without writing MQL.

The rules

  • Trend: the price closed above the 50-period EMA on H1 (buys) or below it (sells).
  • Pullback: the last closed M15 bar’s low touched the session VWAP, and the bar closed back above it.
  • Confirmation: the bar’s tick volume was at least 1.5 times the average of the 20 bars before it.
  • Hours: only between 09:00 and 17:00 server time.
  • Risk: 1% of equity per trade, stop 15 pips beyond VWAP, target twice the stop, break-even at +15 pips.

Build it

On the onTick canvas:

  1. Once Per Bar on M15, so the rules are checked once, when a bar closes.
  2. Time / Session Filter from 9 to 17.
  3. Check Open Trades Count equals 0, so only one trade is open at a time.
  4. Condition (If A vs B): Close (shift 1, timeframe H1) greater than EMA 50 (H1). This is the trend filter.
  5. Condition: Low (shift 1) less or equal to VWAP (session), then another Condition: Close (shift 1) greater than VWAP (session). The VWAP operand reads the last closed bar, because a bar’s volume is only known when it closes.
  6. Volume spike with the factor 1.5 and 20 bars.
  7. Buy Now with 1% risk, stop 15 pips, take profit 30 pips.

Mirror the chain for sells (Close below EMA 50, High at or above VWAP, Close below VWAP) and end with Sell Now. Add Move to Break-Even at +15 pips so winners can’t turn into losers.

Test it

Import M1 history from your terminal and backtest at least a year with the 1-minute OHLC model. While playing back, look at days that trended and days that chopped around VWAP: chop is where this strategy loses, and it shows on the chart.

Ideas worth testing one at a time:

  • Remove the volume filter and compare: tick volume is a weak signal on some symbols.
  • Link the stop and target to inputs and optimise them with a forward test (Studio).
  • Add a Weekday filter if Mondays or Fridays behave differently in the monthly report.

Export it

Export .mq5 or .mq4, attach it to an M15 chart, and run it on a demo account first. Tick volume in MetaTrader depends on your broker’s feed, so results on another broker’s data can differ.

Related: volume and VWAP blocks in the reference and the no-code EA builder.

Frequently asked questions

What is VWAP in forex?

VWAP (volume-weighted average price) is the average price of the session, weighted by volume. In forex there is no central volume, so MetaTrader uses tick volume: the number of price changes per bar. QuantForge's session VWAP is the volume-weighted average of the typical price since midnight server time.

Why use VWAP for pullbacks?

Many intraday traders treat the session VWAP as the day's fair price. In a trend, price often comes back to it before continuing, which gives a defined place to enter with a nearby stop.

Which timeframe works best?

VWAP resets every day, so it suits intraday charts such as M5, M15 or M30. Test several on your own data: the best timeframe depends on the symbol and its sessions.

Build your first EA today

The free plan includes three projects, backtests on H1 to D1 over a year, MQL4/MQL5 export and the converter.

Start free

Keep exploring