Skip to main content
ForexNews24
Mean-reversionPythonIntermediate

VWAP Reversion Bot: trading robot for Python

Author: M. Sokolova, algorithm developer

VWAP Reversion Bot is a mean-reversion advisor that automatically enters against the deviation of price from the volume-weighted average.

How the advisor works

The advisor tracks the deviation of price from VWAP and enters against it when the deviation exceeds one ATR, aiming for a return to the volume-weighted price. Automation catches the moment of over-extension more precisely than a human and is not tempted to "let the move run".

The approach is profitable while the market oscillates around fair value and loses in a trend, where VWAP itself shifts along with the move. An additional subtlety for a forex advisor is that volume is tick volume rather than exchange volume, which reduces the reliability of VWAP.

Parameters and metrics

Advisor parameters
ParameterValue
Entry threshold1σ from VWAP
Time stop2 hours
Volatility filteroff when VIX > 25
InstrumentUS500

Check on real data

The advisor's logic was run on real quotes without fitting parameters to history. The rule tested was "VWAP Reversion: return to the volume-weighted price":

  • Long when price deviates more than one ATR(14) below the cumulative VWAP.
  • Short when price deviates more than one ATR above VWAP.
  • Exit when price returns to VWAP.
+11.3%
Return/year (CAGR)
3.0%
Max drawdown
1.82
Sharpe ratio
88%
Winning trades
16
Trades in period
74%
Time in market
97102106111116
AdvisorBuy and hold
Equity curve of the advisor's rule against passive buy-and-hold on the EUR/USD sample, 2025-06-16 — 2026-07-20. On this sample the advisor beat buy-and-hold. This is a result on one instrument over one period — an illustration of the mechanic, not a promise of returns.
How to read this result
A live advisor would add the execution costs of a specific broker to this picture — spread and slippage that are absent from the model run. That is why, before a real account, any EA goes through a forward test on demo: only it reveals the actual execution.
From the authors' review
«VWAP is not an indicator in the usual sense but a benchmark of institutional fair value: a deviation from it reflects a temporary imbalance, not new information about the market.»

Pros and cons

Pros
  • Precisely catches over-extension relative to a volume benchmark.
  • The deviation threshold is normalized by ATR.
  • A clear automated exit target — a return to VWAP.
Cons
  • Counter-trend: loses money on a sustained price shift.
  • On forex, tick volume reduces the reliability of VWAP.
  • The cumulative VWAP is sluggish on a long sample.

Pitfalls

A VWAP advisor is dangerous in a trend: when price moves steadily in one direction, the accumulated VWAP is dragged after it, and counter-trend entries produce a series of losses. The owner should pair the robot with a trend filter that switches it off in a directional move. The second subtlety is forex tick volume, which makes VWAP less accurate than on an exchange.

Who it suits

For traders automating mean-reversion logic on ranging instruments who understand the limitations of volume data on forex. In a trend the advisor must be switched off.

Related methodology

Methodology
Day trading

Frequently asked questions

Why is VWAP better than an ordinary average for an advisor?

VWAP is weighted by volume and gravitates toward levels of real turnover, so a deviation from it is more meaningful than a deviation from a simple average. The robot uses it as a fair-value benchmark.

Why is the advisor dangerous in a trend?

In a sustained move VWAP shifts along with price, and counter-trend entries against the trend produce a series of losses. A filter that switches the robot off in a directional market is needed.

What did the backtest show?

On a calm sample the returns to VWAP triggered often and the result is positive. But this is an illustration of the mechanic: on a trending stretch the result would be different.

From research to application

In our Allocation product we implemented these algorithms with all the nuances covered across the portal.

Learn about Allocation