Forex
EA

EA: RSI Reversal Expert Advisor

Last updated 2026-07-17

An Expert Advisor (EA) is different from every other download on this site — an indicator only plots or alerts, while an EA actually sends orders on your behalf. This free EA trades a single, transparent mean-reversion strategy built on RSI: it watches for RSI to snap back out of the Overbought or Oversold zone, then opens a trade with an ATR-based Stop Loss, an RR-multiple Take Profit, and a risk-based position size — all calculated automatically, with no manual chart-watching required.

How the Strategy Works

The signal this EA trades is the same one taught in the site's own RSI lesson: the meaningful moment is usually not RSI entering an extreme zone, but RSI leaving it. A BUY setup forms when RSI (default 14-period) crosses back above the Oversold level (default 30) after having dipped below it — not the moment RSI first dips under 30, but the bar where it climbs back over that line. A SELL setup is the mirror case: RSI crossing back below the Overbought level (default 70) after having pushed above it. Touching an extreme only tells you momentum was stretched; the cross back out is the first real evidence that the stretch is unwinding and price may bounce. Trading the touch itself, rather than the exit, is a common beginner mistake this EA is built to avoid mechanically — it only fires on the cross-back bar, never on the bar that first enters the zone.

Stop Loss, Take Profit, and Position Sizing

PriceTake Profit (TP)Stop Loss (SL)BUY7030OverboughtOversoldRSI (0–100)
Entry conditions: BUY when RSI crosses back above 30 out of the oversold zone — SELL on the mirrored cross back below 70 — SL and TP are placed automatically from ATR

Every trade's Stop Loss is sized from ATR rather than a fixed pip distance: SL distance = ATR × ATRMultiplier (default 2.0). A volatile pair or session gets a wider stop automatically; a quiet one gets a tighter stop — the stop always reflects what the market is actually doing right now, rather than an arbitrary fixed number that's too tight on some pairs and too loose on others. Take Profit is then set at RiskRewardRatio (default 2.0) times that same SL distance, so every trade this EA opens carries a fixed, known risk-to-reward ratio, win or lose.

Position size is calculated the same way it's taught in Risk Management Basics: RiskPercent (default 1.0%) of account balance, divided by the Stop Loss distance, gives a lot size where a losing trade costs roughly the same fraction of the account no matter how wide or narrow that particular Stop Loss happens to be. Traders who'd rather trade a constant lot size regardless of account balance or stop width can flip on UseFixedLot, which overrides the risk-based calculation with a flat FixedLotSize instead.

Entry Conditions

  • BUY — RSI crosses from below the Oversold level back above it (RSI was under 30 on the previous bar, is at or above 30 on the current bar).
  • SELL — RSI crosses from above the Overbought level back below it (RSI was over 70 on the previous bar, is at or below 70 on the current bar).

On top of the signal itself, three safety mechanics keep the EA well-behaved on a live account. It opens one position at a time — before considering a new entry, it counts existing positions filtered by symbol and magic number, and skips the signal entirely if one is already open. Every order it places is tagged with its own magic number (20260718), so it never touches trades opened manually or by a different EA sharing the same chart or account. And it evaluates entry logic once per new bar only, tracking the timestamp of the last bar it processed, rather than re-checking on every incoming tick — without this, a single RSI cross could otherwise fire the same signal dozens of times before the bar closes.

Parameters

  • RSIPeriod (default 14) — the lookback period for the RSI calculation; shorter reacts faster and crosses zones more often, longer is smoother and more selective.
  • Oversold (default 30) — the lower RSI threshold; a BUY fires when RSI crosses back above this level.
  • Overbought (default 70) — the upper RSI threshold; a SELL fires when RSI crosses back below this level.
  • ATRPeriod (default 14) — the lookback period used to calculate ATR for the Stop Loss distance.
  • ATRMultiplier (default 2.0) — Stop Loss distance = ATR × this multiplier.
  • RiskRewardRatio (default 2.0) — Take Profit distance = Stop Loss distance × this ratio.
  • RiskPercent (default 1.0) — percentage of account balance risked per trade, used to calculate lot size. Ignored if UseFixedLot is enabled.
  • UseFixedLot — when enabled, every trade uses FixedLotSize instead of the risk-based calculation.
  • FixedLotSize — the flat lot size used only when UseFixedLot is enabled.
  • MaxSpreadPoints (default 30) — skips new entries while the spread is wider than this, avoiding entries at a bad price during illiquid conditions.
  • EnableTrading — a master on/off switch, useful for pausing the EA without removing it from the chart.
  • MagicNumber (default 20260718) — the unique identifier tagged on every order this EA opens, used to isolate its positions from manual trades and other EAs.

Mean-Reversion vs. Trend-Following

This EA takes the opposite bet from a trend-following system like this site's Moving Average-based EA: instead of trying to ride a move that's already underway, it bets that a stretched, extreme reading is about to snap back toward the middle. That bet pays off well in ranging markets, where price genuinely oscillates between support and resistance and RSI repeatedly swings from Oversold back to Overbought and back again — exactly the condition described in this site's trend vs range lesson. It performs poorly in strong trending markets, where RSI can stay pinned near an extreme for an extended stretch precisely because price keeps closing in the same direction; a strong uptrend is, by definition, a market that keeps printing higher closes, which is what keeps RSI elevated. In that regime, a mean-reversion BUY signal can trigger repeatedly against the trend, each one stopping out as price simply continues rather than reverting. This is the core tradeoff of any mean-reversion system: it needs the market to actually be ranging to work, and it has no built-in awareness of whether it currently is — pairing it with a manual read of trend vs range conditions, or trading it only on pairs and timeframes known to chop rather than trend, meaningfully improves its results.

Installation and Setup

EAs install into a different folder than indicators — this is the step people miss most often.

  1. Download the file below for your platform.
  2. Open MetaTrader → click FileOpen Data Folder.
  3. Place the file in MQL4/Experts (MetaTrader 4) or MQL5/Experts (MetaTrader 5) — not the Indicators folder.
  4. Restart MetaTrader, then drag the EA from the Navigator window onto a chart.
  5. Enable AutoTrading (MT4) or Algo Trading (MT5) in the toolbar — the EA will not place any trades while this is off, even if it's attached to a chart.
  6. Review and adjust the input parameters in the EA's settings dialog before confirming.

A Word of Caution

Test on a demo account first, across different market conditions, before risking real money — past performance, in backtests or live, never guarantees future results. No strategy, automated or manual, wins every trade, and this EA can and will lose money on individual trades, particularly if it's run on a pair or timeframe that's trending strongly rather than ranging. Both files are source code — open and review them fully, and understand what every parameter does, before using it. This content is general education, not personalized investment advice.

Download the EA

How to Install — MetaTrader 4

  1. Download the rsi-reversal-ea.mq4 file below.
  2. Open MetaTrader 4 → click FileOpen Data Folder.
  3. Place the file in the MQL4/Experts folder.
  4. Restart MetaTrader 4, then drag the EA from the Navigator window onto the chart.

How to Install — MetaTrader 5

  1. Download the rsi-reversal-ea.mq5 file below.
  2. Open MetaTrader 5 → click FileOpen Data Folder.
  3. Place the file in the MQL5/Experts folder.
  4. Restart MetaTrader 5, then drag the EA from the Navigator window onto the chart.

Both files are source code — open and review the full code before using it, for your own safety.

Download rsi-reversal-ea.mq4

For MetaTrader 4 — this is source code (.mq4), open and review it fully before using it.

Download File

Download rsi-reversal-ea.mq5

For MetaTrader 5 — this is source code (.mq5), open and review it fully before using it.

Download File