Pipsgrowth EX12078 MultiIndicatorConfluence
MT5 Expert Advisor (Open Source) · XAUUSD · M5
Pipsgrowth.com EX12078 Confirmation_XAUUSD_5M — Multi-indicator confluence (MA, RSI, MACD, ADX), full 12-layer stack.
Overview
The Pipsgrowth EX12078 runs a four-channel confirmation gate on a single XAUUSD M5 chart before it ever fires an order. On every new bar the EA pulls four indicator buffers — a 21-period EMA, the 14-period RSI, the standard 12/26/9 MACD, and a 14-period ADX with its +DI and −DI lines — and tallies how many of them agree on direction. Only when the bull-confirmation counter or the bear-confirmation counter reaches InpMinConfirmations (default 3 of 4) does the EA request a market order. A signal that only fires 2/4 agreement is rejected; a signal that fires 4/4 is treated the same as 3/4. The gate is a strict threshold, not a confidence weight, so the system either enters or it does not.
The four channels each test a different market condition. The MA channel wants the close above the EMA with the EMA itself rising (above its prior bar value) for a long, or the mirror for a short — that is a trend-direction filter, not a cross signal. The RSI channel is asymmetric: a long requires RSI above InpRsiBull (55), a short requires RSI below InpRsiBear (45), so the EA does not enter on raw overbought or oversold extremes. The MACD channel wants the main line above the signal line and above zero for a long, the opposite for a short, which keeps entries on the side of a positive histogram regime. The ADX channel is a trend-strength gate: ADX must clear InpAdxMinLevel (20) and the directional line (+DI for long, −DI for short) must lead. If ADX is below the threshold, the trade is rejected regardless of how the other three voted.
After a signal clears, the EA sizes the position from account balance and stop distance. With InpRiskPercent set to 1.0% (the default), lot size is computed as risk_money / (sl_points × tick_value / tick_size), where risk_money is 1% of balance and sl_points is InpStopLoss in raw points. The result is floored to the symbol's lot step, then clamped to symbol min/max and the input InpMaxLotSize (10.0). If InpRiskPercent is set to 0, the EA falls back to InpFixedLot (0.01). On XAUUSD with a 500-point stop this produces a dynamic lot that scales with balance, not a fixed 0.01 on every entry.
The stop and target are fixed in raw points. InpStopLoss=500 and InpTakeProfit=750 produce a 1:1.5 risk-to-reward on every trade. The 500 points is 50 pips on a 5-digit gold quote (point = 0.01), and the 750-point target is 75 pips. Slippage tolerance is InpSlippage=30 points (3 pips) and the spread gate InpMaxSpread=200 points (20 pips) blocks entries during widened quotes — important on XAUUSD where spreads can balloon outside London hours. The trade comment "Psgrowth.com Expert_12078" is set as the order comment so positions are easy to identify in the terminal's trade tab and in the journal.
Pyramiding is opt-in but defaults on. With InpUsePyramid=true and InpMaxPyramidTrades=3, the EA may stack up to three positions in the same direction. The pyramid gate is a secured-profit check: an existing position's stop must have been moved at least InpPyramidMinProfit=100 points (10 pips on gold) into profit before the EA will add to it. If a buy position has its SL still at the original entry or below, the gate refuses. If a new entry is against an existing opposite-direction position, the EA also refuses (no hedging inside the pyramid). With InpUsePyramid off, the EA refuses to add when any position is already open.
The profit-lock trail is the second position-management layer. ManageProfitLock() runs every tick — not just on a new bar — and checks each open position's profit in points. Once a position is in profit by InpLockTrigger=300 points (30 pips), the EA moves its stop to (current price − InpLockDistance=100 points) for buys, or (current price + 100) for sells. The new stop must improve on the existing stop by at least InpLockStep=50 points (5 pips) or no modification is sent. After the initial lock, every additional 50-point gain ratchets the stop by another 50 points. The effect is a stepped trailing stop that activates only after a 30-pip move and tracks 10 pips behind price, never closing in a normal retracement.
The time filter is a server-time window. With InpUseTimeFilter=true and InpStartTime="08:00" / InpEndTime="20:00" the EA scans for entries only between 08:00 and 20:00 server time. Outside that window the EA still manages profit lock on open positions but does not open new ones. The default window aligns with London and most of the New York session for XAUUSD. InpCloseAtEnd defaults to false, so positions opened during the window remain open after 20:00 and the profit-lock trail keeps running through the close.
Execution uses the CTrade wrapper with ORDER_FILLING_FOK and 30-point slippage. Three retry helpers — TryClose_EX12078, TryClosePartial_EX12078, and TryModify_EX12078 — handle the broker-side REQUOTE, TIMEOUT, PRICE_OFF, and PRICE_CHANGED return codes with up to three attempts and 100-200 ms sleeps between attempts, which is enough to ride out most requote storms on retail ECN gold feeds. The OnInit function creates all four indicator handles and validates them, bailing with INIT_FAILED if any handle is invalid. OnDeinit releases every handle and clears the chart comment.
This is a single-symbol, single-timeframe, single-direction-at-a-time design with explicit safety gates. It is not a grid, not a martingale, and not a news or session classifier beyond the simple time window. The capital-protection logic is the pyramid-gate's secured-profit check plus the profit-lock trail; there is no daily-loss circuit breaker or portfolio drawdown cap, so position sizing discipline and broker-side risk controls are the user's responsibility.
Strategy Deep Dive
On every tick OnTick first calls RefreshRates and the 200-point spread gate; if the spread is too wide, the function returns without action. ManageProfitLock() then walks every position for the symbol and ratchets stops on any open trade that has cleared the 300-point lock trigger. If the time filter is enabled and the server clock is outside the 08:00–20:00 window, the function returns (or, if InpCloseAtEnd is on, calls CloseAllPositions first). On a new bar the EA pulls two MA values, one RSI value, MACD main and signal, ADX main, and +DI/−DI, then tallies bull-confirms and bear-confirms across the four channels; only when one of the two counters hits InpMinConfirmations does it call CheckPyramidSafety(signal) and, if that passes, request a market Buy or Sell with the computed lot, the fixed-point SL, and the fixed-point TP. The four indicator handles are released in OnDeinit; the chart comment is cleared at the same time.
A long fires when at least 3 of 4 channels agree: close above the 21-EMA with the EMA rising, 14-RSI above InpRsiBull (55), MACD main above signal and above zero, and ADX above InpAdxMinLevel (20) with +DI above −DI. A short is the mirror image. The MA channel is the trend-direction filter, the RSI channel the asymmetric momentum band, the MACD channel the positive-regime filter, and the ADX/DI channel the trend-strength gate. A 2-of-4 signal is rejected regardless of which two voted.
Positions are closed by the fixed 750-point TP target, the fixed 500-point SL, or the ratcheting profit-lock trail. ManageProfitLock() runs on every tick and, once profit exceeds InpLockTrigger=300 points, sets the stop to price±100 points and only advances when price moves another InpLockStep=50 points in profit. There is no indicator-based exit; the only exits are stop, target, and the ratchet.
InpStopLoss=500 raw points (50 pips on a 5-digit gold quote) is placed symmetrically on every entry and is only moved inward by the profit-lock trail — never widened. The EA does not apply a per-trade risk-percent cap beyond lot sizing, and there is no global drawdown circuit breaker.
InpTakeProfit=750 raw points (75 pips) gives a fixed 1:1.5 risk-to-reward on every trade. There is no partial close and no scaled exit; the target is hit once, then the position is closed by the CTrade wrapper with no second leg.
Run it on XAUUSD M5 with an ECN or RAW-spread account that holds typical gold spreads inside 20 points; a $100 minimum is workable but $300+ gives the 1% risk model room to size into the 50-pip stop without hitting the lot step floor. The 08:00–20:00 server-time window is designed for the London + New York overlap — if your broker's server clock is GMT+0 or GMT+2 you are already in that window. Latency under 30 ms helps the 30-point slippage tolerance hold during the first 15 minutes of each session.
Strategy Logic
Pipsgrowth EX12078 MultiIndicatorConfluence — Strategy Logic Analysis (from .mq5 source)
Family: MultiIndicatorConfluence
Magic: 22212078
Version: 2.00
BRIEF:
Multi-confirmation strategy using MA, RSI, MACD, and ADX indicators requiring minimum confirmations before entering trades. 12 layers: REGIME, SIGNAL, ENTRY, CONFIRM, NO-TRADE, CAPITAL CAP, RISK, SIZING, MANAGE, EXIT, SCALING, OnTester
INDICATOR STACK:
- Standard
MT5indicators
KEY FUNCTIONS:
CheckPyramidSafety()ManageProfitLock()GetLotSize()RefreshRates()IsTradingTime()StrToTime()CloseAllPositions()TryClose_EX12078()TryClosePartial_EX12078()TryModify_EX12078()
INTERNAL CONSTANTS (0 total):
INPUT PARAMETERS (31 total across 7 groups):
- [=== Confirmation Indicators ===]
InpMaPeriod= 21 // MA Period - [=== Confirmation Indicators ===]
InpMaMethod=MODE_EMA// MA Method - [=== Confirmation Indicators ===]
InpRsiPeriod= 14 //RSIPeriod - [=== Confirmation Indicators ===]
InpRsiBull= 55 //RSIBullish Level - [=== Confirmation Indicators ===]
InpRsiBear= 45 //RSIBearish Level - [=== Confirmation Indicators ===]
InpMacdFast= 12 //MACDFast - [=== Confirmation Indicators ===]
InpMacdSlow= 26 //MACDSlow - [=== Confirmation Indicators ===]
InpMacdSignal= 9 //MACDSignal - [=== Confirmation Indicators ===]
InpAdxPeriod= 14 //ADXPeriod - [=== Confirmation Indicators ===]
InpAdxMinLevel= 20 // MinADXfor Trend - [=== Confirmation Required ===]
InpMinConfirmations= 3 // Min ConfirmationsRequired(1-4) - [=== Money Management ===]
InpRiskPercent=1.0// Risk per trade (% of Balance) - [=== Money Management ===]
InpFixedLot=0.01// FixedLot(if Risk=0) - [=== Money Management ===]
InpMaxLotSize=10.0// Max Lot Size per trade - [=== Trade Management ===]
InpStopLoss= 500 // StopLoss(Points) - [=== Trade Management ===]
InpTakeProfit= 750 // TakeProfit(Points) - [=== Trade Management ===]
InpSlippage= 30 // MaxSlippage(Points) - [=== Trade Management ===]
InpMaxSpread= 200 // MaxSpread(Points) - [=== Trade Management ===]
InpMagicNumber=22212078// Magic Number - [=== Pyramid / Scaling ===]
InpUsePyramid=true// Enable Safe Pyramiding - [=== Pyramid / Scaling ===]
InpMaxPyramidTrades= 3 // Max Open Positions - [=== Pyramid / Scaling ===]
InpPyramidMinProfit= 100 // Min SecuredProfit(Points) for Next Add - [=== Profit Lock & Trail ===]
InpUseProfitLock=true// Enable Profit Lock / Trailing - [=== Profit Lock & Trail ===]
InpLockTrigger= 300 // TriggerDistance(Points in Profit) - [=== Profit Lock & Trail ===]
InpLockStep= 50 // Step to advanceSL(Points) - [=== Profit Lock & Trail ===]
InpLockDistance= 100 // Distance to keep SL fromPrice(Points) - [=== Time Management ===]
InpUseTimeFilter=true// Enable Time Filter - [=== Time Management ===]
InpStartTime= "08:00" // Start TradingTime(Server) - [=== Time Management ===]
InpEndTime= "20:00" // End TradingTime(Server) - [=== Time Management ===]
InpCloseAtEnd=false// Close all at end time - [=== Time Management ===]
InpTradeComment= "Psgrowth.com Expert_12078" // TradeComment
// Pipsgrowth EX12078 MultiIndicatorConfluence — Execution Flow (from source analysis)
// Family: MultiIndicatorConfluence
// Multi-confirmation strategy using MA, RSI, MACD, and ADX indicators requiring minimum confirmations before entering trades. 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 |
|---|---|---|
| InpMaPeriod | 21 | MA Period |
| InpMaMethod | MODE_EMA | MA Method |
| InpRsiPeriod | 14 | RSI Period |
| InpRsiBull | 55 | RSI Bullish Level |
| InpRsiBear | 45 | RSI Bearish Level |
| InpMacdFast | 12 | MACD Fast |
| InpMacdSlow | 26 | MACD Slow |
| InpMacdSignal | 9 | MACD Signal |
| InpAdxPeriod | 14 | ADX Period |
| InpAdxMinLevel | 20 | Min ADX for Trend |
| InpMinConfirmations | 3 | Min Confirmations Required (1-4) |
| InpRiskPercent | 1.0 | Risk per trade (% of Balance) |
| InpFixedLot | 0.01 | Fixed Lot (if Risk=0) |
| InpMaxLotSize | 10.0 | Max Lot Size per trade |
| InpStopLoss | 500 | Stop Loss (Points) |
| InpTakeProfit | 750 | Take Profit (Points) |
| InpSlippage | 30 | Max Slippage (Points) |
| InpMaxSpread | 200 | Max Spread (Points) |
| InpMagicNumber | 22212078 | Magic Number |
| InpUsePyramid | true | Enable Safe Pyramiding |
| InpMaxPyramidTrades | 3 | Max Open Positions |
| InpPyramidMinProfit | 100 | Min Secured Profit (Points) for Next Add |
| InpUseProfitLock | true | Enable Profit Lock / Trailing |
| InpLockTrigger | 300 | Trigger Distance (Points in Profit) |
| InpLockStep | 50 | Step to advance SL (Points) |
| InpLockDistance | 100 | Distance to keep SL from Price (Points) |
| InpUseTimeFilter | true | Enable Time Filter |
| InpStartTime | "08:00" | Start Trading Time (Server) |
| InpEndTime | "20:00" | End Trading Time (Server) |
| InpCloseAtEnd | false | Close all at end time |
| InpTradeComment | "Psgrowth.com Expert_12078" | Trade Comment |
#property copyright "Pipsgrowth.com"
#property link "https://pipsgrowth.com"
#property version "2.00"
#property strict
#property description "Pipsgrowth.com EX12078 Confirmation_XAUUSD_5M — Multi-indicator confluence (MA, RSI, MACD, ADX), 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 "=== Confirmation Indicators ==="
input int InpMaPeriod = 21; // MA Period
input ENUM_MA_METHOD InpMaMethod = MODE_EMA; // MA Method
input int InpRsiPeriod = 14; // RSI Period
input int InpRsiBull = 55; // RSI Bullish Level
input int InpRsiBear = 45; // RSI Bearish Level
input int InpMacdFast = 12; // MACD Fast
input int InpMacdSlow = 26; // MACD Slow
input int InpMacdSignal = 9; // MACD Signal
input int InpAdxPeriod = 14; // ADX Period
input int InpAdxMinLevel = 20; // Min ADX for Trend
input group "=== Confirmation Required ==="
input int InpMinConfirmations = 3; // Min Confirmations Required (1-4)
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 group "=== Trade Management ==="
input int InpStopLoss = 500; // Stop Loss (Points)
input int InpTakeProfit = 750; // Take Profit (Points)
input int InpSlippage = 30; // Max Slippage (Points)
input int InpMaxSpread = 200; // Max Spread (Points)
input ulong InpMagicNumber = 22212078; // Magic Number
input group "=== Pyramid / Scaling ==="
input bool InpUsePyramid = true; // Enable Safe Pyramiding
input int InpMaxPyramidTrades = 3; // Max Open Positions
input int InpPyramidMinProfit = 100; // Min Secured Profit (Points) for Next Add
input group "=== Profit Lock & Trail ==="
input bool InpUseProfitLock = true; // Enable Profit Lock / Trailing
input int InpLockTrigger = 300; // Trigger Distance (Points in Profit)
input int InpLockStep = 50; // Step to advance SL (Points)
input int InpLockDistance = 100; // Distance to keep SL from Price (Points)
input group "=== Time Management ==="
input bool InpUseTimeFilter = true; // Enable Time Filter
input string InpStartTime = "08:00"; // Start Trading Time (Server)
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.