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 Directional Flow Reservoir is a trend-following Expert Advisor (EA) for MetaTrader 5 that trades from a single custom quantity — a "leaky reservoir of directional pressure" — computed entirely from raw price data (open, high, low, close). Rather than relying on a classical indicator such as a moving average, RSI, or MACD, it builds its own signal from scratch: it measures how much net progress each bar makes relative to the market's typical activity, then accumulates that signed pressure into a fading memory that slowly leaks back toward zero. In plain terms, it is a momentum-and-regime system that tries to distinguish a genuine one-sided drift from directionless churn.
The core idea is a physical analogy. Imagine a tank that is filled, bar by bar, with signed "directional pressure" and that continuously leaks that pressure out over time. When steady buying or selling keeps charging the tank faster than it can drain, the reservoir level rises well above (or falls well below) what its own recent behaviour considers normal — the strategy reads that as a coherent directional regime and takes a position. When the flow becomes two-sided and choppy, the leak wins, the level drains back through zero, and the strategy steps aside.
As a learning tool, the Directional Flow Reservoir is well suited to traders who want to study how a self-calibrating momentum model behaves without any traditional indicator on the chart. It is designed for trending market conditions and is intended to sit out balanced, sideways phases. This article is a strategy analysis, not a profit opportunity — the goal is to understand the mechanics, the parameters, and the trade-offs so you can evaluate the approach on your own terms.
How It Works
The strategy acts once per completed bar. On each new bar it updates its internal reservoir value and then checks whether to manage an open trade or open a new one. Here is the logic in plain English:
- Typical churn (the scale): The EA first measures the average bar range (high minus low) over the last
Windowbars. This is the market's characteristic "activity budget" and is used to make every other number dimensionless and comparable across symbols. - Directional flow (the signal): For the just-closed bar it computes flow as (this close − previous close) ÷ average range. A value near 1 means the bar produced a full typical range's worth of net travel in one direction (high conviction); a value near 0 means lots of movement but little net progress (churn).
- The reservoir (fading memory): The flow is added to a leaky accumulator:
Reservoir = Retention × previous Reservoir + flow. Old pressure decays geometrically while fresh flow is added, so the reservoir is a running memory of recent directional pressure. Steady drift charges it up; chop lets the leak pull it back toward zero. - Self-calibrating band (the gate): The strategy computes the standard deviation of the last
Windowreservoir readings and multiplies it byThresholdK. This adaptive band defines what counts as "significant" pressure. In violent markets the band widens (fewer false starts); in calm markets it narrows (more responsive). No fixed threshold is hard-coded — it retunes itself every bar.
Entry conditions:
- The strategy signals a long when the reservoir rises above the positive band and is still building (higher than the previous reading) — charged bullish and strengthening.
- The strategy signals a short when the reservoir falls below the negative band and is still falling — charged bearish and strengthening.
- Only one position per magic number is allowed at a time. The EA never pyramids (never adds to an existing position).
Exit conditions:
- Reservoir release: A long is closed when the reservoir drops back to zero or below; a short is closed when it rises back to zero or above. This means the directional pressure that justified the trade has drained away.
- Volatility stop-loss: The stop distance is set to
StopAtrMult × ATR, where ATR (Average True Range, a common measure of volatility) is calculated by hand from recent bars. The stop breathes with current volatility. - Take-profit: The target is placed at
RewardRiskRatio × stop distancefrom entry. Because both stop and target scale with ATR, the risk-to-reward geometry stays consistent as volatility changes.
Whichever comes first — the reservoir-release exit or the ATR stop/target — closes the trade.

