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 Cumulative Delta Reversal strategy is an order-flow, mean-reversion system for MetaTrader 5 built around Cumulative Volume Delta (CVD) — a running tally of net buying versus net selling pressure. Ordinary price charts only tell you where the market went; CVD attempts to describe the force behind each move. This expert advisor (EA) uses that idea to look for price/CVD divergences, a classic exhaustion pattern where price grinds to a fresh extreme but the order flow driving it has quietly dried up.
Because most retail feeds do not include a true bid/ask tape, the strategy estimates signed volume from a single OHLCV (Open, High, Low, Close, Volume) series using the Close-Location Value (CLV) split. For each closed bar it calculates where the close landed inside the bar's range, multiplies that by the bar's tick volume, and adds the result to a running total. When price posts a new high but the CVD peak happened several bars earlier and has since rolled over, the EA reads that as buyers running out of conviction and signals a fade (short). The mirror-image logic applies at fresh lows for longs.
As a learning tool, this strategy suits traders who want to study order-flow concepts, divergence detection, and volatility-scaled risk without needing a specialized data feed. It is designed for counter-trend, reversal conditions rather than strong trending markets, and it is best explored on a demo account by anyone curious about how volume delta and price action can be combined into a rules-based system.
How It Works
The EA processes one signal per newly closed bar on the chart's current timeframe. On each closed bar it updates its running CVD, then scans a rolling window for divergences.
Building the order-flow tally:
- For the just-closed bar, it computes
clv = ((Close − Low) − (High − Close)) / (High − Low), a value between −1 (closed on the low) and +1 (closed on the high). - It multiplies CLV by the bar's tick volume to get that bar's delta (net directional pressure).
- It adds the delta to the Cumulative Volume Delta (CVD) running total and stores the bar's high, low, close, and CVD in lock-step history arrays.
The short (bearish divergence) signal — fading a top:
- The just-closed signal bar is the highest close in the lookback window.
- The CVD peaked at least
MinSeparationbars earlier than that price high. - CVD has since pulled back by at least
DivRatioof the window's total CVD range (confirming flow has faded from its peak). - The signal bar closes down versus the prior bar (the "first crack" of the reversal).
- When all conditions align, the strategy signals a Sell.
The long (bullish divergence) signal — fading a bottom:
- The signal bar is the lowest close in the window.
- The CVD troughed at least
MinSeparationbars earlier than the price low. - CVD has since recovered by at least
DivRatioof its range. - The signal bar closes up versus the prior bar.
- When all conditions align, the strategy signals a Buy.
Exit, stop-loss, and take-profit logic:
- Risk is fully volatility-scaled using the Average True Range (ATR), an indicator that measures typical bar-to-bar movement.
- The stop-loss is placed
AtrStopMult × ATRbeyond the entry price. - The take-profit is set at a
RewardRiskmultiple of that stop distance (a fixed reward-to-risk ratio). - Only one position per magic number is allowed at a time, so the ATR stop and RR target manage every exit — there is no separate trailing or signal-based close.
- New entries are skipped when the spread (in points) is wider than
MaxSpreadPoints, and when a matching position is already open.
Because it waits for a fresh extreme, a genuine flow divergence, and a confirming close, the strategy is intentionally selective — it may indicate relatively few setups rather than trading constantly.

Strategy Parameters
| Parameter | Default | Min | Max | Description |
|---|---|---|---|---|
| DivLookback | 24 | 8 | 80 | Rolling window (in bars) over which price and CVD extremes are compared. |
| MinSeparation | 3 | 1 | 20 | The CVD peak/trough must occur at least this many bars before the price extreme to count as a divergence. |
| DivRatio | 0.30 | 0.05 | 0.90 | Minimum CVD pullback (from peak) or recovery (from trough), as a fraction of the window's CVD range. |
| AtrPeriod | 14 | 5 | 40 | Lookback period for the ATR volatility measure. |
| AtrStopMult | 1.5 | 0.5 | 4.0 | Stop-loss distance as a multiple of ATR beyond the entry. |
| RewardRisk | 1.8 | 0.5 | 5.0 | Take-profit distance as a reward-to-risk multiple of the stop distance. |
| MaxSpreadPoints | 80 | 5 | 300 | Skips new entries when the current spread (in points) is wider than this. |
| Lots | 0.10 | 0.01 | 1.0 | Fixed lot size per trade. |
| Magic | 8842 | 0 | 9,999,999 | Unique identifier so the EA only manages its own positions. |

Recommended Chart Settings
The Cumulative Delta Reversal strategy is designed for a liquid FX major or an index where tick volume is a reasonable proxy for real order flow. Its natural home is the M5 to M30 timeframes, which balance enough bars to build a meaningful CVD history against the noise of very short intervals. The EA reads whatever symbol and timeframe the chart is set to, so simply attach it to a chart matching those conditions.
Keep in mind that tick volume is only an approximation of true traded volume, and its reliability varies by broker and instrument. Results will vary across different market conditions, symbols, and sessions, so treat these settings as a starting point for your own study rather than a fixed recommendation.
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. Divergence-based reversal systems can offer favorable reward-to-risk geometry because they aim to enter near an exhaustion point, close to a logical stop. Estimating flow from CLV means the strategy works on any standard OHLCV series without a specialized order-flow feed, which makes it a practical way to study volume-delta concepts. The multi-condition filter (fresh extreme + separated CVD divergence + confirming close) is deliberately conservative, which historically helps avoid many low-quality signals.
Known limitations. The biggest caveat is that tick volume is not real traded volume — it counts price updates, not contracts or lots. On thin instruments or during off-peak sessions, the CLV-based delta can be noisy and the divergence read less meaningful. Like all counter-trend methods, this strategy can underperform in strong, persistent trends, where price keeps making new extremes and "fading the high" repeatedly runs into the stop-loss. Divergence is also inherently a lagging pattern: it only becomes visible after the CVD peak has already formed and rolled back.
Market conditions to watch. Range-bound, choppy, or exhaustion phases tend to suit the logic better than breakout or momentum regimes. Sharp news spikes can widen spreads (partly mitigated by the MaxSpreadPoints filter) and trigger extremes that are not true reversals. Because only one position is open at a time with a fixed lot size, the strategy does not scale into positions or adapt size to account equity — something to consider in your own risk framework.
Risk Management Tips
Sound risk management matters more than any single entry rule. As you study this EA, consider these general principles:
- Risk only a small fraction per trade. Many educators suggest limiting risk to 1–2% of account equity on any single position. Adjust the
Lotsvalue so the ATR-based stop distance fits within that limit for your account size. - Test on a demo account first. Run the strategy in a risk-free simulated environment until you understand its behavior, signal frequency, and drawdown profile before considering real capital.
- Understand drawdown. Every strategy experiences losing streaks. Know the largest peak-to-trough decline you are willing to tolerate, and size positions so that a normal string of losses does not threaten your account.
- Account for costs. Spreads, commissions, and slippage all affect real-world outcomes, especially on shorter timeframes with frequent turnover.
- Keep parameters honest. Over-optimizing settings to fit past data (curve-fitting) often produces results that do not hold up going forward. Favor robust, sensible values over perfect historical fits.
- Never risk money you cannot afford to lose, and treat automated trading as a tool to be supervised, not a replacement for judgment.
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: CumulativeDeltaReversal.ex5 (49 downloads)
- Source Code: CumulativeDeltaReversal.mq5 (43 downloads)
- Documentation: CumulativeDeltaReversal.pdf (40 downloads)