RSI EA
This EA trades RSI crossover signals at overbought/oversold thresholds, entering long when RSI crosses above the lower threshold and short when it crosses below the upper threshold. It supports both fixed and ATR-based dynamic stop-loss/take-profit, risk-based or fixed lot sizing, session filtering, and partial scale-out. Exit conditions mirror entries, closing positions on opposite RSI threshold crossovers.
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 | +1.35% | +1.17% | 5.23% | 6 | 60.00% | — | — | — | — | Too few trades |
| GBPUSD | +1.43% | +1.24% | 5.52% | 7 | 42.90% | — | — | — | — | Too few trades |
| USDJPY | +9.68% | +8.36% | 4.05% | 11 | 80.00% | 1.61 | 2.39 | 1 | +$94.96 | Reliable |
| XAUUSD | -100.00% | -100.00% | 100.00% | 2 | 50.00% | -2.01 | -1.00 | 1 | −$5,880.31 | Account stopped out |
Profitable on 1 of 2 markets with reliable results.
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.
Against the other Momentum EAs with a reliable result on the same market: USDJPY: better than 99% of 68 · XAUUSD: better than 0% of 75
Month by month
| Market | Months with a gain | Best month | Worst month |
|---|---|---|---|
| USDJPY | 69% | +3.46% 2026-07 | -1.47% 2026-09 |
| XAUUSD | 33% | +2.67% 2025-11 | -100.00% 2026-01 |
From the backtest equity curve, sampled about every two days; only reliable results.
Blow-up risk: High
- Has no stop loss or trailing stop
- Hit a stop-out in our backtest (equity below 10%) on XAUUSD
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 concept is based on RSI momentum indicator crossover signals at overbought/oversold thresholds, representing a hybrid momentum-reversal approach. Entry conditions trigger a long position when RSI crosses above the LowerThreshold (default 20) and a short position when RSI crosses below the UpperThreshold (default 80), meaning the signal line crosses the threshold level rather than a simple overbought/oversold determination. Exit conditions are symmetric to entries, closing positions when the opposite RSI threshold crossover occurs, e.g., long positions close when RSI crosses below the upper threshold. Position sizing supports both fixed lot size and risk-based auto-calculation modes, where the auto mode calculates lot size based on a percentage of account balance/equity/free margin relative to the stop-loss distance. Stop-loss and take-profit support both fixed point values and ATR-volatility-based dynamic calculation, with the dynamic mode using ATR values multiplied by configured factors. Additionally, the EA provides session time filtering and partial scale-out functionality, where scale-out reduces the position by a configured percentage when price profit exceeds an ATR-based threshold.
Strengths
- Supports both fixed and ATR-based dynamic stop-loss/take-profit, adapting to different market volatility environments
- Risk-based auto position sizing provides solid money management capabilities
- Session filtering and partial scale-out features add strategy flexibility
- New bar detection mechanism prevents duplicate entries on the same bar
- Position close retry mechanism (up to 10 attempts) improves order execution reliability
Weaknesses
- AccountBalance/AccountEquity/AccountFreeMargin functions return bool instead of double, causing critical type errors that will corrupt position size calculations
- Default stop-loss and take-profit are both 0, trading without stop-loss poses extreme risk
- MinimumStopLoss and MaximumStopLoss parameters are defined but never used in stop-loss calculation, making them dead code
- MaxSpreadAllowed parameter is defined but never checked before entry, rendering it completely ineffective
- Inconsistent CopyBuffer start indices between ATR (start=0) and RSI (start=1) in LoadIndicatorData may cause data alignment issues
Possible improvements
- Fix AccountBalance/AccountEquity/AccountFreeMargin return types to double, otherwise risk-based position sizing will be completely wrong
- Add MaxSpreadAllowed spread check in entry conditions to make the existing parameter functional
- Actually use MinimumStopLoss/MaximumStopLoss/MinimumTakeProfit/MaximumTakeProfit parameters for range validation in CalculateStopLoss and CalculateTakeProfit
- Unify CopyBuffer start indices in LoadIndicatorData to ensure ATR and RSI data are temporally aligned
- Release indicator handles via IndicatorRelease in OnDeinit to prevent resource leaks
Risk assessment
Overall risk: High risk
- AccountBalance etc. return bool type causing completely wrong auto position sizing, potentially resulting in 0-lot or extreme lot sizes
- Default stop-loss and take-profit are both 0, users who don't modify parameters will trade without any stop-loss
- MaxSpreadAllowed parameter is not enforced, potentially opening positions during extremely wide spreads in high volatility
- MinimumStopLoss/MaximumStopLoss are not actually constraining stop-loss range, potentially allowing too small or too large stops
Evaluation scores
Parameters
| Parameter | Default | Description |
|---|---|---|
MomentumPeriod | 14 | RSI indicator period |
UpperThreshold | 80 | RSI overbought threshold (short signal line) |
LowerThreshold | 20 | RSI oversold threshold (long signal line) |
PriceMode | PRICE_CLOSE | RSI applied price type |
EnableSessionFilter | false | Enable trading session filter |
SessionStartHour | h07 | Trading session start time |
SessionEndHour | h19 | Trading session end time |
VolatilityPeriod | 100 | ATR volatility indicator period |
VolatilityTimeframe | PERIOD_CURRENT | ATR volatility timeframe |
VolatilityFactorSL | 2 | Dynamic stop loss ATR multiplier |
VolatilityFactorTP | 3 | Dynamic take profit ATR multiplier |
PositionSizeMode | RISK_DEFAULT_FIXED | Position sizing: fixed lots or risk-based auto calculation |
FixedLotSize | 0.1 | Fixed lot size |
RiskCalculationBase | RISK_BASE_BALANCE | Risk calculation base: balance/equity/free margin |
RiskPercentage | 2 | Risk percentage |
MinimumLotSize | 0.01 | Minimum allowedlot size |
MaximumLotSize | 100 | Maximum allowed lot size |
MaxOpenPositions | 1 | Maximum simultaneous positions |
StopLossType | SL_FIXED | Stop loss type: fixed or ATR dynamic |
FixedStopLoss | 0 | Fixed stop loss in pips (0 = no SL) |
MinimumStopLoss | 0 | Minimum stop losspoints |
MaximumStopLoss | 5000 | Maximum stop losspoints |
TakeProfitType | TP_FIXED | Take profit type: fixed or ATR dynamic |
FixedTakeProfit | 0 | Fixed take profit in pips (0 = no TP) |
MinimumTakeProfit | 0 | Minimum take profitpoints |
MaximumTakeProfit | 5000 | Maximum take profitpoints |
EnableScaleOut | false | Enable partial position reduction |
ScaleOutPercent | 50 | Scale-out percentage |
VolatilityFactorSO | 1 | Scale-out trigger ATR multiplier |
IdentificationNumber | 0 | EA identification number (Magic Number) |
TradeComment | Trade comment | |
SlippageTolerance | 5 | Slippage tolerance |
MaxSpreadAllowed | 50 | Maximum allowed spread |
Similar Momentum EAs
Backtests are historical simulations and do not guarantee future results. Not financial advice.