MACD + RSI Confluence EA MT5 — No Code

Combine MACD crossover with RSI trend filter in Strategy Builder — parameters, AND logic on Step 3, export MQL5, compile, and backtest.

📖 11 min read

📝 2,151 words

🏷️ MQL5 and Expert Advisors

Share this article:

MACD + RSI Confluence EA MT5 — No Code

Can I build a MACD and RSI confluence EA for MT5 without coding?

Yes. Open AlfaTactix Strategy Builder → Step 3 — Entry rules → Buy rule on H1 → add MACD (12/26/9 defaults) with crosses above MACD signal → add RSI(14) is above 50 → combine both in an All of these group → Sell rule: Sell mirrors Buy (MACD crosses below MACD signal AND RSI is below 50) → optional Step 4 session filter → Step 5 stop loss, Step 6 position size → Step 7 Save strategy → Get the code → compile once in MetaEditor → backtest on H1 EURUSD with Every tick in the Strategy Tester.

Disclosure: This tutorial uses AlfaTactix Strategy Builder. For platform overview see Build EA Without Coding. For single-indicator EAs see RSI Overbought/Oversold EA and Moving Average Crossover EA.

Related guides: MACD indicator deep dive · RSI indicator deep dive · EA Risk Management · Backtest in Strategy Tester · EA Strategy Library


What Is MACD + RSI Confluence?

A MACD + RSI confluence Expert Advisor waits for two momentum signals to agree before opening a trade. Instead of acting on MACD alone (which whipsaws in ranges) or RSI alone (which lags in trends), confluence combines:

LegIndicatorTypical rule
Momentum shiftMACDMACD line crosses above (buy) or below (sell) the signal line
Trend filterRSIRSI > 50 for longs, RSI < 50 for shorts

The EA runs in MetaTrader 5 on every tick or bar via OnTick() [1]. You define both legs visually in Strategy Builder — no iMACD or iRSI code required.

Why traders search for this: MACD + RSI is one of the most common indicator pairs in forex education. Most tutorials show hand-written MQL5. This guide documents the same logic in Strategy Builder with every parameter and condition field the product exposes.

Confluence vs single indicator:

ApproachProsCons
MACD onlyCatches momentum shifts earlyMany false crosses in sideways markets
RSI 30/70 onlyClear mean-reversion zonesWeak in strong trends (RSI stays overbought)
MACD + RSI 50 confluenceFilters weak MACD crosses; aligns with trend biasFewer trades; both must agree

For pure RSI extreme entries (30/70), see RSI Overbought/Oversold EA — No Code. For trend-following without oscillators, see Moving Average Crossover EA.


Classic Settings for Confluence EAs

SettingStarter valueNotes
MACDFast / Slow / Signal length 12 / 26 / 9, EMA, CloseIndustry default; matches most chart presets
RSILength 14, Close, Overbought level 70 / Oversold level 30Use 50 as confluence threshold, not 30/70
Trading timeframe (Step 2)H1 (forex majors)M15 = more signals; H4 = cleaner trends
SymbolEURUSD, GBPUSDLiquid pairs; tight spread helps
LogicAll of these between MACD cross and RSI filterAny of these would fire on either alone — too loose

Works best: Trending or transitioning markets where MACD crosses coincide with RSI above/below the midline.

Struggles in: Choppy ranges — MACD crosses repeatedly while RSI oscillates around 50. Mitigate with Step 4 session/spread filters, RSI crosses above 50 instead of is above 50, or Step 5 stop loss.

Academy references: MACD indicator guide · RSI indicator guide


MACD and RSI Parameters in Strategy Builder

When you pick an indicator under What to watch in Step 3 — Entry rules (Indicator tab), its settings open in the picker.

MACD settings

SettingRange / optionsDefaultWhat it does
Fast length1 – 20012Fast average period for the MACD line
Slow length2 – 40026Slow average period
Signal length1 – 1009Average period for the signal line
Price (More settings)open … ohlc4 (7 options)ClosePrice series for calculation
Signal line average (More settings)EMA, SMAEMAAverage type of the signal line (EMA is standard)
Show as percent (PPO) (More settings)none, percentnoneShows the MACD as a percent

Lines: a MACD indicator has three lines you can pick in Line: MACD, MACD signal and MACD histogram.

RSI settings

SettingRange / optionsDefaultWhat it does
Length2 – 20014Lookback for RSI calculation
Price (More settings)open … ohlc4 (7 options)ClosePrice series
Overbought level50 – 10070Upper zone (used by the Level tab)
Oversold level0 – 5030Lower zone

