P
PipsGrowth
OtherOpen Source – Free

Pipsgrowth EX12016 MultiIndicatorConfluence

MT5 Expert Advisor (Open Source) · XAUUSD · M5

Pipsgrowth.com EX12016 MultiInd_XAUUSD_5M — weighted Hull/SuperTrend/HA/RSI/MACD confluence, full 12-layer stack.

Overview

Five filters vote on every new M5 bar of XAUUSD, each with its own weight. The default scoring assigns Hull MA 10, SuperTrend 9, Heiken Ashi 8, RSI 6 and MACD 5, and the entry requires a combined confidence of 70% or higher on one direction. EX12016 is the weighted-vote member of the EX12 MultiIndicatorConfluence family — distinct from the 10-vote democracy of EX12005 (five adaptive MAs plus five oscillators on USDJPY M15) and from the ADX-bonus 5-vote of EX12007 (USDJPY M5/M30). This one reads five classical trend and momentum tools against the user's own weight table and only fires when those weights add up to 70% in one direction.

The Hull MA filter uses the standard Allan Hull construction: a 21-period WMA, a 10-period WMA, and the formula 2*WMA(period/2) − WMA(period). The function GetHullDirection(1, 21, 2) walks the last two completed bars and returns +1 only if Hull is rising on both, −1 if falling on both, and 0 otherwise. The InpHullRequired input is clamped to 1–3, so the EA can be tuned to demand a single rising bar (loosest), two consecutive (default), or three (strictest). The 21-period default is mid-range: short enough to keep up with XAUUSD's 5-minute rhythm, long enough to filter single-bar wicks.

The SuperTrend filter is the conventional two-close test, not the full SuperTrend indicator with its recursive state. CalculateSuperTrend(1, 22, 3.0) reads the most recent completed bar's ATR(22), computes the HL2 ± 3.0×ATR band, then asks: is the close above the lower band AND was the previous close also above the lower band? Two consecutive closes above the lower band vote bullish. The 3.0× multiplier is conservative for gold — most published SuperTrend presets use 2.0 or 2.5 — and 22-bar ATR covers roughly 1.8 hours of M5 data, smoothing out the session-open spikes that punctuate London and New York.

The Heiken Ashi filter does not read a built-in HA buffer; the EA reconstructs the bars itself. GetHADirection(2) walks the last two completed M5 bars, computes each bar's HA close as (O+H+L+C)/4 and the prior bar's HA open as (prev_open + prev_close)/2, and increments a bull or bear counter. Both bars must be the same color to vote. This is a slow, deliberate trend confirmation — the kind of filter that helps in trending London and New York gold sessions but cuts the EA's trade count during the Asian consolidation that often precedes the London open.

The RSI filter is a simple, non-crossing band check. It votes bullish when the 14-period RSI is above 50 but below the overbought level (default 70); bearish when RSI is below 50 but above the oversold level (default 30). The 50-line acts as a regime gate, and the OB/OS guards prevent voting into exhaustion. At weight 6, RSI is the second-lightest vote — the EA treats momentum as confirmation, not the primary signal.

The MACD filter is similarly reduced: it votes bullish only when the MACD main line is above its 9-period signal line AND the main line is also above zero. Symmetric for shorts. This means the EA does not fire long entries from negative-histogram crossovers, which is a deliberate choice — it requires both momentum (line > signal) and trend (line > 0) to agree. MACD's weight of 5 is the lightest, treating it as a tiebreaker rather than a driver.

The score is the sum of winning-side weights divided by the sum of all enabled weights, expressed as a percentage. A long signal needs at least 70% in the bull direction AND must beat the bear side; a short signal needs at least 70% in the bear direction. The default weight table (10 + 9 + 8 + 6 + 5 = 38 total) means a 70% threshold corresponds to 26.6 weight points, which is roughly Hull + SuperTrend + HA (27) without needing RSI or MACD, OR Hull + SuperTrend + RSI (25) without HA. The user can rebuild the voting system by toggling filters and reweighting — Hull, SuperTrend, and HA can each be turned off independently, as can RSI and MACD. The reweighting matters: dropping Hull to 5 and pushing SuperTrend to 12 makes the EA a SuperTrend-dominant system, not a Hull-dominant one.

Risk defaults to 1% of balance per trade with InpStopLoss = 500 points. The GetLotSize() function converts that risk percentage into a position size using tick value and tick size, snaps to the symbol's lot step, and caps the result at InpMaxLotSize = 10. The take-profit is fixed at 750 points — a 1:1.5 risk:reward ratio. The R:R is moderate rather than aggressive, and it matches the 70% confidence gate: with conviction around 70%, a 1.5R TP is the kind of math that survives realistic gold spreads and slippage without compressing the win rate into a coin-flip.

