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?
VWAP Pivot Reversion is a mean-reversion day-trading strategy that combines two of the most widely watched intraday reference frameworks: the Volume Weighted Average Price (VWAP) and classic floor-trader pivot points. VWAP is the session's volume-weighted "fair value" line — the average price at which the market has actually traded so far that day, weighted by volume. Pivot points are objective support and resistance levels calculated from the previous completed day's high, low, and close. The strategy looks for moments when price has stretched far away from fair value and reacted to a structural level, then trades the expected pull-back toward the mean.
The approach is designed for range-bound and rotational intraday conditions rather than strong one-directional trends. Mean-reversion logic assumes that a price extended too far from its session average tends to be pulled back toward it — a tendency that is more reliable when a market is rotating around fair value than when it is trending hard. By requiring a pivot-level rejection in addition to the stretch, the strategy tries to avoid fading a move that simply keeps running.
As a learning tool, VWAP Pivot Reversion is well suited to traders who want to study how confluence between two independent concepts can filter signals. Instead of fading a naked stretch from VWAP (which can keep extending) or a naked pivot touch (which can slice straight through), it waits for both to agree on a freshly closed bar. This makes it a useful case study in objective, rules-based entry design. It is intended for educational analysis and demo experimentation — not as a shortcut to results.
How It Works
The strategy evaluates conditions once per newly closed bar on the selected timeframe, then checks for a confluence setup. Here is the logic in plain English:
- Session VWAP tracking: On every closed bar, the strategy adds that bar's typical price (high + low + close ÷ 3) multiplied by its volume to a running total, building a session-anchored VWAP. The cumulation resets each new calendar day, so VWAP always reflects the current session only.
- Daily pivot calculation: As each day completes, its high, low, and close are used to compute the standard pivot set for the next day: PP = (H+L+C)/3, R1 = 2·PP − Low, S1 = 2·PP − High, R2 = PP + (H−L), and S2 = PP − (H−L). The strategy needs at least one completed prior day before it can trade.
- Long signal (over-sold reversion): The strategy signals a potential buy when price has closed at least
MinStretchAtr × ATRbelow VWAP (an over-extension to the downside) and the bar dipped into a support pivot — touching S1, or otherwise S2 — but closed back above it, indicating the level held. The trade targets VWAP as the mean-reversion magnet. - Short signal (over-bought reversion): The strategy signals a potential sell when price has closed at least
MinStretchAtr × ATRabove VWAP and the bar poked a resistance pivot — R1, or otherwise R2 — but closed back below it, indicating rejection. The trade again targets VWAP. - Take-profit logic: The take-profit is always VWAP itself — a real, structural "fair value" magnet rather than an arbitrary fixed distance. As VWAP is recalculated each bar, the target reflects the live session mean.
- Stop-loss logic: The stop is placed
AtrStopMult × ATRbeyond the pivot that held — below the support for longs, above the resistance for shorts. Because it scales with the Average True Range (ATR), the stop automatically widens in volatile conditions and tightens in calm ones. - Reward-to-risk filter: Before sending an order, the strategy measures the distance to the VWAP target versus the distance to the stop. If the reward-to-risk ratio is below
MinRewardRisk, the setup is rejected — this screens out trades where price has already drifted too close to VWAP to justify the stop. - Spread and session gates: New entries are skipped when the current spread is wider than
MaxSpreadPoints, and only afterMinSessionBarshave elapsed so VWAP is stable. Only one position per magic number is held at a time. - End-of-session exit: Any open position is flattened at the daily roll, because VWAP and pivots reset for the new session. The structural stop, the VWAP target, or this daily reset manages every exit.

