Pipsgrowth EX12003 MultiIndicatorConfluence
MT5 Expert Advisor (Open Source) · XAUUSD · M5, M30
Pipsgrowth.com EX12003 Confluence XAUUSD 5M — 4-indicator AND-gate confluence EA, full 12-layer stack.
Overview
Pipsgrowth EX12003 is a four-of-four agreement engine. Every entry decision has to clear an AND gate of four independent indicators on the same closed bar: EMA(12) above EMA(50), MACD main above its signal, RSI(14) sitting on the right side of the midline with a five-point buffer, and the closing price on the right side of the Bollinger Band(20, 2.0) midline. Any condition that fails to agree downgrades the vote; if even one of the four disagrees the EA returns 0 and does nothing. This is a deliberate trade for signal quality over signal frequency — the EA is not trying to find trades, it is trying to find bars where momentum, trend, oscillator, and price location all line up in the same direction at the same time. The four conditions are computed in the CoreSignal() function and counted as bullVotes/bearVotes out of a total of 4; the function only returns +1 or -1 when all four votes align, with confidence hard-pinned at 100.
The four signals are all inlined from native MQL primitives — iMA, iRSI, iMACD, iBands — plus iADX and iATR for the regime and risk layers. There is no iCustom call anywhere in the source, which means the EA reproduces identically across brokers and indicator vendors. The eight indicator handles (fast EMA, slow EMA, RSI, MACD, ADX, ATR, Bollinger Bands, and a higher-timeframe EMA) are created in OnInit and released in OnDeinit, and the OnInit block also pulls the broker's point, tick value, tick size, stops-level, and volume step/min/max so all the helpers (NormPrice, ClampVol, MinStopsDist) work portably. g_trade.SetTypeFillingBySymbol(_Symbol) lets the EA pick FOK, IOC, or RETURN automatically based on what the broker actually supports.
The regime classifier in DetectRegime() returns one of seven enum states — STRONG_TREND, WEAK_TREND, EXPAND, COMPRESS, BREAKOUT, RANGE, CHOPPY — by reading ADX(14) and an ATR percentile rank over the last InpATRPctLookback (60) bars plus the current versus prior Bollinger width. ADX at or above 30 is a strong trend; ADX at or above the InpADXMin of 20 is a weak trend; ATR-percentile above 70 with current BB-width at least 1.15 times the prior BB-width is expansion; ATR-percentile below 25 is compression; a very tight band with rising ADX is treated as a breakout setup; otherwise the bar is range. CHOPPY is the catch-all that the function returns when there is not enough indicator data on the bar — and CHOPPY is the one state the no-trade block rejects outright. A regime-change into CHOPPY, RANGE, or COMPRESS during an open trade also triggers an exit (see OppositeAndRegimeExit).
Three further filters run after the signal. ConfirmEntry() requires the close on the current timeframe to be on the right side of the higher-timeframe EMA(50) — the HTF defaults to H1 via MapTimeframeInt(InpHTF) where InpHTF=8 falls through to H1 — and the spread to be at or below InpMaxSpreadPts (250 points, set with XAUUSD in mind), and the server clock to fall inside the 6-22 trading window. NoTradeBlock() adds the kill switch check, the kill-switch-adjacent abnormal-spread and out-of-session checks, the CHOPPY regime check, a news/big-candle check that blocks entries when the previous bar's range is more than 3x the ATR (BIG_CANDLE_ATR_MULT), the cooldown-after-losses timer, the effective-capital floor (default $50), the 3% daily loss limit, the max-open-trades cap of one, and a Friday-after-21 plus weekend gate. Only when all of those clear does the EA try to send.
Position sizing is straightforward risk-percent. CalcLots(slDistancePrice) reads the effective capital — which is the smaller of InpCapitalCapAmount and account equity when the cap is enabled, or the full equity when the cap is zero (the default) — multiplies it by InpRiskPercent (0.5%), divides by the per-lot loss at the proposed stop, and floors the result to the broker's volume step. The stop distance is ATR(14) * InpATRSLMult (2.0), lifted to the broker's SYMBOL_TRADE_STOPS_LEVEL if necessary. The take-profit is slDist * InpRRTP (2.0), giving a 1:2 reward-to-risk ratio. Margin is pre-checked with OrderCalcMargin before any send, and InpDryRun is true by default — the EA logs the intended trade but does not call g_trade.Buy/g_trade.Sell until you flip it off. A single retry with a 150ms sleep handles a transient REQUOTE.
ManageExits() runs every tick, not just on a new bar, and layers five exit paths. The first three fire at +1R from entry: the stop ratchets to break-even at the open price (one-shot, never loosens), 50% of the position is closed as a partial TP (PARTIAL_TP_PCT=50), and the ATR(14)*InpATRTrailMult (2.5) trail starts ratcheting forward-only. The fourth is a time exit at MAX_BARS_IN_TRADE=120 bars (10 hours on M5, scaled to whatever the timeframe is). The fifth, in OppositeAndRegimeExit(), closes the trade when CoreSignal flips to the opposite side, or when the regime drops into CHOPPY, RANGE, or COMPRESS. The close and modify helpers (TryClose_EX12003, TryClosePartial_EX12003, TryModify_EX12003) each retry three times at 200ms or 100ms on REQUOTE, TIMEOUT, PRICE_OFF, or PRICE_CHANGED responses, and give up cleanly on anything else.
Loss tracking and the cooldown use the OnTradeTransaction event — not the EA's own bookkeeping — and read the DEAL_PROFIT, DEAL_SWAP, and DEAL_COMMISSION of every DEAL_ENTRY_OUT and DEAL_ENTRY_INOUT deal whose magic and symbol match. Three consecutive losses (COOLDOWN_AFTER_LOSS=3) set g_cooldown_until to now + 3 periods, after which the counter resets. The OnTester custom criterion is (net * profitFactor) / (1 + |balance DD|), gated on at least 30 trades, which keeps the EA's reported backtest score from being skewed by tiny sample sizes. The InpKillSwitch input is a panic button — set it to true and the EA will close every position on the next tick and not open new ones. Scaling into winners (pyramiding) is intentionally disabled: MAX_OPEN_TRADES is hardcoded to 1, the comment in the scaling section reads "Pyramid path intentionally not enabled — gating by max open trades."
What to expect on a chart. EX12003 is a session-filtered, regime-aware, all-of-confluence EA. On XAUUSD M5 in a clean London or New York trend, the four conditions align often enough to keep trade frequency in the comfortable single-digit-per-day range; in a quiet Asian session or a choppy re-entry pattern, you will see hours of zero trades and then one clean bar. The 1:2 reward-to-risk and the 1R BE+partial+trail stack mean a typical winner is 1.5-2x the stop, and the EA gives back very little on the losers because the stop moves to break-even before the partial fires. The dry-run default is the right place to start — let it log a few weeks of intended trades, check the magic and comment in the journal, then disable InpDryRun when you trust the regime/HTF settings on your broker's hours and gold-spread profile.
Strategy Deep Dive
Each new bar the EA reads eight native indicator handles and runs the four checks in CoreSignal() — EMA(12)/EMA(50) direction, MACD main-vs-signal, RSI(14) side of 50 with a 5-point buffer, and Close vs Bollinger(20, 2.0) midline — counting bullVotes and bearVotes out of 4. A signal only returns +1 or -1 when all four agree (confidence hard-pinned at 100); anything less returns 0 and the EA skips. The 7-state regime classifier in DetectRegime() reads ADX(14) and an ATR percentile over 60 bars plus current-vs-prior Bollinger width to tag the bar as STRONG_TREND, WEAK_TREND, EXPAND, COMPRESS, BREAKOUT, RANGE, or CHOPPY; CHOPPY is the no-trade block. ConfirmEntry() then checks the higher-timeframe EMA(50) (default H1, since InpHTF=8 falls through to PERIOD_H1) for direction agreement, the spread against the 250-point cap, and the 6-22 server session. NoTradeBlock() adds a big-candle check (previous bar range > 3x ATR), the cooldown timer, the $50 capital floor, the 3% daily loss limit, the single-position cap, and the Friday-21+ weekend gate. Sizing is risk-percent on the effective capital: lots = (eff_cap * 0.5%) / lossPerLot, floored to the broker's volume step, with margin pre-checked by OrderCalcMargin and InpDryRun=true by default. ManageExits() runs every tick: at +1R the stop ratchets to break-even (one-shot) and 50% of the position is closed as partial TP, then the ATR(14)*2.5 trail takes over. Time exit at 120 bars (10h on M5), opposite-signal exit, and regime-change exit (CHOPPY/RANGE/COMPRESS) all close the trade. Three consecutive losses (read from the OnTradeTransaction deal stream, not the EA's own bookkeeping) trigger a 3-bar cooldown. The OnTester custom criterion is (net * PF) / (1 + |DD|), gated on at least 30 trades.
A long (or short) signal fires only when all four conditions agree on the same closed bar: EMA(12) > EMA(50) AND MACD main > signal AND RSI(14) > 55 (or < 45 for shorts) AND Close > Bollinger(20, 2.0) midline. CoreSignal() then layers a regime gate (CHOPPY blocks; STRONG/WEAK_TREND, EXPAND, BREAKOUT, or RANGE all pass), an HTF EMA(50) agreement check, a 250-point XAUUSD-tuned spread cap, and the 6-22 session window before TryEntry sizes and sends.
Five exit paths run every tick: break-even ratchet at +1R (one-shot), 50% partial close at +1R, ATR(14)*2.5 forward-only trail, 120-bar time exit (10 hours on M5), and OppositeAndRegimeExit() which closes the position when CoreSignal flips to the opposite side or when the regime drops into CHOPPY, RANGE, or COMPRESS.
Stop is ATR(14) * InpATRSLMult (2.0), lifted to the broker's SYMBOL_TRADE_STOPS_LEVEL when the resulting distance would be tighter than the minimum, with InpMaxSpreadPts capped at 250 points (XAUUSD-tuned). At +1R the stop ratchets to the open price as a one-shot break-even — it never loosens after that.
Take-profit is SL distance * InpRRTP (2.0), giving a 1:2 reward-to-risk ratio. A 50% partial close fires at +1R (PARTIAL_TP_PCT=50), and the remaining half rides the ATR(14)*InpATRTrailMult trail until either the +2R target, the time exit at 120 bars, the regime-change exit, or the opposite-signal exit — whichever comes first.
XAUUSD M5 traders who want a low-frequency, high-confluence entry on a single open position, with $100 minimum and 0.5% risk per trade on the effective capital (set InpCapitalCapAmount to a fixed dollar exposure if you want a hard ceiling). Run on an ECN or RAW-spread broker so the 250-point cap is not the binding constraint, in the 6-22 server window (London + New York), and keep InpDryRun on for at least a couple of weeks of journaling before you let it send. The 1:2 R:R plus 1R BE+partial+trail means a typical winner is 1.5-2x the stop, so the EA fits an account that can absorb the occasional full-2R loser in exchange for the 4-of-4 quality filter.
Strategy Logic
Pipsgrowth EX12003 MultiIndicatorConfluence — Strategy Logic Analysis (from .mq5 source)
Family: MultiIndicatorConfluence
Magic: 22212003
Version: 2.00
BRIEF:
Preserves the original 1218 thesis: ALL-OF confluence (AND gate) of FastEMA>SlowEMA, MACD main>signal, RSI>50, Close>BB-Mid (4-of-4 agreement on closed bar), then layers in the 12 mandatory layers. All inlined from native primitives (iMA/iRSI/iMACD/iBands/iADX/iATR + CopyClose) — no iCustom. 12 layers: REGIME, SIGNAL, ENTRY, CONFIRM, NO-TRADE, CAPITAL CAP, RISK, SIZING, MANAGE, EXIT, SCALING, OnTester
INDICATOR STACK:
- MAFast
- MASlow
RSIMACDADXATRBBHTFEMA
KEY FUNCTIONS:
NormPrice()ClampVol()MinStopsDist()SpreadPoints()InSession()IsNewBar()EffectiveCapital()RealizedPnLToday()CountMyPositions()CoreSignal()ConfirmEntry()NoTradeBlock()- ...and 9 more
INTERNAL CONSTANTS (1 total):
BIG_CANDLE_ATR_MULT=3.0// ===================GLOBALS/HANDLES==============================
INPUT PARAMETERS (21 total across 6 groups):
- [=== Identity ===]
InpMagic=22212003// Magic number - [=== Identity ===]
InpTradeComment= "Psgrowth.com Expert_12003" // Trade comment - [=== Signal:
Confluence(AND of 4) ===]InpFastMA= 12 // FastEMAperiod (bars) - [=== Signal:
Confluence(AND of 4) ===]InpSlowMA= 50 // SlowEMAperiod (bars) - [=== Signal:
Confluence(AND of 4) ===]InpRSIPeriod= 14 //RSIperiod (bars) - [=== Signal:
Confluence(AND of 4) ===]InpRSIMidLine= 50 //RSImid-line threshold - [=== Signal:
Confluence(AND of 4) ===]InpMinRSISide=5.0// Min |RSI- 50| to count side - [=== Regime Gate ===]
InpADXMin=20.0// MinADXforWeakTrend - [=== Regime Gate ===]
InpATRPctLookback= 60 //ATRpercentile lookback (bars) - [=== Confirm & No-Trade ===]
InpHTF= 8 //Timeframe(1=M1,2=M5,3=M15,4=M30,5=H1,6=H4,7=D1) //HTFtrend time-frame - [=== Confirm & No-Trade ===]
InpHTFEMA= 50 //HTFEMAperiod (bars) - [=== Confirm & No-Trade ===]
InpMaxSpreadPts=250.0// Max spread (points,XAUUSD-tuned) - [=== Risk & Sizing ===]
InpDryRun=true// Dry-run: no real sends - [=== Risk & Sizing ===]
InpKillSwitch=false// Kill switch (closes all on tick) - [=== Risk & Sizing ===]
InpCapitalCapAmount=0.0// Capital cap amount ($ equity) - [=== Risk & Sizing ===]
InpCapitalCapFloor=50.0// Capital cap floor ($) - [=== Risk & Sizing ===]
InpRiskPercent=0.5// Risk per trade (% of eff. cap) - [=== Risk & Sizing ===]
InpDailyLossLimit=3.0// Daily loss limit (% of eff. cap) - [=== Risk & Sizing ===]
InpATRSLMult=2.0// SL =ATRx mult - [=== Risk & Sizing ===]
InpRRTP=2.0// TP = R x mult (R = SL dist) - [=== Manage & Exit ===]
InpATRTrailMult=2.5//ATRtrail distance (xATR)
// Pipsgrowth EX12003 MultiIndicatorConfluence — Execution Flow (from source analysis)
// Family: MultiIndicatorConfluence
// Preserves the original 1218 thesis: ALL-OF confluence (AND gate) of FastEMA>SlowEMA, MACD main>signal, RSI>50, Close>BB-Mid (4-of-4 agreement on closed bar), then layers in the 12 mandatory layers. All inlined from native primitives (iMA/iRSI/iMACD/iBands/iADX/iATR + CopyClose) — no iCustom. 12 layers: REGIME, SIGNAL, ENTRY, CONFIRM, NO-TRADE, CAPITAL CAP, RISK, SIZING, MANAGE, EXIT, SCALING, OnTester
ON_INIT:
Create indicator handles: MAFast, MASlow, RSI, MACD, ADX, ATR, BB, HTFEMA
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 |
|---|---|---|
| InpMagic | 22212003 | Magic number |
| InpTradeComment | "Psgrowth.com Expert_12003" | Trade comment |
| InpFastMA | 12 | Fast EMA period (bars) |
| InpSlowMA | 50 | Slow EMA period (bars) |
| InpRSIPeriod | 14 | RSI period (bars) |
| InpRSIMidLine | 50 | RSI mid-line threshold |
| InpMinRSISide | 5.0 | Min |RSI - 50| to count side |
| InpADXMin | 20.0 | Min ADX for WeakTrend |
| InpATRPctLookback | 60 | ATR percentile lookback (bars) |
| InpHTF | 8 | Timeframe (1=M1,2=M5,3=M15,4=M30,5=H1,6=H4,7=D1) // HTF trend time-frame |
| InpHTFEMA | 50 | HTF EMA period (bars) |
| InpMaxSpreadPts | 250.0 | Max spread (points, XAUUSD-tuned) |
| InpDryRun | true | Dry-run: no real sends |
| InpKillSwitch | false | Kill switch (closes all on tick) |
| InpCapitalCapAmount | 0.0 | Capital cap amount ($ equity) |
| InpCapitalCapFloor | 50.0 | Capital cap floor ($) |
| InpRiskPercent | 0.5 | Risk per trade (% of eff. cap) |
| InpDailyLossLimit | 3.0 | Daily loss limit (% of eff. cap) |
| InpATRSLMult | 2.0 | SL = ATR x mult |
| InpRRTP | 2.0 | TP = R x mult (R = SL dist) |
| InpATRTrailMult | 2.5 | ATR trail distance (x ATR) |
#property copyright "Pipsgrowth.com"
#property link "https://pipsgrowth.com"
#property version "2.00"
#property strict
#property description "Pipsgrowth.com EX12003 Confluence XAUUSD 5M — 4-indicator AND-gate confluence EA, full 12-layer stack."
#include <Trade\Trade.mqh>
#include <Trade\PositionInfo.mqh>
#include <Trade\SymbolInfo.mqh>
#include <Trade\AccountInfo.mqh>
#include <Trade\OrderInfo.mqh>
#include <Trade\DealInfo.mqh>
CTrade g_trade;
CPositionInfo g_pos;
CSymbolInfo g_sym;
CAccountInfo g_acc;
//=================== INPUTS (20 total) =============================
ENUM_TIMEFRAMES MapTimeframeInt(int tf)
{
switch(tf)
{
case 1: return PERIOD_M1;
case 2: return PERIOD_M5;
case 3: return PERIOD_M15;
case 4: return PERIOD_M30;
case 5: return PERIOD_H1;
case 6: return PERIOD_H4;
case 7: return PERIOD_D1;
default: return PERIOD_H1;
}
}
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_TIMEFRAMES g_InpHTF = PERIOD_H1;
input group "=== Identity ==="
input long InpMagic = 22212003; // Magic number
input string InpTradeComment = "Psgrowth.com Expert_12003"; // Trade comment
ENUM_TIMEFRAMES MapTimeframeInt(int tf)
{
switch(tf)
{
case 1: return PERIOD_M1;
case 2: return PERIOD_M5;
case 3: return PERIOD_M15;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.