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 VWAPRSI Reversion strategy is a mean-reversion trading system built around the Volume Weighted Average Price (VWAP) — a benchmark that blends price with traded volume to estimate the "fair value" of an instrument over a rolling window. The core idea behind mean reversion is simple to state and difficult to time: when price stretches unusually far from its statistical center, it has a historical tendency to drift back toward that center. This strategy attempts to identify those stretched moments and fade them, meaning it looks to trade against a short-term spike in the expectation that price snaps back toward the VWAP.
To avoid catching falling knives, VWAPRSI Reversion does not act on distance from VWAP alone. It layers a second, independent filter on top: the Relative Strength Index (RSI), a momentum oscillator that ranges from 0 to 100 and is widely used to flag when a market is "overbought" or "oversold." Here, RSI acts as an exhaustion gate — it must confirm that the move into the extreme is itself losing steam before a signal is allowed. A third requirement, a reversal candle printing in the intended trade direction, adds a final layer of timing confirmation. Stops are sized with the Average True Range (ATR), an indicator that measures recent volatility, so risk adapts to how active the market currently is.
As a learning tool, this strategy is well suited to traders who want to study how multiple confirmations can be combined into a single rules-based system, and how a take-profit target can be anchored to a dynamic reference (VWAP) rather than a fixed distance. It is best understood as a study in disciplined, condition-driven entries — not as a shortcut to returns. Mean-reversion logic typically performs differently in ranging markets than in strongly trending ones, a distinction this article will return to.
How It Works
The strategy evaluates its rules once per newly closed bar, never on every incoming tick, which keeps decisions tied to completed price action. It also holds only one position at a time per symbol — while a trade is open, it waits and lets the stop-loss and take-profit manage the outcome.
On each closed bar, the strategy builds its reference values and then checks for a signal:
- Rolling VWAP and bands: It computes a volume-weighted average price over the last
VwapPeriodbars using each bar's typical price (high + low + close, divided by three) weighted by tick volume. It then measures the standard deviation of closes around that VWAP and places an upper and lower band atBandMultstandard deviations away. These bands define what counts as "statistically stretched." - RSI exhaustion gate: It calculates RSI over
RsiPeriodbars. The oversold threshold isRsiOversold; the overbought threshold is automatically derived as100 − RsiOversold(for the default of 30, that means 70). - ATR volatility measure: It calculates ATR over
AtrPeriodbars to size the stop-loss in proportion to current volatility.
The strategy signals a long (buy) setup only when all three of these conditions align on the just-closed bar:
- The bar's close is below the lower band (price is stretched to the downside).
- RSI is below the oversold level (momentum confirms the move is over-extended).
- The bar is a bullish reversal candle (close above open, suggesting buyers are stepping in).
The strategy signals a short (sell) setup under the mirror-image conditions:
- The bar's close is above the upper band.
- RSI is above the overbought level.
- The bar is a bearish reversal candle (close below open).
When a long signal triggers, the entry is taken at the current ask price. When a short signal triggers, the entry is taken at the current bid price.
- Stop-loss logic: The stop is placed
AtrSlMult × ATRaway from entry — below entry for longs, above entry for shorts. Because it is ATR-based, the stop automatically widens in volatile conditions and tightens in calm ones. - Take-profit logic: The target is the VWAP itself — the "fair value" the strategy expects price to revert toward. This means the profit target moves with the market rather than being a fixed pip distance.
- Sanity checks: Before sending any order, the strategy verifies the target sits on the profitable side of entry and the stop sits on the protective side. If the geometry is invalid, it skips the trade entirely.