Tip for confluence: Leave the levels at 70/30 even when your entry uses 50 — they still apply if you add an Oversold level or Overbought level line later.


Condition Types for MACD and RSI

Step 3 has a Buy rule and a Sell rule. Each line reads like a sentence: Buy when [What to watch] [How they compare] [Compare with]. Below are the rules relevant to a MACD + RSI confluence EA.

MACD rules

1. Is above / is below

Compare the MACD line with a number (typically the zero line) using is above, is below, is at or above or is at or below.

Use case: “Only buy when MACD is above 0” as an extra line in the All of these group, alongside the signal cross.


2. Crosses above / crosses below (core confluence leg)

Part of the lineChoice
What to watchMACD
How they comparecrosses above / crosses below
Compare withMACD signal (Indicator tab, Line), or 0 (Number tab)

Confluence recipe — Buy: MACD crosses above MACD signal. Sell: MACD crosses below MACD signal.

Alternative: MACD crosses above 0 for stronger trend confirmation (fewer signals).


3. Divergence

How they compare: diverges from price, with the divergence type (regular or hidden, bullish or bearish), the swing points (for example 5 and 5) and the distance between swings (for example 5 to 60 bars).

Use case: Advanced entries — e.g. buy on a regular bullish divergence AND the MACD cross above signal. Not required for the starter confluence EA.


4. Histogram

Pick MACD histogram in Line and compare it: for example MACD histogram is above 0, or is above its own value 1 bar ago (Bars ago).

Use case: Add MACD histogram is above 0 to the buy rule so momentum is already expanding when MACD crosses.


RSI rules (confluence essentials)

For the other RSI rules, see RSI Overbought/Oversold EA — No Code. For confluence, you mainly need is above / is below and crosses above / crosses below.

1. Is above / is below (simple trend filter)

Confluence recipe — Buy: RSI is above 50. Sell: RSI is below 50.

True whenever RSI satisfies the comparison on the signal bar — easy to backtest.


2. Crosses above / crosses below (timing-aligned filter)

Confluence alternative — Buy: RSI crosses above 50 (Number tab; RSI crosses the midline). Sell: RSI crosses below 50.

Fewer entries than is above — often aligns better with the MACD cross bar.


Logical combinations on Step 3

Combine MACD and RSI with All of these / Any of these groups and Must not be true — same as Build EA Without Coding. A group needs two complete conditions.

Starter expression:

(MACD crosses above MACD signal) AND (RSI is above 50)

Tighter expression:

(MACD crosses above MACD signal) AND (RSI crosses above 50) AND (MACD histogram is above 0)


Build the Confluence EA Step by Step

Workflow: 7 steps in Strategy Builder demo. We detail what matters for MACD + RSI confluence on H1.

Step 1 — Information and platform

  • Name: e.g. MACD RSI Confluence H1 EURUSD
  • Description: optional

Step 2 — Timeframes

  • Add one trading timeframe, e.g. H1. The rule reads it.
  • Optional: add a higher timeframe for trend filter — see Advanced MTF Filters.

Step 3 — Entry rules (core)

Buy rule (H1)

  1. Open the Buy rule and add a group set to All of these.
  2. First line: What to watch → MACD (Indicator tab); settings Fast length 12, Slow length 26, Signal length 9, Price Close, Signal line average EMA.
  3. How they compare: crosses above; Compare with: MACD signal (the same MACD, Line = signal).
  4. Second line: What to watch → RSI; settings Length 14, Price Close, Overbought level 70, Oversold level 30.
  5. How they compare: is above; Compare with: Number tab → 50.

Alternative RSI leg: In step 5, choose crosses above 50 instead.

Sell rule (H1)

Switch on Sell mirrors Buy (MACD crosses below MACD signal AND RSI is below 50), or choose Write the sell rule yourself and write the two lines with crosses below and is below.

Step 4 — Filters (optional)

Examples: Market sessions (London/NY overlap), Spread limit, a Market condition on ATR. Reduces MACD whipsaw when RSI hovers near 50. Full reference: Advanced EA MTF & Filters.

Steps 5 and 6 — Exits, risk and money management

Minimum for a testable EA:

SettingSuggestion
Position size (Step 6)0.01 lot demo (Fixed lots) or 1% (Risk per trade (% of the account))
Stop loss (Step 5)Fixed distance or ATR multiple
Take profit (Step 5)Optional; some traders exit on the opposite MACD cross (Exit by signal)
Open positions (Step 6)Most trades open at the same time: 1 — avoids overlapping positions on the same symbol