Pyramiding is on by default. CheckPyramidSafety(1) allows up to InpMaxPyramidTrades = 3 open positions on this magic, blocks adds if the existing position has secured less than 100 points in profit (calculated from the current SL, not from peak high water mark), and refuses opposite-direction adds. So a long can be added up to two more times, but only if the existing long's stop is already at least 100 points below its entry. That is the EA's interpretation of safe pyramiding — only add to a position that has already locked risk off the table, not to a position that is currently under water.

The trailing layer is ManageProfitLock(), a stepped ratchet that activates when a position is 300 points in profit. It then advances the stop-loss by 50 points at a time, always keeping 100 points of distance from the current price. This is a coarser, more conservative version of the typical ATR-based trail — it operates on fixed points, does not tighten as price moves (the 100-point distance is constant), and only fires when the position is already deep in profit. The user can disable the entire profit-lock layer by setting InpUseProfitLock = false, in which case the original SL stays in place until the TP hits or a manual close.

Time discipline is a server-time window, defaulting to 08:00–20:00, which covers the full London session and the first half of the New York session. Outside that window the EA simply does not open new trades; the existing positions are still managed by ManageProfitLock() and the spread/slippage guards. An optional InpCloseAtEnd = true will force-close all positions at the end-time, but the default leaves them alone — positions opened near 20:00 server can run into the next session if the user does not opt in to the close-at-end behavior.

The execution layer is a thin FOK wrapper. m_trade.SetTypeFilling(ORDER_FILLING_FOK) is set at init, and TryClose_EX12016() retries three times on REQUOTE, TIMEOUT, PRICE_OFF, or PRICE_CHANGED with a 200ms sleep between attempts. The modify path (TryModify_EX12016) retries three times on REQUOTE or TIMEOUT only, with a 100ms sleep — it does not retry on PRICE_CHANGED, because a moved price during a modify can leave the stop at the wrong level and the EA would rather reject the modify than misplace a stop.

The spread guard is hardcoded at 200 points (InpMaxSpread) — loose for XAUUSD by modern standards, so a low-spread broker matters. Slippage is set to 30 points (InpSlippage). The magic number is 22212016 and the trade comment is "Psgrowth.com Expert_12016" so the trades are easy to filter in post-trade analysis.