Strategy Parameters
| Parameter | Default | Min | Max | Description |
|---|---|---|---|---|
| VwapPeriod | 50 | 20 | 200 | Number of bars used to calculate the rolling VWAP and its standard-deviation bands. Larger values create a slower, smoother fair-value reference. |
| BandMult | 2.0 | 1.0 | 3.5 | How many standard deviations from VWAP price must close beyond to be considered "stretched." Higher values demand more extreme moves and produce fewer signals. |
| RsiPeriod | 14 | 5 | 30 | Lookback length for the RSI momentum oscillator. Shorter periods make RSI more reactive. |
| RsiOversold | 30 | 15 | 40 | The RSI oversold threshold for longs. The overbought threshold for shorts is derived automatically as 100 minus this value. |
| AtrPeriod | 14 | 5 | 30 | Lookback length for the ATR volatility measure used to size the stop-loss. |
| AtrSlMult | 1.5 | 0.5 | 4.0 | Multiplier applied to ATR to set the stop-loss distance from entry. Higher values give the trade more room but increase per-trade risk. |
| Lots | 0.10 | 0.01 | 1.0 | Fixed trade volume in lots for each position. Should be set in line with your account size and risk tolerance. |

Recommended Chart Settings
This strategy was designed as a general-purpose mean-reversion study and works conceptually on liquid instruments where VWAP and volume carry meaning — major forex pairs and index CFDs are common candidates. Intraday timeframes such as M15 to H1 are a reasonable starting point for studying mean-reversion behavior, since VWAP is a particularly popular reference among intraday traders. The default VwapPeriod of 50 bars covers a meaningful slice of the session on those timeframes.
That said, no single symbol or timeframe is universally "correct." Mean-reversion edges historically vary considerably across instruments and market regimes, so you should expect results to differ as conditions change. Always study the strategy's behavior on a demo account across several symbols and timeframes before drawing any conclusions.
How to Install on MetaTrader 5
- Download the .ex5 file from the link below
- Copy it to your MT5
MQL5\Expertsfolder - Restart MetaTrader 5 or refresh the Navigator panel
- Drag the EA onto a chart matching the recommended symbol and timeframe
- Configure the input parameters and enable Algo Trading
What to Consider Before Using This EA
The strength of VWAPRSI Reversion lies in its triple confirmation. Requiring a band breach, an RSI extreme, and a reversal candle all at once makes the entry selective, which can filter out many of the weak signals that a single-indicator system would take. Anchoring the take-profit to VWAP is also elegant in concept: the target adapts to the market rather than being an arbitrary fixed distance, and the ATR-based stop scales risk with volatility.
These same design choices, however, come with trade-offs you should understand. Mean-reversion systems are, by nature, vulnerable to strong trends. When a market breaks out and keeps running, "stretched" price can become more stretched — the strategy may fade a move that simply does not revert, and the stop is where that risk is realized. The reversal-candle and RSI filters reduce but do not eliminate this exposure. Because the take-profit is the VWAP and the stop is ATR-based, the reward-to-risk ratio is not fixed; in some setups price may sit close to VWAP already, producing a relatively small target compared to the stop. The strategy also trades one position at a time, so it can sit idle through long stretches when conditions never fully align.
The honest summary is that this is a thoughtfully constructed example of multi-filter mean reversion, not a finished, market-ready system. It is most valuable as something to study, test, and stress against different conditions — not as a tool to deploy unexamined.
Risk Management Tips
Sound risk management matters far more than any single entry rule. Consider these general principles as you study this or any strategy:
- Risk a small, fixed fraction per trade. Many educational sources suggest risking no more than 1–2% of account equity on any single position. Set your
LotsandAtrSlMultso the distance to your stop reflects that limit, rather than choosing a lot size in isolation. - Always start on a demo account. Test the strategy in simulated conditions long enough to see how it behaves across both ranging and trending markets before considering any live capital.
- Understand drawdown. Even a well-designed system experiences losing streaks. Know the largest peak-to-trough decline you are willing to tolerate, and recognize that historical drawdown may understate what the future holds.
- Avoid over-optimization. Tuning parameters until a backtest looks perfect often produces a system fitted to the past, not one robust to the future. Favor settings that behave sensibly across a range of conditions.
- Mind your costs. Spreads, commissions, and slippage all erode the modest targets typical of mean-reversion trades — account for them realistically.
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
- Expert Advisor: VWAPRSIReversion.ex5 (2 downloads)
- Source Code: VWAPRSIReversion.mq5 (2 downloads)
- Documentation: VWAPRSIReversion.pdf (4 downloads)