Blog / Strategy
Strategy

VWAP Deviation Reversion

Disclaimer: This article is for educational and informational purposes only. It does not constitute financial or investment advice. Trading forex and CFDs carries significant risk of loss. Past performance of any strategy — including backtests — does not guarantee future results. Never trade with money you cannot afford to lose.

What Is This Strategy?

The Vwap Deviation Reversion strategy is a mean-reversion trading system built around VWAP (Volume Weighted Average Price), the single most widely watched intraday reference line used by institutional desks. VWAP is the average price of an instrument over a period, weighted by traded volume — large funds benchmark their order fills against it, which is part of why price tends to be repeatedly pulled back toward the VWAP line throughout a session. This strategy is designed to identify moments when price has stretched unusually far away from that average and may be due to "snap back."

Rather than chasing trends, the Vwap Deviation Reversion approach fades over-extension: it looks for bars that have closed well above or below VWAP and then begin to reverse. To measure "how far is too far," the strategy wraps deviation bands around a rolling, volume-weighted VWAP, calculated from the volume-weighted standard deviation of typical price. When a bar closes outside a band and momentum looks exhausted, the strategy treats VWAP itself as a magnet and targets a return to the mean.

This system is best understood as a learning tool for studying mean reversion and volatility-adaptive risk, not as a shortcut to results. It suits traders who want to see how VWAP, RSI (Relative Strength Index, a momentum oscillator), and ATR (Average True Range, a volatility measure) can be combined into a single rules-based filter. Because every component is self-scaling, it is a useful case study in how to build an entry, a structural target, and a volatility-based stop that all adapt to current market conditions.

How It Works

The strategy acts only once per newly closed bar on the chart's primary timeframe, so signals are evaluated on completed price action rather than flickering intrabar data. On each closed bar it rebuilds a rolling, volume-weighted VWAP and its deviation bands over the most recent VwapPeriod bars.

The core building blocks are:

A long (buy) setup signals when all three of these align on a freshly closed bar:

When a long signals, the strategy buys at the Ask, sets the take-profit at VWAP (the mean it expects price to revisit), and places the stop one ATR multiple below the entry.

A short (sell) setup is the mirror image:

When a short signals, the strategy sells at the Bid, targets VWAP, and places the stop one ATR multiple above the entry.

Two additional filters keep the system disciplined:

Finally, the strategy holds only one position per magic number at a time. Once in a trade, the ATR stop and the VWAP target manage the exit entirely — there is no averaging in or pyramiding.

VWAP deviation reversion strategy
Illustrative example of the strategy’s entry and exit logic — not real trading results.

Strategy Parameters

Parameter Default Min Max Description
VwapPeriod 30 10 120 Rolling window, in bars, used to compute the volume-weighted VWAP and its deviation bands.
BandMult 2.0 1.0 4.0 Band width as a multiple of the volume-weighted standard deviation. Higher values demand a larger stretch before a fade.
RsiPeriod 14 5 30 RSI lookback used to confirm momentum exhaustion at the band.
RsiOversold 35 10 45 RSI must be at or below this level to allow a long fade.
RsiOverbought 65 55 90 RSI must be at or above this level to allow a short fade.
AtrPeriod 14 5 30 ATR lookback used to measure recent volatility for the stop.
AtrStopMult 1.5 0.5 4.0 Stop distance as a multiple of ATR, placed beyond the entry.
MinRewardRisk 0.8 0.3 3.0 Minimum reward-to-risk ratio; setups with a VWAP target too close relative to the stop are rejected.
MaxSpreadPoints 80 5 300 Maximum allowable spread, in points, for a new entry.
Lots 0.10 0.01 1.0 Fixed order volume in lots.
Magic 7731 0 9,999,999 Unique magic number identifying this EA's positions.
VWAP deviation reversion strategy — MQL5 source code

Recommended Chart Settings

The Vwap Deviation Reversion strategy was designed with liquid intraday markets in mind — a major FX pair or an index such as EURUSD or US500 on the M5 to M15 timeframes, which is the natural home of VWAP reversion day-trading. These markets tend to have the consistent volume and orderly oscillation around VWAP that the strategy's logic relies on.

The expert advisor runs on whatever timeframe the chart is set to, so you can study its behavior across different timeframes. Keep in mind that results will vary considerably across different instruments and market conditions — a setting that behaves well on one symbol or volatility regime may behave very differently on another. Treat any configuration as a starting point for your own testing rather than a finished recipe.

How to Install on MetaTrader 5

What to Consider Before Using This EA

Every approach has trade-offs, and understanding them is part of trading well.

Strengths of this approach:

Known limitations:

The honest takeaway: this is a thoughtfully constructed mean-reversion framework that historically tends to perform best in balanced, range-bound conditions and may struggle in persistent trends. Study it, test it, and understand why it signals before drawing any conclusions.

Risk Management Tips

Sound risk management matters more than any single strategy. As you study this EA, keep these general principles in mind:

Risk Warning

Trading foreign exchange, CFDs, and other leveraged financial instruments involves substantial risk of loss and is not suitable for all investors. The strategies and tools discussed on this page are provided for educational purposes only and do not constitute financial advice, investment recommendations, or solicitation to trade. Always consult a qualified financial adviser before making trading decisions. Past backtest performance is not indicative of future results.

Downloads

← Back to Blog