Build an RSI Overbought/Oversold EA for MT5 — No Code
Quick Answer: RSI Overbought/Oversold EA Without Code
Quick answer: Add RSI on Step 3 — Signals in AlfaTactix Strategy Builder, set Cross with Target = Oversold, Direction = Up, Value = 30 for Buy and Target = Overbought, Direction = Down, Value = 70 for Sell, configure Length 14, Overbought 70, Oversold 30, add Stop Loss / lot size on Step 5, Save, export MQL5 from Code Generator, compile once in MetaEditor, and backtest on H1 EURUSD with Every tick in the Strategy Tester.
Disclosure: This tutorial uses AlfaTactix Strategy Builder. For the full no-code platform overview, see Build EA Without Coding. For RSI indicator theory and chart reading, see the RSI Academy guide. For a trend-following alternative built the same way, see Moving Average Crossover EA — No Code.
Related guides: Create/Edit MT5 EA · EA Risk Management · Backtest in Strategy Tester
What Is an RSI Overbought/Oversold EA?
An RSI overbought/oversold Expert Advisor automates one of the most popular mean-reversion systems in trading:
| Signal | Rule |
|---|---|
| Buy (long) | RSI was oversold and crosses back up through the oversold level (e.g. 30) |
| Sell (short) | RSI was overbought and crosses back down through the overbought level (e.g. 70) |
The Relative Strength Index (RSI) oscillates between 0 and 100. Values above 70 are traditionally overbought; below 30 are oversold. A mean-reversion EA bets that extreme readings will revert toward the middle (often 50).
The EA runs on every tick or bar in MetaTrader 5 via OnTick(). You do not watch charts manually — the platform executes when your RSI condition fires.
Why traders search for this: RSI is the default momentum oscillator in most platforms. Tutorials usually show hand-written MQL5 with iRSI(). This guide shows the same logic in Strategy Builder with every parameter and condition the product exposes for RSI.
Classic RSI Settings and When It Works
| Setting | Starter value | Notes |
|---|---|---|
| Length | 14 | Wilder default; 7 = faster, 21 = slower |
| Overbought | 70 | Range 50–100 in builder |
| Oversold | 30 | Range 0–50 in builder |
| Timeframe | H1 (forex majors) | M15 = more signals; H4 = cleaner swings |
| Symbol | EURUSD, GBPUSD | Liquid pairs; spread matters on tight stops |
| Smoothing | None | Optional SMA/EMA/WMA/SMMA/VWMA on RSI line |
Works best: Range-bound or mildly trending markets where price bounces from extremes — especially during mean-reverting sessions on liquid forex.
Struggles in: Strong one-way trends — RSI can stay overbought (uptrend) or oversold (downtrend) for long periods, causing repeated counter-trend entries. Mitigate with Step 4 session/spread filters, Step 5 stop loss, or a trend filter from the MA Crossover EA guide.
For indicator background (calculation, divergence, failure swings), read the RSI Academy guide.
RSI Parameters in Strategy Builder
When you add RSI on Step 3 — Signals, the Parameters panel shows seven fields:
| Parameter | Type | Range / options | Default | What it does |
|---|---|---|---|---|
| Length | Number | 2 – 100 | 14 | Lookback periods for RSI calculation |
| Source | Select | Close, Open, High, Low | Close | Price series used in the calculation |
| Smoothing | Select | None, SMA, EMA, WMA, SMMA, VWMA | None | Optional smoothing applied to the RSI line |
| Smoothing Length | Number | 1 – 100 | 14 | Period when Smoothing ≠ None |
| Overbought | Number | 50 – 100 | 70 | Upper threshold line on the oscillator |
| Oversold | Number | 0 – 50 | 30 | Lower threshold line on the oscillator |
| Offset | Number | -50 – 50 | 0 | Shifts the RSI forward/backward in bars (advanced; leave 0 for standard EAs) |
Tip for mean-reversion EAs: Set Overbought and Oversold in Parameters to match your Cross condition Value fields (e.g. Parameters OS 30 + Cross Target Oversold Value 30) so the chart lines align with entry rules.
Smoothing: Leave None for the classic Wilder-style RSI. Enable SMA or EMA smoothing if you want a less jagged line — keep Smoothing Length equal to Length (e.g. both 14) for consistency.
RSI Condition Types Explained
Open an RSI indicator on Step 3 → Add condition. The dropdown lists seven condition types. Below is every field the UI exposes.
1. Compare
Compare the RSI value to a fixed threshold (0–100 scale).
| Field | Options |
|---|---|
| Operator | >, <, >=, <=, ==, != |
| Value | Number 0 – 100 (e.g. 30 for oversold, 70 for overbought) |
Use case: “Buy when RSI <= 30” — fires while RSI remains in the zone (can re-trigger every bar).
Alternative entry: Combine Compare RSI <= 30 with a second Cross Up through 30 using AND — stricter than Compare alone.
2. Cross
Detect when RSI crosses a target level or line.
| Field | Options |
|---|---|
| Target | RSI, Overbought, Oversold, 50 |
| Direction | Up (bullish cross) · Down (bearish cross) |
| Value | Number (e.g. 30 when Target = Oversold, 70 when Target = Overbought) |
Classic mean-reversion recipe:
| Tab | Target | Direction | Value |
|---|---|---|---|
| Buy | Oversold | Up | 30 |
| Sell | Overbought | Down | 70 |
Use case: “RSI crosses up through 30 after being oversold” — fires once per bounce, not every bar in the zone.
Other targets: Target = 50, Direction = Up for midline reclaim entries; Target = RSI with custom Value for arbitrary levels.
3. Divergence
Price vs RSI disagreement — advanced reversal signal.
| Field | Range / options |
|---|---|
| Divergence Type | Bullish · Bearish |
| Period | 1 – 100 (default 14) |
| Lookback Period | 1 – 200 (default 40) |
| Strength | 1 – 10 (default 1) |
| Timeframe | 1m, 5m, 15m, 30m, 1h, 4h, 1d, 1w, 1M |
Use case: “Buy on bullish divergence when RSI also crosses up from oversold” — combine with Cross using AND in Step 3.
4. Failure Swing
RSI-specific reversal pattern (failed attempt to reach a new extreme).
| Field | Range / options |
|---|---|
| Direction | Up · Down |
| Period | 1 – 100 (default 20) |
| Confirmation | 1 – 10 bars (default 1) |
Use case: Higher-quality reversal entries than a simple threshold cross; add Confirmation 2–3 to reduce noise.
5. Breakout
RSI breaks through a dynamic threshold over a lookback window.
| Field | Range / options |
|---|---|
| Direction | Up · Down |
| Threshold | RSI level (e.g. 70) |
| Period | 1 – 50 bars (default 5) |
| Confirmation | 1 – 10 bars (default 1) |
| Volume Confirmation | None · Above Average · High |
Use case: Momentum-style RSI breakout (different from classic mean-reversion); combine with trend filter if needed.
6. Pattern
Chart pattern detection on the RSI series.
| Field | Options |
|---|---|
| Pattern Type | Double Top, Double Bottom, Head & Shoulders, Inverse H&S, Triangle, Wedge |
| Min Height | RSI points (default 10) |
| Min Width | Bars (default 10) |
| Volume Confirmation | None · Above Average · High |
Use case: Advanced entries; most RSI mean-reversion EAs use Cross only.
7. Slope
Require the RSI line to be rising or falling by a minimum amount.
| Field | Range / options |
|---|---|
| Direction | Up · Down |
| Period | 1 – 50 (default 5) |
| Min Slope | Number (0 = any slope) |
| Smoothing | None, SMA, EMA, WMA |
| Smoothing Length | 1 – 100 (default 5 when smoothing enabled) |
| Source | Close, Open, High, Low |
Use case: “Buy Cross Up from oversold only if RSI slope is Up” — combine with AND in Step 3.
Logical combinations on Step 3
Combine indicators and conditions with AND, OR, NOT, parentheses, and groups — same as described in Build EA Without Coding. Example: (Cross Oversold Up AND Slope Up).
Build the RSI EA Step by Step
Workflow: six steps in Strategy Builder demo. We detail what matters for a classic RSI 14 / 30 / 70 mean-reversion EA.
Step 1 — Strategy information
- Name: e.g.
RSI Mean Reversion H1 EURUSD - Description: optional
Step 2 — Timeframes
- Enable one trading timeframe, e.g. H1 (matches tab tf0 on Step 3).
- Optional: add a higher timeframe later for trend filter (Advanced MTF Filters).
Step 3 — Signals (core)
- Open tab Buy.
- Select timeframe H1.
- Add indicator → RSI (Momentum group).
- Parameters:
- Length: 14
- Source: Close
- Smoothing: None
- Smoothing Length: 14 (ignored when Smoothing = None)
- Overbought: 70
- Oversold: 30
- Offset: 0
- Add condition → Cross.
- Target: Oversold
- Direction: Up
- Value: 30
- Open tab Sell.
- Add RSI again (or mirror rule): Cross
- Target: Overbought
- Direction: Down
- Value: 70
Alternative — Compare then Cross: On Buy, add Compare RSI <= 30 AND Cross Target Oversold Direction Up Value 30 for a stricter bounce entry.
Step 4 — Filters (optional)
Examples: market session (London/NY), spread cap, ATR filter. See Advanced EA MTF & Filters.
Step 5 — Risk management
Minimum for a testable EA:
| Setting | Suggestion |
|---|---|
| Lot / risk % | 0.01 lot demo or 1% risk |
| Stop Loss | Fixed pips or ATR-based |
| Take Profit | Optional; many RSI EAs exit on opposite cross (sell signal closes long) |
| One trade at a time | Avoid overlapping positions |
Full reference: EA Risk Management.
Step 6 — Preview and Save
Review Buy/Sell rules → Save strategy to your account.
Export, Compile, and Backtest
- Open Code Generator → select your saved strategy → MQL5 → download
.mq5. - Copy to
MQL5/Experts, compile (F7) in MetaEditor. - Strategy Tester: Every tick, realistic spread, 6–12 months data on H1 EURUSD.
- Forward test on Demo before live. Read Strategy Tester vs Live.
If OrderSend fails with 10016, see Invalid Stops.
Exported code uses standard iRSI() — see MQL5 Programming Reference for handle patterns.
Improvements: Filters and Risk
| Problem | Builder lever |
|---|---|
| Counter-trend losses in strong trends | Step 4 session filter; add trend filter (see MA Crossover EA) |
| Too many entries in range | Use Cross not Compare; Failure Swing with Confirmation 2–3 |
| Spread eats profit | Step 4 spread filter; test on ECN/low-spread symbol |
| Over-trading | Step 5 max trades; one position per symbol |
| Late entries | Tighten levels (e.g. OS 25, OB 75) or shorter Length (7–9) |
Next Steps
- RSI Academy guide — indicator theory, divergence, and chart examples
- Build EA Without Coding — full six-step builder tour
- Moving Average Crossover EA — No Code — trend-following counterpart
- Production-Ready MQL5 Without MetaEditor — export workflow
- MQL5 Programming Reference — iRSI and indicator handles
Try it: Strategy Builder demo — build the RSI 14 / 30 / 70 mean-reversion EA in one session, export, and backtest.
References: MQL5 iRSI, MetaTrader 5 Strategy Tester.