What you should expect in a backtest: a moderate trade count (the 70% confidence threshold cuts signals roughly in half compared to a single-indicator EA), most trades during London and New York overlap, and a healthy mix of wins and small losses with a 1.5R cap on winners. Because the EA is fixed-point (500pt SL, 750pt TP, 300pt trail trigger, 50pt trail step), the actual dollar risk scales with whatever the broker quotes — verify on your own symbol that "points" means what you think it means (typically 1 point = 1/10 pip on a 5-digit XAUUSD quote, so 500 points = 50 pips = $5.00 per 0.01 lot at gold's tick value). Run on a low-spread ECN broker with the server time zone set explicitly so the 08:00–20:00 window lines up with the sessions you actually want to trade.

Strategy Deep Dive

EX12016 reads five independent trend/momentum tools and lets them vote on direction. Each filter contributes a configured weight (Hull 10, SuperTrend 9, HA 8, RSI 6, MACD 5 by default), and the long/short total is normalised to a 0–100% confidence score. A new M5 bar's first tick triggers the full re-evaluation; subsequent ticks within the same bar are ignored. The 70% confidence gate (InpMinConfidence) and the higher-of-two rule make the entry path one-sided: only the dominant direction can fire. Each tick also re-evaluates the open-position ratchet (ManageProfitLock()), so the trail and the entry logic run on the same schedule. The result is a slower, more deliberate EA than the 10-vote EX12005 or the ADX-bonus EX12007 — fewer trades, higher selectivity.

Entry Signal

On every new M5 bar of XAUUSD, EX12016 walks five filters — Hull MA(21), SuperTrend(22, 3.0×ATR), Heiken Ashi(2-bar), RSI(14) and MACD(12,26,9) — and assigns each a weighted score (defaults: 10/9/8/6/5 = 38 total). A long fires only when the bullish side sums to ≥ 70% of enabled weight AND exceeds the bearish side; shorts are mirrored. The 70% gate (26.6 weight points on defaults) corresponds roughly to the heaviest three filters agreeing without needing RSI or MACD.

Exit Signal

The base exit is the fixed 750-point take-profit (1.5R), with no partial close and no break-even. The stepped ratchet (ManageProfitLock()) activates once a position is 300 points in profit and ratchets the stop forward by 50 points at a time, always leaving 100 points of distance. The time filter does not auto-close by default (InpCloseAtEnd = false), so positions opened near 20:00 server can run into the next session unless the user opts in. A reverse signal does not auto-close the existing position — EX12016 evaluates the new signal only for fresh entries, not for closing open trades.

Stop Loss

The initial stop is fixed at 500 points (InpStopLoss = 500), placed at entry by the EA. It is ratcheted forward by ManageProfitLock() only after the trade reaches 300 points of profit, never moved backwards, and not adjusted during the loss phase. The pyramid layer counts "secured profit" from the current SL to the entry price; positions with less than 100 points of locked profit cannot be added to.

Take Profit

Take-profit is fixed at 750 points from entry (1.5R against the 500-point stop). There is no split-TP, no partial close, and no trailing TP — once price reaches the TP line, the entire position is closed by the broker. The 1.5R ceiling pairs with the 70% confidence gate: a moderate win rate with a 1.5R reward is the design assumption.

Best For

Recommended balance: $100 minimum (1% risk with 500-pt SL on a typical XAUUSD lot sizing gives meaningful trade size). Best broker profile: low-spread XAUUSD ECN or RAW, with the 200-point (20-pip) spread cap built into the EA — the cap is loose by modern gold standards, so a wide-spread broker will reject most of your entries. Best session: 08:00–20:00 server, which covers London and the first half of New York where gold tends to trend. Risk level: MEDIUM — the 1.5R TP and 70% confidence gate keep individual trade loss small, but the 3-position pyramid can stack exposure on a single direction.

Strategy Logic

Pipsgrowth EX12016 MultiIndicatorConfluence — Strategy Logic Analysis (from .mq5 source)

Family: MultiIndicatorConfluence Magic: 22212016 Version: 2.00

BRIEF: Multi-indicator weighted confluence EA combining Hull MA, SuperTrend, Heiken Ashi, RSI and MACD filters. Each filter contributes a weighted score; a minimum confidence threshold must be met to trigger entries. Risk-based sizing, safe pyramiding, profit-lock trailing, time filter and spread filter. 12 layers: REGIME, SIGNAL, ENTRY, CONFIRM, NO-TRADE, CAPITAL CAP, RISK, SIZING, MANAGE, EXIT, SCALING, OnTester

INDICATOR STACK:

  • Standard MT5 indicators

KEY FUNCTIONS:

  • GetHullDirection()
  • CalculateHull()
  • CalculateWMA()
  • CalculateSuperTrend()
  • GetHADirection()
  • CheckPyramidSafety()
  • ManageProfitLock()
  • GetLotSize()
  • RefreshRates()
  • IsTradingTime()
  • StrToTime()
  • CloseAllPositions()
  • ...and 3 more

INTERNAL CONSTANTS (0 total):

INPUT PARAMETERS (42 total across 11 groups):

  • [=== Hull Filter ===] InpUseHull = true // Use Hull Filter
  • [=== Hull Filter ===] InpHullPeriod = 21 // Hull Period
  • [=== Hull Filter ===] InpHullRequired = 2 // Required Consecutive Bars (1-3)
  • [=== SuperTrend Filter ===] InpUseSuperTrend = true // Use SuperTrend Filter
  • [=== SuperTrend Filter ===] InpStAtrPeriod = 22 // SuperTrend ATR Period
  • [=== SuperTrend Filter ===] InpStMultiplier = 3.0 // SuperTrend Multiplier
  • [=== Heiken Ashi Filter ===] InpUseHeikenAshi = true // Use Heiken Ashi Filter
  • [=== Heiken Ashi Filter ===] InpHaConsecutive = 2 // Consecutive HA Bars Required
  • [=== RSI Filter ===] InpUseRsi = true // Use RSI Filter
  • [=== RSI Filter ===] InpRsiPeriod = 14 // RSI Period
  • [=== RSI Filter ===] InpRsiOB = 70 // Overbought
  • [=== RSI Filter ===] InpRsiOS = 30 // Oversold
  • [=== MACD Filter ===] InpUseMacd = true // Use MACD Filter
  • [=== MACD Filter ===] InpMacdFast = 12 // Fast
  • [=== MACD Filter ===] InpMacdSlow = 26 // Slow
  • [=== MACD Filter ===] InpMacdSignal = 9 // Signal
  • [=== Weighted Scoring ===] InpMinConfidence = 70.0 // Min Confidence Score (%)
  • [=== Weighted Scoring ===] InpHullWeight = 10.0 // Hull Weight
  • [=== Weighted Scoring ===] InpStWeight = 9.0 // SuperTrend Weight
  • [=== Weighted Scoring ===] InpHaWeight = 8.0 // Heiken Ashi Weight
  • [=== Weighted Scoring ===] InpRsiWeight = 6.0 // RSI Weight
  • [=== Weighted Scoring ===] InpMacdWeight = 5.0 // MACD Weight
  • [=== Money Management ===] InpRiskPercent = 1.0 // Risk per trade (% of Balance)
  • [=== Money Management ===] InpFixedLot = 0.01 // Fixed Lot (if Risk=0)
  • [=== Money Management ===] InpMaxLotSize = 10.0 // Max Lot Size per trade
  • [=== Money Management ===] InpStopLoss = 500 // Stop Loss (Points)
  • [=== Money Management ===] InpTakeProfit = 750 // Take Profit (Points)
  • [=== Trade Management ===] InpSlippage = 30 // Max Slippage (Points)
  • [=== Trade Management ===] InpMaxSpread = 200 // Max Spread (Points)
  • [=== Trade Management ===] InpMagicNumber = 22212016 // Magic Number
  • [=== Trade Management ===] InpTradeComment = "Psgrowth.com Expert_12016" // Trade Comment
  • [=== Pyramid / Scaling ===] InpUsePyramid = true // Enable Safe Pyramiding
  • [=== Pyramid / Scaling ===] InpMaxPyramidTrades = 3 // Max Open Positions
  • [=== Pyramid / Scaling ===] InpPyramidMinProfit = 100 // Min Secured Profit (Points) for Next Add
  • [=== Profit Lock & Trail ===] InpUseProfitLock = true // Enable Profit Lock / Trailing
  • [=== Profit Lock & Trail ===] InpLockTrigger = 300 // Trigger Distance (Points in Profit)
  • [=== Profit Lock & Trail ===] InpLockStep = 50 // Step to advance SL (Points)
  • [=== Profit Lock & Trail ===] InpLockDistance = 100 // Distance to keep SL from Price (Points)
  • [=== Time Management ===] InpUseTimeFilter = true // Enable Time Filter
  • [=== Time Management ===] InpStartTime = "08:00" // Start Trading Time (Server)
  • [=== Time Management ===] InpEndTime = "20:00" // End Trading Time (Server)
  • [=== Time Management ===] InpCloseAtEnd = false // Close all at end time
Pseudocode
// Pipsgrowth EX12016 MultiIndicatorConfluence — Execution Flow (from source analysis)
// Family: MultiIndicatorConfluence
// Multi-indicator weighted confluence EA combining Hull MA, SuperTrend, Heiken Ashi, RSI and MACD filters. Each filter contributes a weighted score; a minimum confidence threshold must be met to trigger entries. Risk-based sizing, safe pyramiding, profit-lock trailing, time filter and spread filter. 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

Optimized Brokers:
ExnessIC Markets
Optimized Symbols:
XAUUSD
Optimized Timeframes:
M5

How to Install This EA on MT5

  1. 1Download the .mq5 file using the button above
  2. 2Open MetaTrader 5 on your computer
  3. 3Click File → Open Data Folder in the top menu
  4. 4Navigate to MQL5 → Experts and paste the .mq5 file there
  5. 5In MT5, right-click Expert Advisors in the Navigator panel → Refresh
  6. 6Drag the EA onto a chart matching the recommended timeframe
  7. 7Configure parameters according to the table on this page
  8. 8Enable Allow Algo Trading and click OK

EA Parameters

ParameterDefaultDescription
InpUseHulltrueUse Hull Filter
InpHullPeriod21Hull Period
InpHullRequired2Required Consecutive Bars (1-3)
InpUseSuperTrendtrueUse SuperTrend Filter
InpStAtrPeriod22SuperTrend ATR Period
InpStMultiplier3.0SuperTrend Multiplier
InpUseHeikenAshitrueUse Heiken Ashi Filter
InpHaConsecutive2Consecutive HA Bars Required
InpUseRsitrueUse RSI Filter
InpRsiPeriod14RSI Period
InpRsiOB70Overbought
InpRsiOS30Oversold
InpUseMacdtrueUse MACD Filter
InpMacdFast12Fast
InpMacdSlow26Slow
InpMacdSignal9Signal
InpMinConfidence70.0Min Confidence Score (%)
InpHullWeight10.0Hull Weight
InpStWeight9.0SuperTrend Weight
InpHaWeight8.0Heiken Ashi Weight
InpRsiWeight6.0RSI Weight
InpMacdWeight5.0MACD Weight
InpRiskPercent1.0Risk per trade (% of Balance)
InpFixedLot0.01Fixed Lot (if Risk=0)
InpMaxLotSize10.0Max Lot Size per trade
InpStopLoss500Stop Loss (Points)
InpTakeProfit750Take Profit (Points)
InpSlippage30Max Slippage (Points)
InpMaxSpread200Max Spread (Points)
InpMagicNumber22212016Magic Number
InpTradeComment"Psgrowth.com Expert_12016"Trade Comment
InpUsePyramidtrueEnable Safe Pyramiding
InpMaxPyramidTrades3Max Open Positions
InpPyramidMinProfit100Min Secured Profit (Points) for Next Add
InpUseProfitLocktrueEnable Profit Lock / Trailing
InpLockTrigger300Trigger Distance (Points in Profit)
InpLockStep50Step to advance SL (Points)
InpLockDistance100Distance to keep SL from Price (Points)
InpUseTimeFiltertrueEnable Time Filter
InpStartTime"08:00"Start Trading Time (Server)
InpEndTime"20:00"End Trading Time (Server)
InpCloseAtEndfalseClose all at end time
Source Code (.mq5)Open Source
Pipsgrowth_com_EX12016.mq5
#property copyright "Pipsgrowth.com"
#property link      "https://pipsgrowth.com"
#property version   "2.00"
#property strict
#property description "Pipsgrowth.com EX12016 MultiInd_XAUUSD_5M — weighted Hull/SuperTrend/HA/RSI/MACD confluence, full 12-layer stack."

#include <Trade\Trade.mqh>
#include <Trade\SymbolInfo.mqh>
#include <Trade\PositionInfo.mqh>
#include <Trade\AccountInfo.mqh>

// --- Global Objects ---
CTrade         m_trade;
CSymbolInfo    m_symbol;
CPositionInfo  m_position;
CAccountInfo   m_account;

// --- Inputs ---

input group "=== Hull Filter ==="
input bool     InpUseHull           = true;        // Use Hull Filter
input int      InpHullPeriod        = 21;          // Hull Period
input int      InpHullRequired      = 2;           // Required Consecutive Bars (1-3)

input group "=== SuperTrend Filter ==="
input bool     InpUseSuperTrend     = true;        // Use SuperTrend Filter
input int      InpStAtrPeriod       = 22;          // SuperTrend ATR Period
input double   InpStMultiplier      = 3.0;         // SuperTrend Multiplier

input group "=== Heiken Ashi Filter ==="
input bool     InpUseHeikenAshi     = true;        // Use Heiken Ashi Filter
input int      InpHaConsecutive     = 2;           // Consecutive HA Bars Required

input group "=== RSI Filter ==="
input bool     InpUseRsi            = true;        // Use RSI Filter
input int      InpRsiPeriod         = 14;          // RSI Period
input int      InpRsiOB             = 70;          // Overbought
input int      InpRsiOS             = 30;          // Oversold

input group "=== MACD Filter ==="
input bool     InpUseMacd           = true;        // Use MACD Filter
input int      InpMacdFast          = 12;          // Fast
input int      InpMacdSlow          = 26;          // Slow
input int      InpMacdSignal        = 9;           // Signal

input group "=== Weighted Scoring ==="
input double   InpMinConfidence     = 70.0;        // Min Confidence Score (%)
input double   InpHullWeight        = 10.0;        // Hull Weight
input double   InpStWeight          = 9.0;         // SuperTrend Weight
input double   InpHaWeight          = 8.0;         // Heiken Ashi Weight
input double   InpRsiWeight         = 6.0;         // RSI Weight
input double   InpMacdWeight        = 5.0;         // MACD Weight

input group "=== Money Management ==="
input double   InpRiskPercent       = 1.0;         // Risk per trade (% of Balance)
input double   InpFixedLot          = 0.01;        // Fixed Lot (if Risk=0)
input double   InpMaxLotSize        = 10.0;        // Max Lot Size per trade
input int      InpStopLoss          = 500;         // Stop Loss (Points)
input int      InpTakeProfit        = 750;         // Take Profit (Points)

Full source code available on download

Educational purposes only. Do NOT use with real money. Test on demo accounts only.

Tags:ex12016multiindicatorconfluencepipsgrowthfreemt5xauusd

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

Community

Sign in to contributeSign In

Educational purposes only. Do NOT use with real money. Test on demo accounts only.

File NamePipsgrowth_com_EX12016.mq5
File Size19.9 KB
Versionv2.00
PlatformMetaTrader 5
File Type.mq5 Source
StrategyOther
Risk LevelMedium Risk
Timeframes
M5
Currency Pairs
XAUUSD
Min. Deposit$100