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 FVGRSI Continuation strategy is a trend-continuation system that combines a Fair Value Gap (FVG) price pattern with the Relative Strength Index (RSI) momentum oscillator to time pullback entries on the MetaTrader 5 platform. A Fair Value Gap is a three-bar price imbalance — an unfilled "void" left on the chart when one candle displaces price so quickly that it skips over a range. The RSI is a classic momentum indicator that measures the speed and strength of recent price changes on a scale of 0 to 100. By pairing the two, this expert advisor (EA) waits for the market to retrace back into a fresh imbalance and only acts while momentum still confirms the original direction.
The thinking behind the approach is straightforward: a fresh Fair Value Gap marks an area of "inefficient" price delivery that the market often revisits, or "fills," before continuing in the direction of the original impulse. Rather than chasing a fast move after it has already run, the strategy waits patiently for price to pull back into the gap and enters there — historically a more favourable location with a tighter, structure-based stop-loss. The RSI filter is designed to keep the EA out of pullbacks that are actually the start of a reversal.
This strategy is best framed as a learning tool for traders who want to study how price-action concepts (imbalances and displacement) can be combined with a momentum filter inside a fully rule-based system. It is not a shortcut to results, and it will not suit every market or every account. If you are exploring how Smart Money and ICT-style FVG concepts can be coded objectively, the FVGRSI Continuation EA offers a clear, transparent example to dissect and test.
How It Works
The strategy maintains a small rolling memory of recently closed bars and tracks at most one active bullish zone and one active bearish zone at a time. All pattern detection happens on closed bars only, which avoids reacting to an unfinished candle that can still change shape.
Detecting the Fair Value Gap (the setup):
- On each newly closed bar, the EA inspects the three most recent closed candles (labelled shift 1 = newest, shift 2 = the displacement candle, shift 3 = oldest).
- A bullish FVG is recorded when the low of the newest bar sits above the high of the oldest bar (an unfilled upward gap) and the middle candle closed higher than it opened — confirming up-displacement.
- A bearish FVG is recorded when the low of the oldest bar sits above the high of the newest bar (an unfilled downward gap) and the middle candle closed lower than it opened.
- The gap must be at least
MinGapAtr× ATR wide. The Average True Range (ATR) measures recent volatility, so this filter ignores trivially small imbalances and scales with the instrument. - Each detected zone is given an expiry of
ZoneMaxAgeBarsbars. If price has not entered it by then, the zone is discarded as stale.
Entry conditions (the trigger):
- Long: While a bullish zone is active, the strategy signals a buy when the bid price retraces down into the gap band (at or below the upper edge) and RSI is at or above the
RsiTrendLevelmomentum threshold. - Short: While a bearish zone is active, the strategy signals a sell when the ask price retraces up into the gap band (at or above the lower edge) and RSI is at or below the symmetric threshold (100 −
RsiTrendLevel). - If price pushes fully through the gap (a long zone's bid falls below the lower edge, or a short zone's ask rises above the upper edge), the imbalance is considered violated and the zone is dropped without a trade.
- Only one position per symbol (matched by magic number) is allowed at a time, so the EA never stacks trades.
Stop-loss and take-profit logic:
- For a long, the stop-loss is placed a buffer of
AtrStopMult× ATR below the lower edge of the gap. For a short, it is the same buffer above the upper edge. This anchors the stop to market structure plus a volatility cushion. - The risk (entry minus stop) is measured, and the take-profit is set at
RewardRisk× that risk in the direction of the trade. With the default reward-to-risk of 1.8, a 20-pip risk would target roughly a 36-pip reward. - Once an order is sent, the zone is cleared so it cannot trigger a second entry.

Strategy Parameters
| Parameter | Default | Min | Max | Description |
|---|---|---|---|---|
| RsiPeriod | 14 | 5 | 30 | Look-back length for the RSI momentum calculation. Lower values react faster but produce noisier readings. |
| RsiTrendLevel | 52.0 | 45.0 | 65.0 | Momentum threshold a long must clear; the short threshold is mirrored as 100 − this value. Higher demands stronger momentum. |
| AtrPeriod | 14 | 5 | 40 | Look-back length for the ATR volatility measure used to size gaps and stops. |
| AtrStopMult | 1.2 | 0.3 | 4.0 | Multiplier of ATR added beyond the gap edge to place the stop-loss. Larger values give a wider, looser stop. |
| RewardRisk | 1.8 | 1.0 | 4.0 | Take-profit distance as a multiple of the measured risk. 1.8 targets 1.8 units of reward per unit of risk. |
| MinGapAtr | 0.25 | 0.0 | 1.5 | Minimum gap size (as a fraction of ATR) required to register an FVG. Filters out tiny, insignificant imbalances. |
| ZoneMaxAgeBars | 12 | 2 | 50 | Number of bars a zone stays valid before it expires unfilled. |
| Lots | 0.10 | 0.01 | 1.0 | Fixed trade volume in lots for each position. |
A Magic number input (default 990201) is also used internally so the EA can identify and manage only its own positions.

Recommended Chart Settings
The FVGRSI Continuation EA is built to run on a single symbol and a single timeframe — it reads the chart it is attached to and never hardcodes a market. Fair Value Gaps are most commonly studied on intraday timeframes such as the M15, M30, or H1, where displacement candles and clean imbalances appear frequently enough to test. Liquid instruments with consistent volatility — major forex pairs like EUR/USD or GBP/USD — are a sensible starting point for study because their ATR-based filters behave predictably.
Because the strategy adapts its gap and stop sizing to ATR, it can be applied across instruments, but its behaviour will differ markedly between calm, ranging conditions and fast, trending sessions. Always confirm that results hold up across different market conditions rather than assuming a single setting works everywhere.
How to Install on MetaTrader 5
- Download the
.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
The strengths of this approach are its clarity and discipline. Entries are anchored to a defined structural zone, the stop-loss is logical rather than arbitrary, and the RSI filter adds a second, independent layer of confirmation. The one-position-at-a-time rule and the volatility-scaled gap filter help keep the logic simple and consistent — qualities that make it a useful template for studying how two ideas can be combined cleanly.
There are real limitations to understand. Fair Value Gaps are a discretionary concept being forced into rigid rules, so the EA may flag imbalances that an experienced chartist would skip, and vice versa. In choppy, sideways markets, gaps form and fill rapidly, which can lead to zones being created and discarded with little follow-through. Momentum filters like RSI can also lag at major turning points, occasionally confirming a pullback that is really the beginning of a reversal. Periods of low volatility may shrink most gaps below the MinGapAtr floor, producing long stretches with no trades at all. Treat this strategy as a framework to study and stress-test — not as a finished, hands-off solution.
Risk Management Tips
Sound risk management matters more than any single entry signal. Consider these general principles as you study the strategy:
- Size positions conservatively. A common guideline is to risk no more than 1–2% of account equity on any single trade. The fixed
Lotsinput does not automatically scale to your balance, so calculate the monetary risk per trade yourself. - Always start on a demo account. Run the EA in a risk-free simulated environment until you understand exactly when and why it enters and exits.
- Understand drawdown. Even a well-designed rule set will go through losing streaks. Know the maximum peak-to-trough decline you are willing to tolerate before you ever go live.
- Test across conditions. Evaluate the strategy over trending, ranging, and high-volatility periods so you understand its weaknesses, not just its best days.
- Never trade with money you cannot afford to lose, and keep your expectations grounded in education rather than outcomes.
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: FVGRSIContinuation.ex5 (2 downloads)
- Source Code: FVGRSIContinuation.mq5 (2 downloads)
- Documentation: FVGRSIContinuation.pdf (2 downloads)