Pipsgrowth EX12002 MultiIndicatorConfluence
MT5 Expert Advisor (Open Source) · XAUUSD · M1
Pipsgrowth.com EX12002 MultiIndicatorConfluence v2 — enhanced 8-indicator confluence, full 12-layer stack.
Overview
EX12002 is a vote-counting confluence engine, not a single-signal EA. It stacks eight independent technical reads on every closed bar, lets each one cast a +1 or -1 vote, and only fires a trade when at least five of those eight votes point the same way. The eight voters are: the 21/50 EMA cross (fast above slow = bullish vote), the slope of a 20-period Hull moving average, the 2/30/10 Adaptive Moving Average's position relative to the prior bar's close, a Heikin-Ashi close-above-open check, a 10-period/3.0x ATR SuperTrend band test on the bar's midpoint, RSI(14) above or below 50, MACD(12,26,9) main line vs signal, and an Adaptive Hull computed as 2×LWMA(N/2) − LWMA(N) with slope direction. Each voter can add a +1 or a −1 (long or short) vote. The magnitude of the vote sum is converted to a confidence score with confidence = min(100, |votes| × 12), so an 8-of-8 sweep scores 96, a 5-of-8 minimum scores 60, and a 4-of-8 disagreement scores 0 and the trade is blocked. The threshold is exposed to the user as InpMinConfluenceVotes (default 5) so traders can dial the bar up to 7 or 8 to filter for the highest-conviction bars only.
Before any signal vote is counted, the EA classifies the current market regime from the entry-timeframe indicators. DetectRegime() pulls the 14-period ADX, the 14-period ATR, and a 20-period/2.0σ Bollinger band; from those it builds a 100-bar ATR percentile (compressed if below 25, expanded if above 85) and a 100-bar BB-width percentile, then maps them to one of seven states: REG_STRONG_TREND (ADX≥25 + ATR expanded), REG_WEAK_TREND (ADX≥20 + ATR normal), REG_COMPRESS (ADX<18 + ATR compressed), REG_EXPAND (BB-width expanded + ADX<20), REG_BREAKOUT (BB-width expanded + ADX≥20), REG_RANGE (ADX<18 fallback), and REG_CHOPPY. The CHOPPY and NONE states are hard-blocked by RegimeAllowsEntry() — even an 8-of-8 vote will not override a CHOPPY regime call. This is a deliberate guard: the EA is built for trends and clean two-sided ranges, not the noise that follows a stop-run or news event.
Entry is gated by a second function, ConfirmEntry(), which is independent of ComputeSignal(). The confirm function checks four things in order: (1) higher-timeframe EMA agreement — if InpRequireHTFAgreement is true, the M30 EMA(21) must be above the M30 EMA(50) for a long, below for a short; (2) candle-close direction — if InpUseCandleConfirm is true, the prior bar's close must be above its open for a long, below for a short; (3) spread — the current ask-bid spread must be below 3.0×30 points, an unusually wide spread is rejected; (4) session — server hour must be between 7 and 20. The HTF check is what makes the EA's entries look 'patient' in backtests: a 7-vote confluence on the M1 candle is still skipped if the M30 trend is the wrong way. Traders who want the EA to fire more often can flip InpRequireHTFAgreement to false, but the default is true.
A third gate, NoTradeReason(), runs after the confirm passes. It is the consolidated safety stack: capital-cap floor check (blocks if effective capital is below the $50 floor), capital-cap ceiling check (treats equity as min(cap, equity) when InpCapitalCapAmount > 0), session guard, spread guard, cooldown-after-losses guard (set by InpCooldownAfterLoss consecutive losing closes from the day's deal history), daily realized P&L guard (3% of effective capital, computed live from the deal stream in RefreshTodayRealized()), weekly realized P&L guard (6%, computed by ComputeWeeklyRealized() which walks back to Monday's midnight), portfolio heat guard (InpMaxOpenTrades=5), and per-symbol guard (InpMaxSymbolTrades=3). If any of these return a non-empty reason string, the entry is blocked and the reason is printed to the log so the trader can audit why a bar was skipped.
Position sizing is risk-percent based, not fixed-lot. CalcLotByRisk() takes the effective capital, the stop distance in price, the symbol's tick value, and the symbol's tick size, and returns riskMoney / ((slDist / tickSize) × tickValue) — i.e. the number of lots that lose exactly InpRiskPercent of effective capital if the stop is hit. InpRiskPercent defaults to 0.5%, which is conservative for an M1 XAUUSD confluence EA. The lot is then clamped to the broker's min/max via NormVol(), which floors to the symbol's LotsStep and snaps to the broker's LotsMin/LotsMax. A MarginOK() pre-send check rejects entries that would consume more than 80% of free margin, preventing a margin call from a wide-spread or gap entry.
The SL is ATR-based, not point-based. TryEntry() reads the ATR(14) on the prior bar, multiplies by ATR_SL_MULT=2.0 to get the stop distance, and floors at StopsLevelPrice() + 1×point so it never sits inside the broker's minimum stop band. The TP is ATR_TP_MULT=3.0 × ATR(14) — that is a 1:1.5 risk-to-reward ratio by construction, and it is the most consequential single parameter in the EA's behavior. Traders who want a wider TP can edit ATR_TP_MULT directly in the source (it is a #define, not an input), or flip InpUseATRSL to false to fall back on a 100-point fixed stop on the entry timeframe. The latter is rarely useful on M1 XAUUSD; the ATR path is the intended one.
Once a position is open, ManageOpenPositions() runs on every tick and applies four layers of management. Layer 1: regime-change exit — if DetectRegime() returns CHOPPY or NONE, the position is closed with the reason 'regime change'. Layer 2: opposite-signal RSI exit — a long is closed if RSI(14) drops below 30, a short is closed if RSI(14) rises above 70. Layer 3: time-based exit at 500 bars on the entry timeframe (M1 = 8 hours 20 minutes, M5 = ~41 hours). Layer 4: one-shot break-even at 1.0R — when price moves one full initial-risk in the trade's favor, the SL is moved to entry + 5 points and never moves back. The break-even is genuinely one-shot: it triggers once per ticket and does not ratchet forward as price keeps moving.
After the BE has fired, partial-take-profit at 50% of the trade's TP distance kicks in if the remaining position volume is at least 2× the symbol's minimum lot. PARTIAL_TP_FRACTION=0.5 means half the position is closed at the halfway point to TP. After the partial, an ATR trailing stop takes over: the new SL is cur ± ATR(14) × 3.0 and is ratcheted forward only (a long's SL can move up, never down). The 3.0×ATR trail is deliberately wide — a 1.5× or 2.0× trail would be too tight for an M1 XAUUSD EA, which routinely sees 50–80 point M1 candles. The 3.0× trail gives trades room to breathe through pullbacks.
Pyramid / scaling is present in the code (TryPyramid()) but disabled by default (InpPyramidEnabled=false). When enabled, it adds one position per tick when (a) the regime is not CHOPPY, RANGE, or COMPRESS, (b) the symbol already has fewer than PYRAMID_MAX_LEVELS=3 positions, (c) the existing position is at least 1.5×ATR(14) in profit, and (d) margin is OK. The add-on lot is the existing position's volume (multiplier 1.0), so it is a true scale-in, not a martingale. A capital-cap opt-in (InpCapitalCapAmount=0 means off, any positive value caps effective capital at that dollar amount) lets a trader with a $10k account pretend their account is $2k for sizing purposes, which is useful for prop-firm accounts or for testing a small-account risk profile on a larger balance.
InpDryRun defaults to true — the EA will compute entries, exits, and management logic on every tick and print them to the log, but will not send any order. To go live, the trader must explicitly flip InpDryRun to false in the inputs. This is a deliberate safety default. The companion InpKillSwitch does the opposite: when flipped to true, it forces-close every open position for this magic number on the next tick and blocks any new entries. It is intended as a panic button — wire it to a chart button or external alert and you have a one-click 'get out'.
The OnTester formula is (netProfit × profitFactor) / (1 + balanceDrawdownDollars), with a hard floor of 30 trades (trades < 30 → 0). This is a stricter fitness function than most EAs in the family — the 30-trade minimum means single-bar scalps that happen to net-positive will be ranked below steady 100-trade runners, and the 1 + DD denominator (not 1 + DD%) means drawdown in absolute dollars is what hurts the score. Optimizer passes that net $1,000 with a $5,000 DD rank higher than passes that net $800 with a $200 DD. The implication for live use: the optimizer will favor robustness over peak profit, which is the right trade-off for an 8-vote confluence system on M1 XAUUSD.
Strategy Deep Dive
EX12002 is a vote-counting confluence engine. On every closed bar, ComputeSignal() walks eight independent reads and each one casts a +1 (long) or −1 (short) vote; the sum is converted to a confidence score via min(100, |votes| × 12) and a trade is only considered when |votes| >= InpMinConfluenceVotes (default 5). A separate DetectRegime() classifier maps ADX(14) + ATR(14) percentile + BB(20,2.0) width into seven states (STRONG_TREND, WEAK_TREND, COMPRESS, EXPAND, BREAKOUT, RANGE, CHOPPY) and hard-blocks the CHOPPY and NONE states. ConfirmEntry() then layers a higher-timeframe EMA(21)>EMA(50) agreement check on InpHTFTrendTF (default M30), a candle-close direction check, a 3.0×30-point spread cap, and a 7-20 server-time session gate. Position sizing is risk-percent (0.5% default) via CalcLotByRisk(), and ManageOpenPositions() runs on every tick to apply regime-change exit, RSI opposite-signal exit, 500-bar time exit, one-shot break-even at 1.0R + 5 points, 50% partial TP at half the TP distance, and an ATR(14)×3.0 forward-only trailing stop. InpDryRun defaults to true so the EA logs all decisions without sending orders.
Computes 8 independent votes on every closed bar (EMA 21/50 cross, Hull 20 slope, AMA 2/30/10 vs prior close, Heikin-Ashi close>open, 10×3.0 ATR SuperTrend band, RSI 14 vs 50, MACD 12/26/9 main vs signal, Adaptive Hull 20 slope) and fires only when at least InpMinConfluenceVotes (default 5) vote the same direction. A separate ConfirmEntry() then requires higher-timeframe EMA(21)>EMA(50) agreement on InpHTFTrendTF (default M30), the prior candle's close in the trade direction, spread below 3.0×30 points, and server hour within 7-20.
Four exit paths: regime change to CHOPPY or NONE, RSI opposite-signal (long closes if RSI<30, short if RSI>70), time stop at 500 bars on the entry timeframe, and one-shot break-even at 1.0R plus 5 points. After break-even fires, a 50% partial close triggers at half the TP distance if remaining volume is ≥ 2× broker min lot, and an ATR(14)×3.0 trailing stop ratchets the SL forward only.
ATR-based stop, set to ATR(14) × 2.0 on the prior bar, floored at StopsLevelPrice() + 1×point so it never sits inside the broker's minimum-stop band. A one-shot break-even at 1.0R + 5 points fires once per ticket, after which an ATR(14)×3.0 trailing stop ratchets the SL forward only.
Fixed-target TP at ATR(14) × 3.0 from entry, giving a 1:1.5 risk-to-reward ratio by construction. Half the position is closed at 50% of that distance (i.e. at 1.5×ATR) when remaining volume allows, locking in a partial 0.75R before the trailing stop takes over for the second half.
M1 XAUUSD traders who want a conservative multi-indicator confluence engine on the 1-minute chart with HTF M30 trend agreement as a default filter. Minimum recommended balance is $100 (the EA's InpCapitalCapFloor=$50 will block entries below that). The 0.5% default risk per trade suits a low-to-medium-risk account; raise to 1.0% via InpRiskPercent only on a balance ≥ $5,000. Run on an ECN/RAW-spread broker with low spread on XAUUSD — the spread filter rejects entries above 90 points. Best on a low-latency VPS; the EA reads 13 indicator handles and 100-bar ATR/BB percentiles on every new bar.
Strategy Logic
Pipsgrowth EX12002 MultiIndicatorConfluence — Strategy Logic Analysis (from .mq5 source)
Family: MultiIndicatorConfluence
Magic: 22212002
Version: 2.00
BRIEF:
Confluence of EMA + Hull + AMA + SuperTrend + HeikinAshi + RSI + MACD momentum — enhanced variant with explicit candle-close direction check, momentum-decay trailing, and one-shot break-even. 12 layers: REGIME, SIGNAL, ENTRY, CONFIRM, NO-TRADE, CAPITAL CAP, RISK, SIZING, MANAGE, EXIT, SCALING, OnTester. Consolidated from 2 identical variants (1033/1034)
INDICATOR STACK:
- Standard
MT5indicators
KEY FUNCTIONS:
NormPrice()NormVol()StopsLevelPrice()RefreshSym()RegimeAllowsEntry()ComputeSignal()ConfirmEntry()CountEAPositions()CountSymbolPositions()ComputeWeeklyRealized()RefreshTodayRealized()NoTradeReason()- ...and 11 more
INTERNAL CONSTANTS (21 total):
ATR_PERIOD= 14 //ATRperiod for vol regimeBB_PERIOD= 20 // Bollinger width periodBB_DEVIATION=2.0// Bollinger std-dev multiplierADX_PERIOD= 14 //ADXperiodHTF_ADX_PERIOD= 14 //HTFADXperiodHULL_PERIOD= 20 // Hull MA periodADAPT_HULL_PERIOD= 20 // Adaptive Hull periodATR_PCTILE_LOOKBACK= 100 // bars forATRpercentileATR_PCTILE_HI= 85 // Expand thresholdATR_PCTILE_LO= 25 // Compress thresholdBBWIDTH_LOOKBACK= 100 // bars forBBwidth percentileSESSION_START_HR= 7 // server-time session gate startSESSION_END_HR= 20 // server-time session gate endMAX_SPREAD_MULT=3.0// max spread vs rolling avgMAX_BARS_IN_TRADE= 500 // time-based exit bars- ...and 6 more
INPUT PARAMETERS (22 total across 7 groups):
- [=== Identity ===]
InpSymbol= "XAUUSD" // Traded symbol - [=== Identity ===]
InpTimeframe= 1 //Timeframe(1=M1,2=M5,3=M15,4=M30,5=H1,6=H4,7=D1) // Entry timeframe - [=== Identity ===]
InpTimeframe2= 4 //Timeframe(1=M1,2=M5,3=M15,4=M30,5=H1,6=H4,7=D1) //HTFconfirm timeframe - [=== Identity ===]
InpMagicNumber=22212002//Magic(unique perEA) - [=== Identity ===]
InpTradeComment= "Psgrowth.com Expert_12002" // Trade comment - [=== Risk & Sizing ===]
InpRiskPercent=0.5// Risk % of effective capital per trade - [=== Risk & Sizing ===]
InpDailyLossLimitPct=3.0// Daily loss limit % of effective capital - [=== Risk & Sizing ===]
InpWeeklyLossLimitPct=6.0// Weekly loss limit % of effective capital - [=== Risk & Sizing ===]
InpMaxOpenTrades= 5 // Max concurrent trades (portfolio heat) - [=== Risk & Sizing ===]
InpMaxSymbolTrades= 3 // Max concurrent trades on this symbol - [=== Risk & Sizing ===]
InpCooldownAfterLoss= 3 // Losses before cooldown (0 = off) - [=== Capital Allocation Cap ===]
InpCapitalCapAmount=0.0// Cap onREALMONEYequity ($) - [=== Capital Allocation Cap ===]
InpCapitalCapFloor=50.0// Floor below which entries are blocked ($) - [===
Signal(Multi-Indicator Confluence) ===]InpMinConfluenceVotes= 5 // Minimum confluence votes (of 8) to fire - [===
Signal(Multi-Indicator Confluence) ===]InpUseCandleConfirm=true// Require candle close in direction - [=== Regime / Confirm ===]
InpHTFTrendTF= 4 //Timeframe(1=M1,2=M5,3=M15,4=M30,5=H1,6=H4,7=D1) //HTFtrend agreement TF - [=== Regime / Confirm ===]
InpRequireHTFAgreement=true// RequireHTFEMA(EMA_FAST>EMA_SLOW) agreement - [=== Exit / Manage ===]
InpUseATRSL=true// UseATR-basedSL(else points) - [=== Exit / Manage ===]
InpUseTrailing=true// EnableATRtrailing stop - [=== Operational ===]
InpDryRun=true// Dry-run mode (no real sends) - [=== Operational ===]
InpKillSwitch=false// Kill switch — flatten & stop - [=== Operational ===]
InpPyramidEnabled=false// Pyramid after profit (defaultOFF)
// Pipsgrowth EX12002 MultiIndicatorConfluence — Execution Flow (from source analysis)
// Family: MultiIndicatorConfluence
// Confluence of EMA + Hull + AMA + SuperTrend + HeikinAshi + RSI + MACD momentum — enhanced variant with explicit candle-close direction check, momentum-decay trailing, and one-shot break-even. 12 layers: REGIME, SIGNAL, ENTRY, CONFIRM, NO-TRADE, CAPITAL CAP, RISK, SIZING, MANAGE, EXIT, SCALING, OnTester. Consolidated from 2 identical variants (1033/1034)
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 |
|---|---|---|
| InpSymbol | "XAUUSD" | Traded symbol |
| InpTimeframe | 1 | Timeframe (1=M1,2=M5,3=M15,4=M30,5=H1,6=H4,7=D1) // Entry timeframe |
| InpTimeframe2 | 4 | Timeframe (1=M1,2=M5,3=M15,4=M30,5=H1,6=H4,7=D1) // HTF confirm timeframe |
| InpMagicNumber | 22212002 | Magic (unique per EA) |
| InpTradeComment | "Psgrowth.com Expert_12002" | Trade comment |
| InpRiskPercent | 0.5 | Risk % of effective capital per trade |
| InpDailyLossLimitPct | 3.0 | Daily loss limit % of effective capital |
| InpWeeklyLossLimitPct | 6.0 | Weekly loss limit % of effective capital |
| InpMaxOpenTrades | 5 | Max concurrent trades (portfolio heat) |
| InpMaxSymbolTrades | 3 | Max concurrent trades on this symbol |
| InpCooldownAfterLoss | 3 | Losses before cooldown (0 = off) |
| InpCapitalCapAmount | 0.0 | Cap on REAL MONEY equity ($) |
| InpCapitalCapFloor | 50.0 | Floor below which entries are blocked ($) |
| InpMinConfluenceVotes | 5 | Minimum confluence votes (of 8) to fire |
| InpUseCandleConfirm | true | Require candle close in direction |
| InpHTFTrendTF | 4 | Timeframe (1=M1,2=M5,3=M15,4=M30,5=H1,6=H4,7=D1) // HTF trend agreement TF |
| InpRequireHTFAgreement | true | Require HTF EMA(EMA_FAST>EMA_SLOW) agreement |
| InpUseATRSL | true | Use ATR-based SL (else points) |
| InpUseTrailing | true | Enable ATR trailing stop |
| InpDryRun | true | Dry-run mode (no real sends) |
| InpKillSwitch | false | Kill switch — flatten & stop |
| InpPyramidEnabled | false | Pyramid after profit (default OFF) |
#property copyright "Pipsgrowth.com"
#property link "https://pipsgrowth.com"
#property version "2.00"
#property strict
#property description "Pipsgrowth.com EX12002 MultiIndicatorConfluence v2 — enhanced 8-indicator confluence, 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>
//=========================== TUNABLES -> #define ==================
#define ATR_PERIOD 14 // ATR period for vol regime
#define BB_PERIOD 20 // Bollinger width period
#define BB_DEVIATION 2.0 // Bollinger std-dev multiplier
#define ADX_PERIOD 14 // ADX period
#define HTF_ADX_PERIOD 14 // HTF ADX period
#define HULL_PERIOD 20 // Hull MA period
#define ADAPT_HULL_PERIOD 20 // Adaptive Hull period
#define AMA_FAST 2
#define AMA_SLOW 30
#define AMA_PERIOD 10
#define RSI_PERIOD 14
#define MACD_FAST 12
#define MACD_SLOW 26
#define MACD_SIGNAL 9
#define EMA_FAST 21
#define EMA_SLOW 50
#define ST_PERIOD 10
#define ST_MULT 3.0
#define ATR_PCTILE_LOOKBACK 100 // bars for ATR percentile
#define ATR_PCTILE_HI 85 // Expand threshold
#define ATR_PCTILE_LO 25 // Compress threshold
#define BBWIDTH_LOOKBACK 100 // bars for BB width percentile
#define SESSION_START_HR 7 // server-time session gate start
#define SESSION_END_HR 20 // server-time session gate end
#define MAX_SPREAD_MULT 3.0 // max spread vs rolling avg
#define SLIPPAGE_POINTS 20
#define MAX_BARS_IN_TRADE 500 // time-based exit bars
#define DAILY_COOLDOWN_BARS 60
#define MIN_RR_RATIO 1.2
#define PYRAMID_MAX_LEVELS 3
#define PYRAMID_ATR_MULT 1.5 // min spacing between pyramid adds
#define PARTIAL_TP_FRACTION 0.5
#define BE_TRIGGER_R_MULT 1.0
#define BE_OFFSET_POINTS 5
#define TRAIL_ATR_MULT 3.0
#define ATR_SL_MULT 2.0 // ATR SL multiplier
#define ATR_TP_MULT 3.0 // ATR TP multiplier
#define PYRAMID_MULT 1.0 // Pyramid lot multiplier
#define REQUIRE_VOL_EXPANDING false // Require ATR percentile >= ATR_PCTILE_LO
#define RSI_OB 70
#define RSI_OS 30
//=========================== INPUTS (18 total) ====================
ENUM_TIMEFRAMES MapTimeframeInt(int tf)
{
switch(tf)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.