Pipsgrowth EX12069 MultiIndicatorConfluence
MT5 Expert Advisor (Open Source) · XAUUSD · M5
Pipsgrowth.com EX12069 XAUUSD_M5 — Multi-indicator confluence EA (MACD+RSI+Supertrend+Donchian+HA), full 12-layer stack.
Overview
Pipsgrowth EX12069 is a multi-indicator confluence engine designed for XAUUSD on the M5 timeframe, where five independent technical studies (MACD, RSI, Supertrend, Donchian, Heiken Ashi) each cast a vote on every qualified bar and the EA combines those votes through either an AND or OR decision rule. The design is intentionally modular: every indicator has its own on/off toggle, its own entry/exit eligibility flag, and a discrete period set, so the trader can decide whether they want a strict consensus machine (LOGIC_AND default, where every enabled indicator must agree) or a permissive single-trigger system (LOGIC_OR, where any one of the enabled indicators can fire the entry). The brief groups this work into twelve layers (REGIME, SIGNAL, ENTRY, CONFIRM, NO-TRADE, CAPITAL CAP, RISK, SIZING, MANAGE, EXIT, SCALING, OnTester), but in the source code the work is decomposed into 23 named functions.
The indicator mix is interesting because three of the five are computed internally from raw OHLC buffers rather than through MetaTrader indicator handles. MACD uses a real iMACD handle with the configurable 12/26/9 trio (InpMACDFastEMA, InpMACDSlowEMA, InpMACDSignalSMA) plus a switchable applied price (InpMACDPrice 1–7 maps to close/open/high/low/median/typical/weighted through MapAppliedPriceInt). RSI also uses a real iRSI handle with InpRSIPeriod (default 14) and the same applied-price switch (InpRSIPrice). The remaining three — Supertrend, Donchian, Heiken Ashi — are recomputed on the fly each time GetSupertrendSignal/GetDonchianSignal/GetHeikenAshiSignal is called, with their own lookback windows (100 bars for Supertrend stabilization, 10 bars for Heiken Ashi, InpDonchianPeriod+2 for the breakout bands). The reason this matters is that none of them consume an indicator handle slot, so even with all five layers enabled the EA only allocates two real handles (h_macd, h_rsi) and the rest are pure price arithmetic.
The signal rules are deliberately simple and per-indicator. MACD votes +1 when main[1] crosses above signal[1] (with main[2]<=signal[2] confirming it just happened), and -1 on the mirrored cross. RSI votes +1 when rsi[1] pushes above InpRSIOversold (30 by default) and -1 when rsi[1] drops below InpRSIOverbought (70 by default), so the RSI here is a rebound-from-extreme trigger, not a directional bias. Donchian walks Max(High[2..N+1]) and Min(Low[2..N+1]) to form upper and lower channels, then votes +1 if the previous bar's close prints above the upper band and -1 if it prints below the lower band. Heiken Ashi rebuilds the smoothed open/close history from the last 10 OHLC bars, detects a red-to-green flip (HA close rising above HA open on the most recent bar while the bar before was red) for a buy vote, and the green-to-red flip for a sell. Supertrend, computed against an internal iATR(InpSupertrendPeriod) handle with InpSupertrendMultiplier=3.0, returns +1 when the trend flips from -1 to 1 on the last bar and -1 on the opposite flip.
The final decision tree lives in CheckEntry(). It tallies buy and sell votes across the enabled indicators, increments a total_indicators counter for each enabled entry indicator, and then applies the LOGIC_MODE switch. Under LOGIC_AND the buy_condition fires only when signal_buy equals total_indicators (perfect consensus), and the sell_condition only when signal_sell does the same — that strict gate is what makes the AND mode a low-frequency, high-conviction system. Under LOGIC_OR any non-zero vote triggers the condition. The branch also enforces a mutual-exclusion rule (buy_condition && !sell_condition or vice versa) so the EA never fires both sides on the same tick. Lot sizing is delegated to CalculateLotSize(InpStopLossPoints): it reads the account balance, multiplies by InpRiskPercent (1.0% default), divides by (sl_points × value_per_point), clamps to InpMaxLotSize (10.0) and to the symbol's SYMBOL_VOLUME_MAX, normalizes to SYMBOL_VOLUME_STEP, and returns 0 if the resulting lot is below the broker's SYMBOL_VOLUME_MIN (signaling the account is too small to honor the risk at the configured SL).
Position management is the second distinct half of the design. PyramidSafe=true (the default) means that before adding a position the EA walks the existing book via IsPyramidSafe() and refuses to scale in unless every open position for this magic is currently in profit (m_position.Profit() > 0) and either the buy SL is above the open or the sell SL is below the open with a non-zero SL. That effectively forces the EA to pyramid only into a confirmed move. The hard cap is InpMaxPositions=5 — OnTick gates CheckEntry behind total_positions < InpMaxPositions, so even in OR mode the EA never overruns the configured ceiling. Exits are driven by CheckExit(), which on the close-on-reverse path (InpCloseOnReverse=true) loops the book and closes a long when a -1 signal arrives (or a short when a +1 signal arrives). Only MACD's exit signal is currently implemented in the exit branch (other indicators are commented as "Add other indicators for exit"), so until a trader expands that section the exit stream is effectively single-indicator. The fixed SL of 500 points and the fixed TP of 1000 points give a 1:2 risk-to-reward ratio on every entry, which is the right shape for an OR-mode system but means AND-mode trades carry the same R:R rather than a tighter one.
The time filter keeps the EA on the broker's local clock and gates both entries and the per-tick decision to manage exits. With InpUseTimeFilter=true, IsTimeAllowed() reads the current time, slices HH:MM out of TimeToString, and accepts the tick if it falls inside Session1 (InpStartTime1=08:00 → InpEndTime1=12:00) OR Session2 (InpStartTime2=13:00 → InpEndTime2=17:00). That nine-hour London + New York block leaves the Asian session dormant and creates a 60-minute dead zone between 12:00 and 13:00 when the EA neither enters new trades nor actively manages open ones (the early return in OnTick applies to both branches). For a broker hosted in GMT+0/GMT+2 this maps cleanly onto the actual London and New York cash sessions; for brokers hosted elsewhere, the user is expected to adjust the strings until the windows line up with the real liquidity hours they want to trade.
The retry helpers at the bottom of the file (TryClose_EX12069, TryClosePartial_EX12069, TryModify_EX12069) are the EA's concession to real-world exchange noise. Each one runs a 3-attempt loop, sleeps 200 ms (or 100 ms for the modify path) on a TRADE_RETCODE of REQUOTE/TIMEOUT/PRICE_OFF/PRICE_CHANGED, and breaks on any other retcode. The close helpers accept a DONE or DONE_PARTIAL as success. These wrappers are not called by the strategy code itself today — the strategy uses m_trade directly — but they sit in the file as ready-made utilities for any user who wants to wrap the open-trades bookkeeping in more defensive logic. There is no trailing-stop function, no break-even ratchet, no partial-close by profit target, and no dashboard, so the only per-trade management logic that actually runs is the SL/TP attached at entry plus the CheckExit reversal pass.
In practical terms, a trader should expect: an EA that is mid-frequency on M5 gold, fires 1–3 trades per London/NY session when in AND mode and noticeably more in OR mode, scales into winners up to five times when PyramidSafe is on, takes a 1:2 R:R on every entry, and exits on a single MACD reversal print (or, if InpCloseOnReverse=false, lets the SL/TP handle everything). The $100 minimum deposit is fine for 0.01-lot risk-percent sizing on a 500-point SL, but the 10.0-lot hard ceiling will never trip on a retail account and is there as a circuit-breaker for funded prop accounts. The recommended broker type is ECN/RAW with low spread and fast requote recovery — the retry helpers are written specifically for the requote storms that come with low-latency ECNs during London open.
Strategy Deep Dive
On every tick, IsTimeAllowed() short-circuits the call unless the local clock falls inside Session1 (08:00–12:00) or Session2 (13:00–17:00), creating a 9-hour London + New York window with a 60-minute dead zone at lunch. CheckExit() runs first when there are open positions, walking the book and triggering a close on any wired -1 reversal signal (MACD only today). CheckEntry() then tallies buy and sell votes from each enabled indicator — MACD via iMACD 12/26/9 on the chosen applied price, RSI via iRSI 14 on oversold/overbought rebound, Donchian via internal max-high/min-low channels over InpDonchianPeriod+2 bars, Heiken Ashi via a 10-bar internal recompute, and Supertrend via a 100-bar internal ATR-based trend flip. The final gate applies LOGIC_AND (perfect consensus) or LOGIC_OR (any vote) and adds a position sized to 1% account risk with a 10.0-lot ceiling, capped at 5 total positions and gated by IsPyramidSafe()'s all-profitable-and-SL-secured rule on pyramid entries.
Entry fires when the configured consensus rule is satisfied across the enabled indicators: under LOGIC_AND (default) every enabled entry indicator must vote +1 for a long (or -1 for a short) on the same tick, while under LOGIC_OR any single non-zero vote is enough. MACD votes on main/signal crossovers, RSI on cross-back from oversold/overbought, Donchian on close-above-upper-band / close-below-lower-band, Heiken Ashi on red-to-green / green-to-red flips, and Supertrend on trend-direction flips. The tick must also fall inside Session1 (08:00–12:00) or Session2 (13:00–17:00) and the position count must be below InpMaxPositions=5.
Exit is driven by CheckExit() which on the InpCloseOnReverse=true path closes a long when a -1 reversal signal arrives (or a short when +1 arrives) — only the MACD exit branch is wired in the source. Otherwise positions run to either the 1000-point fixed TP or the 500-point fixed SL whichever hits first. There is no trailing-stop, no break-even ratchet, and no partial-close function in the live strategy code.
Per-trade SL is the fixed 500 points (InpStopLossPoints) attached at entry — there is no per-bar ATR trailing, no break-even, and no dynamic SL ratchet. Pyramid adds also inherit the same 500-point SL on each new entry; IsPyramidSafe() rejects the add if any existing position is in loss or has SL on the wrong side of open.
Per-trade TP is the fixed 1000 points (InpTakeProfitPoints), giving a 1:2 risk-to-reward ratio against the 500-point SL on every entry. TP is the only profit-taking mechanism — there is no scaling-out, no basket-TP, and no partial close in the live code.
Best for XAUUSD M5 traders running an ECN/RAW-spread broker with low latency (the 200ms retry loops are tuned for requote storms on London open), with a recommended starting balance of $100 for 0.01-lot risk sizing. The London + New York session window (08:00–12:00 and 13:00–17:00 broker local time) plus the strict 1:2 R:R make this a fit for trend-day traders who want either a high-conviction AND-consensus system or a permissive OR-mode trigger, and the 5-position pyramid cap with PyramidSafe is suitable for prop-funded accounts that allow scaling into winners.
Strategy Logic
Pipsgrowth EX12069 MultiIndicatorConfluence — Strategy Logic Analysis (from .mq5 source)
Family: MultiIndicatorConfluence
Magic: 22212069
Version: 2.00
BRIEF:
Multi-indicator confluence EA for XAUUSD M5 combining MACD, RSI, Supertrend, Donchian and Heiken Ashi signals with AND/OR entry logic, pyramiding and time filters. 12 layers: REGIME, SIGNAL, ENTRY, CONFIRM, NO-TRADE, CAPITAL CAP, RISK, SIZING, MANAGE, EXIT, SCALING, OnTester
INDICATOR STACK:
- Standard
MT5indicators
KEY FUNCTIONS:
CheckEntry()CheckExit()IsPyramidSafe()IsTimeAllowed()CalculateLotSize()GetMACDSignal()GetRSISignal()GetDonchianSignal()GetHeikenAshiSignal()GetSupertrendSignal()TryClose_EX12069()TryClosePartial_EX12069()- ...and 1 more
INTERNAL CONSTANTS (0 total):
INPUT PARAMETERS (41 total across 9 groups):
- [=== Risk Management ===]
InpRiskPercent=1.0// Risk Percent per Trade - [=== Risk Management ===]
InpMaxLotSize=10.0// Max Lot Size Allowed - [=== Risk Management ===]
InpStopLossPoints= 500 // StopLoss(Points) - [=== Risk Management ===]
InpTakeProfitPoints= 1000 // TakeProfit(Points) - [=== Identity ===]
InpMagicNumber=22212069// Magic Number - [=== Identity ===]
InpTradeComment= "Psgrowth.com Expert_12069" // TradeComment - [=== Trading Logic ===]
InpPyramidSafe=true// PyramidSafe(Only add if all green) - [=== Trading Logic ===]
InpMaxPositions= 5 // Max Open Positions - [=== Trading Logic ===]
InpCloseOnReverse=true// Close on OppositeSignal(90% chance) - [=== Trading Logic ===]
InpEntryLogic=LOGIC_AND// Entry LogicMode(AND/OR) - [=== Time Management ===]
InpUseTimeFilter=true// Use Time Filter - [=== Time Management ===]
InpStartTime1= "08:00" // Session 1 Start - [=== Time Management ===]
InpEndTime1= "12:00" // Session 1 End - [=== Time Management ===]
InpStartTime2= "13:00" // Session 2 Start - [=== Time Management ===]
InpEndTime2= "17:00" // Session 2 End - [===
MACDSettings ===]InpUseMACD=true// UseMACD - [===
MACDSettings ===]InpMACDForEntry=true// Use for Entry - [===
MACDSettings ===]InpMACDForExit=true// Use for Exit - [===
MACDSettings ===]InpMACDFastEMA= 12 // FastEMA - [===
MACDSettings ===]InpMACDSlowEMA= 26 // SlowEMA - [===
MACDSettings ===]InpMACDSignalSMA= 9 // SignalSMA - [===
MACDSettings ===]InpMACDPrice= 1 // Applied price (1=close,2=open,3=high,4=low,5=median,6=typical,7=weighted) // Applied Price - [===
RSISettings ===]InpUseRSI=true// UseRSI - [===
RSISettings ===]InpRSIForEntry=true// Use for Entry - [===
RSISettings ===]InpRSIForExit=false// Use for Exit - [===
RSISettings ===]InpRSIPeriod= 14 // Period - [===
RSISettings ===]InpRSIPrice= 1 // Applied price (1=close,2=open,3=high,4=low,5=median,6=typical,7=weighted) // Applied Price - [===
RSISettings ===]InpRSIOverbought=70.0// Overbought Level - [===
RSISettings ===]InpRSIOversold=30.0// Oversold Level - [=== Supertrend Settings ===]
InpUseSupertrend=false// Use Supertrend - [=== Supertrend Settings ===]
InpSupertrendForEntry=true// Use for Entry - [=== Supertrend Settings ===]
InpSupertrendForExit=true// Use for Exit - [=== Supertrend Settings ===]
InpSupertrendPeriod= 10 // Period - [=== Supertrend Settings ===]
InpSupertrendMultiplier=3.0// Multiplier - [=== Donchian Settings ===]
InpUseDonchian=false// Use Donchian - [=== Donchian Settings ===]
InpDonchianForEntry=false// Use for Entry - [=== Donchian Settings ===]
InpDonchianForExit=false// Use for Exit - [=== Donchian Settings ===]
InpDonchianPeriod= 20 // Period - [=== Heiken Ashi Settings ===]
InpUseHA=false// Use Heiken Ashi - [=== Heiken Ashi Settings ===]
InpHAForEntry=false// Use for Entry - [=== Heiken Ashi Settings ===]
InpHAForExit=true// Use for Exit
// Pipsgrowth EX12069 MultiIndicatorConfluence — Execution Flow (from source analysis)
// Family: MultiIndicatorConfluence
// Multi-indicator confluence EA for XAUUSD M5 combining MACD, RSI, Supertrend, Donchian and Heiken Ashi signals with AND/OR entry logic, pyramiding and time filters. 12 layers: REGIME, SIGNAL, ENTRY, CONFIRM, NO-TRADE, CAPITAL CAP, RISK, SIZING, MANAGE, EXIT, SCALING, OnTester
ON_INIT:
Create indicator handles: standard set
Initialize state variables
Detect broker GMT offset
ON_TICK:
1. Refresh indicator buffers (closed-bar shift=1)
2. Manage existing positions:
- Break-even check
- ATR trailing stop
- Profit lock ratchet
- Time-based exit
- Opposite-signal exit
3. If new bar:
a. ClassifyRegime() — ADX/ATR/BB regime detection
b. NoTradeGate() checks:
- Market open + session filter
- Spread limit
- Cooldown after loss
- Consecutive loss limit
- Kill switch
- Max drawdown
- Max concurrent positions
- Daily/weekly loss limits
c. GenerateSignal() — strategy-specific entry logic
d. CheckConfirm() — HTF alignment + R:R + ADX minimum
e. Calculate position size from risk %
f. Execute with retry logic
g. Mark bar to prevent duplicates
ON_TESTER:
Custom fitness = weighted(RecoveryFactor, ROI, ProfitFactor, TradeCount, Sharpe, Drawdown)Optimization Profile
How to Install This EA on MT5
- 1Download the .mq5 file using the button above
- 2Open MetaTrader 5 on your computer
- 3Click File → Open Data Folder in the top menu
- 4Navigate to MQL5 → Experts and paste the .mq5 file there
- 5In MT5, right-click Expert Advisors in the Navigator panel → Refresh
- 6Drag the EA onto a chart matching the recommended timeframe
- 7Configure parameters according to the table on this page
- 8Enable Allow Algo Trading and click OK
EA Parameters
| Parameter | Default | Description |
|---|---|---|
| InpRiskPercent | 1.0 | Risk Percent per Trade |
| InpMaxLotSize | 10.0 | Max Lot Size Allowed |
| InpStopLossPoints | 500 | Stop Loss (Points) |
| InpTakeProfitPoints | 1000 | Take Profit (Points) |
| InpMagicNumber | 22212069 | Magic Number |
| InpTradeComment | "Psgrowth.com Expert_12069" | Trade Comment |
| InpPyramidSafe | true | Pyramid Safe (Only add if all green) |
| InpMaxPositions | 5 | Max Open Positions |
| InpCloseOnReverse | true | Close on Opposite Signal (90% chance) |
| InpEntryLogic | LOGIC_AND | Entry Logic Mode (AND/OR) |
| InpUseTimeFilter | true | Use Time Filter |
| InpStartTime1 | "08:00" | Session 1 Start |
| InpEndTime1 | "12:00" | Session 1 End |
| InpStartTime2 | "13:00" | Session 2 Start |
| InpEndTime2 | "17:00" | Session 2 End |
| InpUseMACD | true | Use MACD |
| InpMACDForEntry | true | Use for Entry |
| InpMACDForExit | true | Use for Exit |
| InpMACDFastEMA | 12 | Fast EMA |
| InpMACDSlowEMA | 26 | Slow EMA |
| InpMACDSignalSMA | 9 | Signal SMA |
| InpMACDPrice | 1 | Applied price (1=close,2=open,3=high,4=low,5=median,6=typical,7=weighted) // Applied Price |
| InpUseRSI | true | Use RSI |
| InpRSIForEntry | true | Use for Entry |
| InpRSIForExit | false | Use for Exit |
| InpRSIPeriod | 14 | Period |
| InpRSIPrice | 1 | Applied price (1=close,2=open,3=high,4=low,5=median,6=typical,7=weighted) // Applied Price |
| InpRSIOverbought | 70.0 | Overbought Level |
| InpRSIOversold | 30.0 | Oversold Level |
| InpUseSupertrend | false | Use Supertrend |
| InpSupertrendForEntry | true | Use for Entry |
| InpSupertrendForExit | true | Use for Exit |
| InpSupertrendPeriod | 10 | Period |
| InpSupertrendMultiplier | 3.0 | Multiplier |
| InpUseDonchian | false | Use Donchian |
| InpDonchianForEntry | false | Use for Entry |
| InpDonchianForExit | false | Use for Exit |
| InpDonchianPeriod | 20 | Period |
| InpUseHA | false | Use Heiken Ashi |
| InpHAForEntry | false | Use for Entry |
| InpHAForExit | true | Use for Exit |
#property copyright "Pipsgrowth.com"
#property link "https://pipsgrowth.com"
#property version "2.00"
#property strict
#property description "Pipsgrowth.com EX12069 XAUUSD_M5 — Multi-indicator confluence EA (MACD+RSI+Supertrend+Donchian+HA), full 12-layer stack."
#include <Trade\Trade.mqh>
#include <Trade\PositionInfo.mqh>
#include <Trade\SymbolInfo.mqh>
#include <Trade\AccountInfo.mqh>
CTrade m_trade;
CPositionInfo m_position;
CSymbolInfo m_symbol;
CAccountInfo m_account;
//--- Enums
enum ENUM_LOGIC_MODE {
LOGIC_AND, // All signals must match
LOGIC_OR // At least one signal matches
};
//--- Inputs
ENUM_APPLIED_PRICE MapAppliedPriceInt(int ap)
{
switch(ap)
{
case 1: return PRICE_CLOSE;
case 2: return PRICE_OPEN;
case 3: return PRICE_HIGH;
case 4: return PRICE_LOW;
case 5: return PRICE_MEDIAN;
case 6: return PRICE_TYPICAL;
case 7: return PRICE_WEIGHTED;
default: return PRICE_CLOSE;
}
}
ENUM_APPLIED_PRICE g_InpMACDPrice = PRICE_CLOSE;
ENUM_APPLIED_PRICE g_InpRSIPrice = PRICE_CLOSE;
input group "=== Risk Management ==="
input double InpRiskPercent = 1.0; // Risk Percent per Trade
input double InpMaxLotSize = 10.0; // Max Lot Size Allowed
input int InpStopLossPoints = 500; // Stop Loss (Points)
input int InpTakeProfitPoints = 1000; // Take Profit (Points)
ENUM_APPLIED_PRICE MapAppliedPriceInt(int ap)
{
switch(ap)
{
case 1: return PRICE_CLOSE;
case 2: return PRICE_OPEN;
case 3: return PRICE_HIGH;
case 4: return PRICE_LOW;
case 5: return PRICE_MEDIAN;
case 6: return PRICE_TYPICAL;
case 7: return PRICE_WEIGHTED;
default: return PRICE_CLOSE;
}
}
ENUM_APPLIED_PRICE g_InpMACDPrice = PRICE_CLOSE;
Full source code available on download
Educational purposes only. Do NOT use with real money. Test on demo accounts only.
Clear Warning: Educational Purposes Only
Clear Warning: This Expert Advisor is for educational and testing purposes only. Do NOT use it with real money. Test only on demo accounts. Trading with real money involves substantial risk of capital loss. This does not constitute investment advice.
Recommended Brokers for This EA
These EAs run on MT5 — use a regulated broker with fast execution and tight spreads
Markets.com
Exness
IC Markets
Similar Expert Advisors
View All Expert AdvisorsMore Other strategy EAs from our library
Pipsgrowth EX01007 Adaptive
Pipsgrowth.com EX01007 Adaptive XAUUSD 5M — multi-indicator signal scorer with regime filter, full 12-layer stack, configurable timeframe, trailing/BE/profit-lock toggles, pyramid gate, spread filter, new-bar gate, filling mode detection.
Pipsgrowth EX01019 Adaptive
Pipsgrowth.com EX01019 Self-Adaptive Market EA Fixed — multi-regime adaptive EA, full 12-layer stack.
Pipsgrowth EX15029 SMC-OrderBlock
Pipsgrowth.com EX15029 SMCBreakoutEA — SMC breakout CHOCH/liquidity sweep EA, full 12-layer stack.
Community
Educational purposes only. Do NOT use with real money. Test on demo accounts only.