Skip to content
FXNook HubBeta

Alex / RSI Mean Reversion EA with 200 EMA Filter for MT4

MetaTrader 4Expert AdvisorMITCompiled · build 2425
AlexFirst version.build 2425v1.06 hours ago1 version
  • FXN_RsiReversion.mq4First version.18 KB
  • FXN_RsiReversion.ex4Compiled by the Lab with MetaEditor build 242525 KB
README

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

InputDefaultWhat it does
RSI period2RSI look-back; 2 for short-term, 14 for classic.
Oversold level10.0Buys when RSI closes below this in an uptrend.
Overbought level90.0Sells when RSI closes above this in a downtrend.
RSI exit level50.0Closes when RSI crosses back over this level.
Trend EMA period200Buys only above this EMA, sells only below it.
ATR period14Average True Range period for the stop.
Stop loss (x ATR)2.5Stop distance = ATR of the signal bar times this.
Max bars in trade10Closes after this many bars; 0 = off.
Use risk % sizingtruetrue = lot from risk %; false = fixed lot.
Risk per trade (% of balance)1.0Balance share lost if the stop is hit.
Fixed lot0.10Lot used when risk sizing is off.
Magic number410108Identifies this EA's trades.
Max spread (points)30No entry above this spread; 0 = off.
Max slippage (points)10Allowed fill deviation.
Order commentFXN RsiReversionText saved on each order.
Use trading hoursfalseEntries only inside the window; exits any time.
Start hour (0-23)7First hour with entries.
End hour (0-23)20Entries stop at this hour; may wrap past midnight.

How to use it

  1. Copy FXN_RsiReversion.mq4 to MQL4/Experts (MT4) or FXN_RsiReversion.mq5 to MQL5/Experts (MT5); File > Open Data Folder shows where.
  2. Refresh the Navigator, drag the EA onto a chart and turn on AutoTrading (MT4) or Algo Trading (MT5).
  3. 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 %.
  4. 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 4, written in MQL4.
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
23 inputs
Lab check
Compiled with MetaEditor build 2425 for MT4 on 1 Dec 2026: 0 errors, 0 warnings.
Price
Free to download

Settings read from the code

InputTypeDefaultNote
InpSep1string===== RSI and trend =====
InpRsiPeriodint2RSI period
InpOversolddouble10.0Oversold level
InpOverboughtdouble90.0Overbought level
InpExitLeveldouble50.0RSI exit level
InpTrendPeriodint200Trend EMA period
InpSep2string===== Stop and time limit =====
InpAtrPeriodint14ATR period
InpStopAtrMultdouble2.5Stop loss (x ATR)
InpMaxBarsInTradeint10Max bars in trade
InpSep3string===== Lot size and risk =====
InpUseRiskPercentbooltrueUse risk % sizing
InpRiskPercentdouble1.0Risk per trade (% of balance)
InpFixedLotdouble0.10Fixed lot
InpSep4string===== Orders and filters =====
InpMagicint410108Magic number
InpMaxSpreadPointsint30Max spread (points)
InpSlippagePointsint10Max slippage (points)
InpOrderCommentstringFXN RsiReversionOrder comment
InpSep5string===== Trading hours (server time) =====
InpUseTradingHoursboolfalseUse trading hours
InpStartHourint7Start hour (0-23)
InpEndHourint20End hour (0-23)

How to use it

  1. Download the compiled file (or the source and compile it in MetaEditor).
  2. Put it in MetaTrader: File → Open Data Folder → MQL4 → Experts, then refresh the Navigator.
  3. Test it on a demo account before any real money.
  4. Want changes? Open a copy in your Lab and ask for them in plain words.