The RSI Engine v2.1
The RSI Engine is a multi-signal RSI-based Expert Advisor that trades bullish/bearish divergences and overbought/oversold reversals with optional centerline confirmation. It includes risk management with dynamic lot sizing, trailing stops, daily profit/loss limits, news filtering, and configurable trading hours. The EA opens one position at a time and manages exits via RSI level crosses or trailing stops.
Open the interactive view (equity curve, symbol switch)Key facts
Backtest results (H1, about 1 year)
| Symbol | P&L | Annual | Max DD | Trades | Win rate | Sharpe | Recovery | Losing streak | Per trade | Status |
|---|---|---|---|---|---|---|---|---|---|---|
| EURUSD | 0.00% | 0.00% | 0.00% | 0 | — | — | — | — | — | Not convertible yet |
| GBPUSD | 0.00% | 0.00% | 0.00% | 0 | — | — | — | — | — | Not convertible yet |
| USDJPY | 0.00% | 0.00% | 0.00% | 0 | — | — | — | — | — | Not convertible yet |
| XAUUSD | 0.00% | 0.00% | 0.00% | 0 | — | — | — | — | — | Not convertible yet |
Why this EA never traded: no entry rule survived the conversion.
Converted from MQL5 to Python and run with the same rules for every EA. Positions use MT5 lot sizes (100,000 units per FX lot, 100 oz per gold lot) with 1:100 leverage, one order at a time, and a stop-out below 10% of the starting balance. Sharpe is computed from the equity curve. Results marked as unreliable are shown for completeness only.
Blow-up risk: No blow-up pattern found
None of the usual blow-up patterns were found in the code, and the account was not stopped out in our backtests. That is not a guarantee: any EA can lose money.
High: stopped out in our backtest, or martingale/grid sizing without a stop loss. Elevated: martingale or grid sizing with a stop loss, or several positions at once without a stop loss. What the label means and what we found →
Strategy analysis
The strategy is centered on mean reversion trading using the RSI indicator, exploiting divergences between price and RSI to capture potential reversal opportunities. Entry conditions come in two forms: RSI divergence signals where price makes a new low but RSI does not (bullish divergence) or price makes a new high but RSI does not (bearish divergence), and overbought/oversold reversal signals where RSI crosses out of extreme zones. An optional 50-centerline confirmation requires RSI to cross the 50 level before entry, improving signal reliability. Exit conditions include closing positions when RSI reaches the opposite extreme zone and a trailing stop that locks in profits once a trigger threshold is met. Position sizing supports both fixed lots and dynamic lot calculation based on risk percentage, equity, and stop loss distance. Money management features daily profit/loss limits that halt trading when targets are reached, along with news time and trading hour filters to avoid high-risk periods.
Strengths
- Multi-signal fusion combining RSI divergence, overbought/oversold reversal, and centerline confirmation improves signal quality
- Comprehensive risk management including dynamic lot sizing, daily P/L limits, trailing stops, and margin checks
- Thorough filtering mechanisms with news time and trading hour filters to avoid high-risk periods
- Clean code architecture with modular functions, clear logic layering, and easy maintainability
- New bar detection mechanism prevents duplicate trades within the same bar, reducing unnecessary signal triggers
Weaknesses
- Oversimplified divergence detection only compares the lowest/highest points of two halves, potentially generating many false signals
- Single position limitation prevents holding both long and short simultaneously, reducing strategy flexibility
- IsPositionOpen checks magic number without symbol filtering, which may cause conflicts when running on multiple instruments
- News filter only supports a single news event time per day, unable to handle multiple important news releases
- Daily P/L calculation only adds floating profit from the first matching magic number position, ignoring multi-position scenarios
- No spread filter: as a mean reversion strategy, entering during low-liquidity periods can suffer from high spread costs
Possible improvements
- Improve divergence detection by identifying RSI local extremes and trendline fitting rather than simple half-period highest/lowest comparison
- Add spread filtering to check current spread against a threshold before entry, avoiding high-cost trades
- Support multi-position management and symbol-specific checks for more accurate position tracking and daily P/L calculation
- Enhance news filter to support multiple news event times or integrate with the economic calendar API
- Add maximum slippage control and order retry mechanism to improve execution robustness
Risk assessment
Overall risk: Medium
- Oversimplified divergence detection may produce frequent false signals leading to unnecessary losing trades
- Overbought/oversold reversal signals will continuously trade against strong trends, potentially causing consecutive losses
- Daily P/L floating profit calculation only considers the first matching position, inaccurate when multiple positions exist
- No spread filter means entering during low-liquidity periods can result in actual costs far exceeding expectations
- ManageOpenTrades uses SelectByMagic which only selects the first matching position, leaving other positions unmanaged
Evaluation scores
Parameters
| Parameter | Default | Description |
|---|---|---|
InpUseRiskManagement | false | Enable risk-based dynamic position sizing |
InpRiskPercent | 1.0 | Risk per trade as % of equity |
InpLots | 0.1 | Fixed lot size (used when risk management is disabled) |
InpStopLossPoints | 300 | Stop loss in points (required in risk management mode) |
InpTakeProfitPoints | 300 | Take profit in points |
InpMagicNumber | 1901 | EA unique identifier number |
InpUseTrailingStop | true | Enable trailing stop |
InpTrailingStopTrigger | 3000 | Profit in points to trigger trailing stop |
InpTrailingStopStep | 50 | Trailing stop distance from current price (points) |
InpRSI_Period | 14 | RSI indicator period |
InpRSI_Overbought | 70 | Overbought level |
InpRSI_Oversold | 30 | Oversold level |
InpRSI_Centerline | 50 | Centerline level |
InpUse_Divergence_Signal | true | Use RSI divergence as primary signal |
InpUse_OverboughtOversold_Reversal | true | Use overbought/oversold reversal as primary signal |
InpUse_Centerline_Confirmation | true | Wait for RSI cross of 50 to confirm entry |
InpUse_RSI_Level_Exit | false | Close position when RSI reaches opposite extreme |
InpDivergence_Lookback_Bars | 60 | Lookback bars for divergence detection |
EnableDailyLimits | true | Enable daily profit/loss limits |
DailyProfitTarget | 10000.0 | Daily profit target (stops trading when reached) |
DailyLossLimit | 5000.0 | Daily loss limit (stops trading when reached) |
InpUseNewsFilter | false | Enable newsfilter |
InpNewsTimeHour | 15 | News event time (hour) |
InpNewsTimeMinute | 30 | News event time (minute) |
InpMinutesBeforeNews | 10 | Minutes before news to stop trading |
InpMinutesAfterNews | 10 | Minutes after news to resume trading |
EnableTimeFilter | false | Enable trading session filter |
CloseAtEndTime | false | Close positions at trading session end |
Similar Mean Reversion EAs
Backtests are historical simulations and do not guarantee future results. Not financial advice.