Overview
Free RSI mean reversion Expert Advisor: buys RSI dips above the 200 EMA and sells spikes below it, exiting at an RSI mid level, ATR stop or time limit.
FXN RSI Mean Reversion is a free, open-source Expert Advisor for MetaTrader 4 and MetaTrader 5 that buys short-term weakness in an uptrend and sells short-term strength in a downtrend, using RSI with a 200 EMA trend filter, a mid-level exit and a time limit.
How it works
- Buy when the close is above the EMA and RSI closed below the oversold level (10). Sell when below the EMA and RSI closed above overbought (90).
- Exit a buy when RSI closes at or above the exit level (50), a sell at or below it; the order closes at the next bar's open.
- Time limit: closes a trade after Max bars in trade (10) bars; 0 = off.
- Stop loss = entry minus
ATR x Stop loss multiplier(buys) or plus (sells). No fixed take profit; after an exit the next entry waits for a new bar. - Lot size (risk mode):
balance x risk % / money lost per lot at the stop, rounded down to the lot step.
Inputs
| Input | Default | What it does |
|---|---|---|
| RSI period | 2 | RSI look-back; 2 for short-term, 14 for classic. |
| Oversold level | 10.0 | Buys when RSI closes below this in an uptrend. |
| Overbought level | 90.0 | Sells when RSI closes above this in a downtrend. |
| RSI exit level | 50.0 | Closes when RSI crosses back over this level. |
| Trend EMA period | 200 | Buys only above this EMA, sells only below it. |
| ATR period | 14 | Average True Range period for the stop. |
| Stop loss (x ATR) | 2.5 | Stop distance = ATR of the signal bar times this. |
| Max bars in trade | 10 | Closes after this many bars; 0 = off. |
| Use risk % sizing | true | true = lot from risk %; false = fixed lot. |
| Risk per trade (% of balance) | 1.0 | Balance share lost if the stop is hit. |
| Fixed lot | 0.10 | Lot used when risk sizing is off. |
| Magic number | 410108 | Identifies this EA's trades. |
| Max spread (points) | 30 | No entry above this spread; 0 = off. |
| Max slippage (points) | 10 | Allowed fill deviation. |
| Order comment | FXN RsiReversion | Text saved on each order. |
| Use trading hours | false | Entries only inside the window; exits any time. |
| Start hour (0-23) | 7 | First hour with entries. |
| End hour (0-23) | 20 | Entries stop at this hour; may wrap past midnight. |
How to use it
- Copy
FXN_RsiReversion.mq4toMQL4/Experts(MT4) orFXN_RsiReversion.mq5toMQL5/Experts(MT5); File > Open Data Folder shows where. - Refresh the Navigator, drag the EA onto a chart and turn on AutoTrading (MT4) or Algo Trading (MT5).
- Suggested start: H1 to D1 on indices, gold or FX majors, RSI 2 with 10/90 levels (or RSI 14 with 30/70), exit 50, EMA 200, stop 2.5 x ATR, 10 bars, risk 0.5 %.
- Test in the Strategy Tester and on a demo account first.
Good to know
- A full stop loss is usually larger than a typical winner, so keep risk per trade modest.
- After a sharp trend change the EMA reacts slowly, so the EA may buy dips in a falling market (one trade at a time).
- The stop is wide on purpose; tight stops on reversion entries get hit by noise.
- Closed-bar signals that do not repaint; one entry per bar and one trade per symbol and magic number. No martingale, grid or averaging down.
- Stops respect broker stop and freeze levels. If risk sizing gives less than the minimum lot, the trade is skipped and logged. On MT5 netting accounts it will not trade a symbol that already has another position.
Trading carries risk. Test on a demo account first; past results do not predict future results.
At a glance
- What it is
- A free Expert Advisor for MetaTrader 5, written in MQL5.
- What it does
- Free RSI mean reversion Expert Advisor: buys RSI dips above the 200 EMA and sells spikes below it, exiting at an RSI mid level, ATR stop or time limit.
- Shared by
- Alex
- Licence
- MIT
- Version
- 1.0 (1 Dec 2026)
- Settings
- 18 inputs
- Lab check
- Compiled with MetaEditor build 6333 for MT5 on 1 Dec 2026: 0 errors, 0 warnings.
- Price
- Free to download
Settings read from the code
| Input | Type | Default | Note |
|---|---|---|---|
| InpRsiPeriod | int | 2 | RSI period |
| InpOversold | double | 10.0 | Oversold level |
| InpOverbought | double | 90.0 | Overbought level |
| InpExitLevel | double | 50.0 | RSI exit level |
| InpTrendPeriod | int | 200 | Trend EMA period |
| InpAtrPeriod | int | 14 | ATR period |
| InpStopAtrMult | double | 2.5 | Stop loss (x ATR) |
| InpMaxBarsInTrade | int | 10 | Max bars in trade |
| InpUseRiskPercent | bool | true | Use risk % sizing |
| InpRiskPercent | double | 1.0 | Risk per trade (% of balance) |
| InpFixedLot | double | 0.10 | Fixed lot |
| InpMagic | ulong | 410108 | Magic number |
| InpMaxSpreadPoints | int | 30 | Max spread (points) |
| InpSlippagePoints | int | 10 | Max slippage (points) |
| InpOrderComment | string | FXN RsiReversion | Order comment |
| InpUseTradingHours | bool | false | Use trading hours |
| InpStartHour | int | 7 | Start hour (0-23) |
| InpEndHour | int | 20 | End hour (0-23) |
How to use it
- Download the compiled file (or the source and compile it in MetaEditor).
- Put it in MetaTrader: File → Open Data Folder → MQL5 → Experts, then refresh the Navigator.
- Test it on a demo account before any real money.
- Want changes? Open a copy in your Lab and ask for them in plain words.