Full reference: EA Risk Management.

Step 7 — Review and save

Read the summary and the Check list, then Save strategy.


Export, Compile, and Backtest

  1. In Step 7, Save strategy, then Get the code → MetaTrader 5 code → download .mq5.
  2. Copy to MQL5/Experts, compile (F7) in MetaEditor [2].
  3. Strategy Tester: Every tick based on real ticks, realistic spread, 6–12 months on H1 EURUSD.
  4. Compare is above 50 vs crosses above 50 for the RSI leg — note trade count and profit factor.
  5. Forward test on Demo before live.

If OrderSend fails with 10016, see Invalid Stops.


Improvements: Filters and Risk

ProblemBuilder lever
Too many tradesSwitch RSI is above 50 → crosses above 50; add MACD histogram is above 0 to the All of these group
MACD whipsaw in rangeStep 4 Market sessions; Step 5 stop loss; avoid M5/M15 until tuned
RSI stuck near 50Require MACD is above 0 AND cross above signal
Strong trends, late entriesAccept fewer trades or drop RSI filter in trends (test carefully)
Over-tradingStep 6 Entries per day; Most trades open at the same time: 1

Related single-indicator EAs for comparison:

EA typeGuide
RSI extremes (30/70)RSI Overbought/Oversold EA
MA trend followingMoving Average Crossover EA

Next Steps

Confluence discipline: Draw your Buy All of these group on paper (MACD + RSI). Open the live demo — if the group needs a third Any of these branch to "make it trade," you are curve-fitting. Match the paper diagram, then save and press Get the code.

References: MQL5 iMACD [3], MQL5 iRSI [4], MetaTrader 5 Strategy Tester [5].

Frequently Asked Questions

Yes. In AlfaTactix Strategy Builder, add MACD and RSI on Step 3 (Entry rules), use an All of these group in the Buy rule: MACD crosses above MACD signal and RSI is above 50, switch on Sell mirrors Buy, set a stop loss on Step 5, press Save strategy in Step 7, then Get the code. Compile once in MetaEditor and backtest in the Strategy Tester.

Confluence means two independent indicators agree before you enter. A classic rule: buy when MACD line crosses above the signal line (bullish momentum shift) and RSI is above 50 (buyers in control). Sell when MACD crosses below signal and RSI < 50. This filters many false MACD crosses in weak trends. Learn each indicator in the MACD Academy guide and RSI Academy guide.

Standard starters: MACD 12 / 26 / 9 (fast / slow / signal) with Signal line average EMA on Close, plus RSI(14) with Overbought level 70 and Oversold level 30. For confluence EAs, RSI 50 acts as a trend filter — not the 30/70 extremes used in mean-reversion systems like the RSI Overbought/Oversold EA. Test on H1 EURUSD first.

is above (RSI is above 50) fires whenever RSI is above 50 on the signal bar — simpler, more entries. crosses above (RSI crosses above 50) fires only when RSI crosses 50 — fewer, cleaner entries aligned with the MACD cross timing. Both work; start with is above for backtests, switch to crosses above if you get too many signals. Full RSI rule reference: RSI Overbought/Oversold EA guide.

You press Get the code in Step 7 to get the .mq5 and compile once (F7) in MetaEditor (opens in a new tab). You do not write MACD/RSI logic by hand — see Build EA Without Coding.

Add Step 4 session or spread filters (Advanced MTF Filters), require RSI crosses above 50 instead of is above 50, use MACD histogram is above 0 as a third line in the All of these group, or add a higher-timeframe trend filter. Always set a Stop loss on Step 5 per EA Risk Management and forward-test on Demo before live.

References

  1. MetaQuotes, MQL5 Reference. OnTick. https://www.mql5.com/en/docs/event_handlers/ontick
  2. MetaQuotes, MetaEditor Help. Welcome to algorithmic trading!. https://www.metatrader5.com/en/metaeditor/help
  3. MetaQuotes, MQL5 Reference. iMACD. https://www.mql5.com/en/docs/indicators/imacd
  4. MetaQuotes, MQL5 Reference. iRSI. https://www.mql5.com/en/docs/indicators/irsi
  5. MetaQuotes. MetaTrader 5 Built-in Trading Strategy Tester. https://www.metatrader5.com/en/automated-trading/strategy-tester