Strategy Parameters
| Parameter | Default | Min | Max | Description |
|---|---|---|---|---|
| AtrPeriod | 14 | 7 | 28 | Lookback length for the Average True Range, used by both the stretch filter and the protective stop. |
| AtrStopMult | 0.6 | 0.2 | 2.0 | Stop distance, expressed as a multiple of ATR, placed beyond the pivot that held. |
| MinStretchAtr | 1.0 | 0.3 | 3.0 | Minimum distance (in ATR multiples) price must be from VWAP to qualify as a genuine over-extension. |
| MinRewardRisk | 0.8 | 0.3 | 3.0 | Minimum acceptable reward-to-risk ratio; setups whose VWAP target is too close are rejected. |
| MinSessionBars | 8 | 1 | 60 | Minimum number of bars into the session before VWAP is treated as stable enough to trade. |
| MaxSpreadPoints | 80 | 5 | 300 | Maximum allowed spread (in points) for a new entry; wider spreads skip the trade. |
| Lots | 0.10 | 0.01 | 1.0 | Fixed order volume (lot size) for each position. |
| Magic | 5521 | 0 | 9,999,999 | Unique magic number used to identify and manage this strategy's orders. |

Recommended Chart Settings
VWAP Pivot Reversion is built for the classic home of VWAP-and-pivot day trading: a liquid FX major or a major index such as EURUSD, GBPUSD, or US500 (S&P 500). The natural timeframe range is M5 to M30, where intraday rotation around VWAP is most observable and pivot levels carry meaning. The strategy reads whatever timeframe the chart is set to, so you can backtest across this range to study how signal frequency and behavior change.
Because both VWAP and pivots reset daily, the strategy is inherently an intraday system and does not hold positions overnight. As always, results will vary considerably across different symbols, brokers, and market conditions — what looks balanced on one instrument may behave very differently on another.
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
Strengths of the approach. The defining feature of VWAP Pivot Reversion is its insistence on confluence. Requiring both an ATR-scaled stretch from VWAP and a pivot-level rejection filters out many of the false signals that a single-concept reversion system would take. The exits are fully objective: a structural ATR-based stop, a real VWAP target, and a hard daily flat. Everything is self-scaling to volatility, which means the same parameters behave consistently as market conditions expand and contract.
Known limitations. Mean-reversion strategies share a characteristic weakness: they tend to underperform in strong trends. When a market breaks out and trends persistently in one direction, an over-extension from VWAP can keep extending, and fading it repeatedly can produce a string of losing trades even with a pivot filter in place. The strategy also depends on tick volume for its VWAP — in forex, tick volume is a proxy for true traded volume, so the VWAP is an approximation rather than an exchange-grade figure. Finally, because it trades only once per magic and flattens daily, signal frequency can be low, which means a meaningful study requires a long sample.
Where it may underperform. Expect challenges during news-driven breakouts, low-liquidity sessions where spreads widen past the MaxSpreadPoints gate, and quiet ranges where ATR compresses and the stretch threshold is rarely met. Treat this EA as a framework for studying confluence-based reversion, not as a finished, market-proof system.
Risk Management Tips
Sound risk management matters far more than any single entry signal. As you study this strategy, keep these general principles in mind:
- Risk a small, fixed fraction per trade — many educational sources suggest no more than 1–2% of account equity on any single position. Size your lots accordingly rather than using a large default volume.
- Test on a demo account first. Run the EA on a demo or in the Strategy Tester for an extended period before considering any live use, so you understand its behavior across different conditions.
- Understand drawdown. Every strategy experiences losing streaks. Review the maximum drawdown in your testing and ask whether you could tolerate that decline emotionally and financially.
- Account for costs. Spreads, commissions, and slippage all erode mean-reversion edges, where targets are often modest. Make sure your testing reflects realistic trading costs.
- Never over-leverage. Leverage magnifies both gains and losses. Use conservative position sizing and avoid risking capital you cannot afford to lose.
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: VWAPPivotReversion.ex5 (1 downloads)
- Source Code: VWAPPivotReversion.mq5 (1 downloads)
- Documentation: VWAPPivotReversion.pdf (1 downloads)