Strategy Parameters
| Parameter | Default | Min | Max | Description |
|---|---|---|---|---|
| Window | 20 | 8 | 60 | Number of bars used for the typical-churn scale and the reservoir-dispersion band. Larger values smooth the signal and slow reactions. |
| Retention | 0.85 | 0.50 | 0.97 | The reservoir leak retention (lambda). Higher values give the reservoir a longer directional memory; lower values make it forget quickly. |
| ThresholdK | 1.20 | 0.50 | 3.00 | Confidence multiple — how many reservoir standard deviations define "significant" pressure. Higher values demand stronger moves before entry. |
| AtrPeriod | 14 | 5 | 40 | Number of bars used to calculate ATR for the volatility stop and target. |
| StopAtrMult | 1.50 | 0.50 | 4.00 | Stop-loss distance expressed as a multiple of ATR. Larger values give the trade more room but increase risk per trade. |
| RewardRiskRatio | 1.80 | 1.00 | 4.00 | Take-profit distance as a multiple of the stop distance (the reward-to-risk ratio). |
| Lots | 0.10 | 0.01 | 1.00 | Fixed position size in lots for each trade. |

Recommended Chart Settings
The Directional Flow Reservoir is a single-timeframe strategy — every calculation uses the chart's own timeframe, so you attach it to one chart and it works from that period alone. Because the model is self-scaling (it divides everything by the market's typical range), it is not tied to one specific instrument. A reasonable starting point for study is a major forex pair such as EUR/USD on the H1 (1-hour) timeframe, which offers enough clean trending phases to observe the reservoir mechanics without excessive noise.
That said, no single setting is optimal everywhere. Results will vary considerably across different symbols, timeframes, and market conditions. Treat the recommended settings as a baseline for experimentation on a demo account, not as a fixed prescription. If you test on faster timeframes, expect more signals and more sensitivity to spread; on slower timeframes, expect fewer but potentially cleaner regimes.
How to Install on MetaTrader 5
- Download the
DirectionalFlowReservoir.ex5file 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 most interesting feature is that the Directional Flow Reservoir tunes its own entry threshold. Because the band is derived from the reservoir's own recent dispersion, the strategy adapts to changing volatility instead of relying on a fixed number that may suit one regime and fail in another. The dimensionless flow calculation also makes the logic transportable across symbols. The dual-exit design — reservoir release and an ATR stop — means a trade can be closed either when momentum fades or when price moves against it sharply, which is a thoughtful piece of risk logic to study.
Known limitations. Like all trend-following systems, this one is built for directional markets and will tend to underperform in ranging or choppy conditions, where it may enter on a burst of pressure only to be stopped out or released as the move fizzles. Because it acts once per completed bar, entries and exits happen at bar close rather than intrabar, which can introduce slippage relative to the signal. The self-calibrating band also has a subtle trade-off: during long quiet periods the band can become very tight, which may lead to more frequent, lower-quality signals. Finally, the fixed lot size does not scale position size to account equity, so risk per trade is not automatically proportional to your balance.
Where it may struggle. Expect weaker behaviour during news-driven whipsaws, tight consolidations, and low-liquidity sessions where the "typical range" scale can be distorted. No parameter set removes these structural challenges — they are inherent to momentum strategies and worth understanding before you commit real capital.
Risk Management Tips
Sound risk management matters more than any single entry rule. Consider these general principles as part of your education:
- Risk a small, fixed fraction per trade. Many educational sources suggest never risking more than 1–2% of account equity on a single position. Since this EA uses a fixed lot size, you may need to adjust the
Lotsinput to match your account size and the current ATR-based stop distance. - Test on a demo account first. Run the strategy in a risk-free simulated environment for an extended period before considering any live use. This lets you observe how it behaves across trending and ranging phases.
- Understand drawdown. Even a well-designed trend system will experience losing streaks during sideways markets. Know the maximum peak-to-trough decline you are prepared to tolerate, and size accordingly.
- Account for costs. Spread, commission, and slippage all erode results — especially on shorter timeframes with frequent trading. Factor these into any evaluation.
- Diversify and review. Avoid concentrating all risk in one symbol or one strategy, and review performance periodically rather than assuming a fixed setting will remain suitable forever.
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: DirectionalFlowReservoir.ex5 (0 downloads)
- Source Code: DirectionalFlowReservoir.mq5 (0 downloads)
- Documentation: DirectionalFlowReservoir.pdf (0 downloads)