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 Rsi Swing Breakout strategy is a momentum-filtered, structure-confirmed breakout system built around the Relative Strength Index (RSI) — a popular momentum oscillator that measures the speed and magnitude of recent price changes on a 0–100 scale. Unlike most RSI systems, this is a trend-continuation approach: it trades with the prevailing move rather than fading it. The strategy combines just two ingredients, RSI and swing price structure, and each plays a deliberately different role.
The first ingredient is the momentum regime. Here the RSI is not read for the usual "oversold at 30, overbought at 70" exhaustion signals. Instead, its position relative to the 50 midline is used to judge which side currently controls order flow. When RSI sits comfortably above 50, buyers are considered to be in charge; when it sits well below 50, sellers are. The strategy only ever takes breakouts in that direction, which is intended to filter out the directionless breakouts that tend to fail inside a range.
The second ingredient is structure, expressed through swing pivots — pure price action with no extra indicators. A confirmed swing high is a bar whose high exceeds the bars on both sides of it; a swing low is the mirror image. These represent the levels the market itself has recently defended. As a learning tool, the Rsi Swing Breakout is well suited to traders who want to study how a momentum filter can be paired with objective price-structure rules to define both entries and risk.
How It Works
The strategy evaluates the market once per newly closed bar — it does not react to every tick. On each new bar it updates its record of the most recent confirmed swing high and swing low, recalculates the RSI, and then checks whether the conditions for a trade are met.
- Momentum filter (the regime): The strategy reads the current RSI value against 50. A bullish regime requires RSI to be at or above
50 + MomentumMargin; a bearish regime requires RSI to be at or below50 − MomentumMargin. The margin creates a neutral buffer zone around 50 so that only a decisively directional reading qualifies. - Long entry signal: A long is signalled only when the regime is bullish and the freshly closed bar closes above the most recent confirmed swing high, while the bar before it was still at or below that level. Requiring the prior bar to be on the other side of the level makes this a genuine break of structure to the upside — a true cross, not a late chase of a level price already left behind.
- Short entry signal: The short rule is the exact mirror. The regime must be bearish, the just-closed bar must close below the most recent confirmed swing low, and the prior bar must have been at or above that level — a clean break of structure to the downside.
- Stop-loss logic (structural): For a long, the stop is placed just under the most recent confirmed swing low, buffered by a fraction of the breakout bar's range (
StopBufferFrac). The reasoning is that if price falls back beneath the higher low that defined the up-leg, the continuation idea is no longer valid. For a short, the stop sits just above the most recent swing high. - Take-profit logic (R-multiple): The target is set at a fixed reward-to-risk multiple of the structural stop distance, controlled by
RewardRatio. Because both stop and target are derived from price structure rather than fixed pip values, the risk model self-scales across symbols and timeframes. - Trade management: The strategy holds only one position per magic number at a time and lets the structural stop and target manage the exit. It also skips any signal when the current spread is wider than
MaxSpreadPoints, helping to avoid entering during poor liquidity conditions.
Because swing highs, swing lows, and bar ranges are all price structure rather than indicators, RSI remains the only indicator in the entire system.

Strategy Parameters
| Parameter | Default | Min | Max | Description |
|---|---|---|---|---|
| RsiPeriod | 14 | 7 | 28 | RSI smoothing period — the momentum-regime gauge, read against its 50 midline. |
| MomentumMargin | 5.0 | 0.0 | 20.0 | How far RSI must sit beyond 50 before the regime is called decisively bullish or bearish. |
| SwingHalfWidth | 3 | 2 | 6 | Fractal half-width — a swing pivot must dominate this many bars on each side to be confirmed. |
| StopBufferFrac | 0.25 | 0.00 | 1.50 | Stop buffer beyond the protective swing level, expressed as a fraction of the breakout bar's range. |
| RewardRatio | 1.80 | 0.80 | 4.00 | Take-profit distance as a multiple of the structural stop distance. |
| MaxSpreadPoints | 30 | 1 | 200 | Skip the trade if the current spread (in points) is wider than this. |
| Lots | 0.10 | 0.01 | 1.00 | Order volume in lots. |
| Magic | 4827 | 0 | 9,999,999 | Magic number used to identify and manage this strategy's trades. |

Recommended Chart Settings
The Rsi Swing Breakout was designed with a trending major or metal in mind — for example GBPUSD or XAUUSD on the M15 or H1 timeframe. The logic suits a momentum / trend-continuation style: the RSI filter screens for a market that is already directional, while the swing break demands that price actually commit through prior structure before any risk is taken. This pairing is intended to skip the range-bound fake-outs where lone breakout entries tend to get chopped up. As with any strategy, behaviour and results will vary considerably across different instruments, timeframes, and market conditions, so treat these settings as a starting point for your own study rather than a fixed recipe.
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
The main strength of this approach is the deliberate separation of its two filters. RSI confirms that the market is already leaning in a direction, while the swing-break rule insists that price physically clears a structurally significant level before a trade is considered. The "fresh cross" requirement — demanding that the prior bar was on the other side of the level — is a thoughtful detail that helps avoid chasing breakouts long after the move has happened. The structural stop is also intuitive: it ties your risk directly to the price level that would invalidate the trade idea.
There are limitations worth understanding, too. RSI is a lagging momentum measure, so in fast reversals the regime filter may still read as bullish or bearish even as the move is turning. Breakout systems in general are prone to false breakouts, where price clears a level only to snap back — the momentum filter reduces but cannot eliminate this. The strategy is built for trending conditions; in quiet, sideways, or choppy markets it may produce fewer valid signals or a series of small losing trades as breakouts fail. Performance is also sensitive to the chosen SwingHalfWidth and MomentumMargin, which together determine how selective the system is. None of this makes the strategy good or bad — it simply means you should study how it behaves before committing real capital.
Risk Management Tips
Sound risk management matters far more than any single entry signal. Consider the following general principles as you study this EA:
- Risk a small, fixed fraction per trade. Many educators suggest risking no more than 1–2% of account equity on any single position, so that a string of losses does not threaten the account.
- Size positions to your stop, not the other way around. Because this strategy uses a structural stop, the distance to that stop varies. Adjust your lot size so the monetary risk stays consistent.
- Test on a demo account first. Run the strategy on a demo or backtest environment until you understand its trade frequency, drawdown behaviour, and how it reacts to different market regimes.
- Understand drawdown. Even a well-designed strategy will experience losing streaks. Knowing the historical depth and duration of drawdowns helps you stay disciplined.
- Avoid over-optimisation. Tuning parameters to fit past data perfectly often produces results that do not hold up going forward. Favour robust settings over fragile, curve-fitted ones.
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: RsiSwingBreakout.ex5 (2 downloads)
- Source Code: RsiSwingBreakout.mq5 (2 downloads)
- Documentation: RsiSwingBreakout.pdf (2 downloads)