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?
Relative Vigor Trend Shift is a trend-following momentum strategy built around the Relative Vigor Index (RVI) — an oscillator that measures the conviction behind a price move rather than the price level itself. The core idea is simple and intuitive: in a genuine up move, the market tends to close near the top of each bar's range, and in a down move it closes near the bottom. RVI captures that behaviour by comparing the close-minus-open distance to the full high-minus-low range of each bar, smoothing the result, and then comparing it to its own signal line. When RVI crosses above its signal line, closing pressure is turning bullish; when it crosses below, closing pressure is turning bearish. That crossover is the "vigor shift" the strategy is named for.
The strategy is designed for liquid, trending markets — instruments such as EURUSD or XAUUSD (gold) on the M15 or H1 timeframe, where sustained directional drift gives momentum signals room to work. To avoid the classic weakness of any oscillator — being whipsawed by choppy, directionless price action — the strategy adds a single regime filter: a slow Exponential Moving Average (EMA), a moving average that weights recent prices more heavily. It only takes long signals when price is above that EMA and short signals when price is below it. This keeps trades aligned with the prevailing trend and filters out counter-trend crosses that tend to be noise.
As a learning tool, Relative Vigor Trend Shift is well suited to traders who want to study how momentum oscillators, trend filters, and volatility-based risk controls fit together in a single, deliberately compact system. It is best understood as a framework for analysing conviction-driven entries — not as a shortcut to a particular outcome. Treat it as a case study in disciplined strategy design.
How It Works
The strategy evaluates its rules once per newly closed bar, so signals are based on completed price action rather than an unfinished, flickering bar. Here is what it checks:
- Long entry — the strategy signals a buy when:
- The RVI line crosses up through its signal line (a bullish vigor shift), and
- The current close is above the trend EMA (price is in an uptrend regime), and
- The current spread is no wider than the
MaxSpreadPointslimit. - Short entry — the strategy signals a sell when:
- The RVI line crosses down through its signal line (a bearish vigor shift), and
- The current close is below the trend EMA (price is in a downtrend regime), and
- The spread condition above is also satisfied.
- Early exit — the strategy flattens an open position when:
- A long position is open and the opposite (bearish) vigor cross fires, or
- A short position is open and the opposite (bullish) vigor cross fires.
- The logic here is that the conviction that justified the trade has rolled over, so the position is closed rather than held to its stop.
- Stop-loss logic: Every entry is protected by a stop placed at a distance of
StopLossAtr× ATR from the entry price. ATR (Average True Range) is a measure of recent volatility, so the stop automatically widens in fast markets and tightens in calm ones. For a long, the stop sits below entry; for a short, above. - Take-profit logic: Each trade also receives a take-profit target at
TakeProfitAtr× ATR from entry. Because both the stop and target are expressed in ATR multiples, the reward-to-risk ratio stays consistent across symbols and timeframes — with the defaults, roughly 3 units of target for every 2 units of risk.
Two more rules keep exposure controlled. Only one position per Magic number is open at a time, so the strategy never pyramids into a runaway position. And order volume is normalised to the symbol's lot step and minimum/maximum limits, so the requested size is always valid for the broker.

Strategy Parameters
| Parameter | Default | Min | Max | Description |
|---|---|---|---|---|
| RviPeriod | 10 | 4 | 30 | Averaging length of the RVI oscillator (and the base for its num/den smoothing). Larger values give a smoother, slower oscillator. |
| AtrPeriod | 14 | 7 | 30 | Number of bars used to calculate ATR, which sizes both the stop and the target. |
| StopLossAtr | 2.00 | 0.50 | 5.00 | Protective stop distance expressed as a multiple of ATR. Higher values give the trade more room but risk more per position. |
| TakeProfitAtr | 3.00 | 0.50 | 8.00 | Take-profit distance expressed as a multiple of ATR. Sets the reward side of the reward-to-risk ratio. |
| TrendEmaPeriod | 100 | 20 | 250 | Length of the trend-filter EMA on closes. Longer values define a slower, more dominant trend regime. |
| MaxSpreadPoints | 30 | 1 | 200 | Maximum spread (in points) allowed at entry. Trades are skipped when the spread is wider, avoiding poor fills. |
| Lots | 0.10 | 0.01 | 1.00 | Base order volume, normalised to the symbol's lot step and min/max limits. |
| Magic | 7310 | 0 | 9,999,999 | Unique identifier so the EA manages only its own positions on the chart. |

Recommended Chart Settings
Relative Vigor Trend Shift was designed with liquid trending instruments in mind — for example EURUSD or XAUUSD (gold) — on the M15 or H1 timeframe. These conditions give the RVI crossover and the trend EMA enough clean, directional movement to work with, which is where a momentum-plus-trend-filter approach is most at home.
Keep in mind that results will vary considerably across different symbols, timeframes, and market conditions. A setting that behaves well on one instrument during a trending phase may behave very differently on another instrument, or on the same instrument during a range-bound period. Always test any configuration on your own broker's data before drawing 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
Like every strategy, Relative Vigor Trend Shift has clear strengths and equally clear limitations. Understanding both is part of using it responsibly.
Strengths. The design is deliberately compact — one oscillator, one trend filter, and one volatility-based risk model — which keeps the parameter search space small and reduces the temptation to overfit. Because RVI reads where price actually commits to close within each bar, it reflects real order-flow conviction rather than price level alone. Gating those signals with a trend EMA keeps the strategy on the side of the dominant drift and helps it sidestep much of the mid-range whipsaw that plagues raw oscillator crossovers. The ATR-based stop and target also adapt automatically to volatility across different symbols and timeframes.
Limitations. RVI is still an oscillator, and in genuinely sideways or news-driven markets it can produce clusters of false crosses. The trend EMA filters many of these, but no filter is perfect — during choppy conditions the strategy may take a series of small losing trades before the market picks a direction. Because it trades one position at a time with a fixed reward-to-risk profile, it can also give back open profit when the early-exit rule closes a trade on an opposite cross that later reverses. And like all trend-following systems, it tends to underperform during extended ranging periods and shine only when a market actually trends.
The honest takeaway: this is an educational framework for studying momentum-with-regime-filtering, not a set-and-forget solution. Its behaviour depends heavily on the market environment.
Risk Management Tips
Sound risk management matters far more than any single entry rule. Whatever strategy you study, keep these general principles in mind:
- Risk only a small fraction per trade. Many educational sources suggest risking no more than 1–2% of your account on any single position, so that a string of losses cannot do lasting damage.
- Size positions to your stop, not your hopes. Use the ATR-based stop distance to work backwards to a lot size that respects your per-trade risk limit, rather than trading a fixed lot regardless of volatility.
- Start on a demo account. Test the strategy and its parameters on a demo or paper account first, until you understand how it behaves in different conditions.
- Understand drawdown. Every strategy experiences losing streaks. Study the depth and duration of drawdown you would need to tolerate before committing real capital.
- Never rely on a single strategy or a single market. Diversification and realistic expectations are core parts of managing risk.
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: RelativeVigorTrendShift.ex5 (0 downloads)
- Source Code: RelativeVigorTrendShift.mq5 (0 downloads)
- Documentation: RelativeVigorTrendShift.pdf (0 downloads)