P
PipsGrowth
OtherOpen Source – Free

Pipsgrowth EX12025 MultiIndicatorConfluence

MT5 Expert Advisor (Open Source) · XAUUSD · M5

Pipsgrowth.com EX12025 EA_5_13_2025 — Adaptive volatility Gaussian bands breakout EA, full 12-layer stack.

Overview

Pipsgrowth EX12025 MultiIndicatorConfluence is built around a single thesis: a breakout only matters if price has spent the last two bars the wrong side of the band. The EA constructs a Gaussian-style envelope around an EMA(10) of the working timeframe, then requires a hard pierce through that envelope on the third bar — with an H4 trend gate, a candle-shape filter, and a 10% intraday drawdown cap standing in the way of any entry that gets through.

The band, in plain numbers

The mid-line of the channel is iMA(_Symbol, g_Timeframe, Length=10, 0, MODE_EMA, PRICE_CLOSE) — a single exponential moving average. The upper edge sits at gaussNow + DistanceMultiplier * ATR(14); the lower edge is the mirror. With the shipped defaults on XAUUSD M5, the band is roughly EMA(10) + 0.85 * ATR(14) from price, which is wide enough that only sustained pushes reach the edge. Length controls how closely the mid-line tracks price (smaller = chattier, larger = smoother), while DistanceMultiplier directly governs the channel width in ATR units. Two pips of gold spread will not push the band; ten will not push it either — the band moves on ATR, not on quote noise.

How a long setup actually forms

The signal is gated by strongCandle = (body >= 0.6 * candleSize). The first thing the EA does on every tick is compute the bar's body as MathAbs(close - open) and compare it to the bar's high-low range; if the body is less than 60% of the range, the EA does not even read the indicators. This is a doji filter, but stated as a body-to-range ratio rather than a doji threshold.

Once the candle passes, the EA reads gaussNow and gaussPrev from the EMA(10) handle. A long entry is allowed only when all of these are true on the same tick: the current close is above gaussNow + 0.85 * ATR; the close of the bar before that was below the same upper band; the close of two bars ago was also below it; the current close is above the H4 EMA(50); the slope gaussNow > gaussPrev is positive; and the gap (price - gaussNow) is wider than MinBreakDistance * ATR (0.3 ATR by default). The previous-two-bars-inside rule is the actual anti-fakeout mechanic — a single-bar poke does not count.

The trend gate that does most of the work

The H4 EMA(50) filter is enabled by default with TrendFilterTF=6, which MapTimeframeInt() translates to PERIOD_H4. The EA only reads the value at bar 0 of that timeframe. On XAUUSD, a 50-period EMA on H4 is roughly a 2-3 day average — slow enough that it does not flip on intraday noise, fast enough that it shifts the regime gate within a session. The trend gate is the single largest filter: a clean band break against the H4 trend is ignored, which is what stops the EA from shorting every London-afternoon gold pop into a daily uptrend.

Optional second- and third-opinion filters

Two further filters are wired but disabled by default. UseAlligatorFilter brings in the standard MT5 Alligator (iAlligator) on the SMMA method with the canonical 13/8/5 periods and 8/5/3 shifts. When on, the EA requires jaws > teeth > lips for a long and the reverse for a short. UseDonchianFilter brings in a 20-period high/low channel with a 5-pip buffer (DonchianOffsetPips) and a 2-bar confirm window (DonchianConfirmBars). The Donchian is a stricter structural breakout filter than the Gaussian band — it says "you also need to be outside the 20-bar range with a 5-pip cushion for two bars in a row," which is more demanding than the EMA-channel test. The two optional filters are designed to be turned on together for higher-conviction signals and left off for higher trade frequency.

Auto-tuned volatility floor

AutoTuneFilters() is the regime guard at the top of OnTick. It reads SYMBOL_ASK - SYMBOL_BID and decides whether the symbol behaves like an FX pair (spread < 3 pips → pipFactor = 0.0001) or like gold/indices (spread ≥ 3 pips → pipFactor = 0.01). The minimum ATR the EA will accept is pipFactor * 3.0, so a 3-pip EURUSD sees a 0.0003 floor while a 30-pip XAUUSD sees a 0.03 floor. MinATR=0.03 is the manual override, and it is set such that XAUUSD matches the auto-tune exactly. If atr < minATR at any tick, the EA returns without placing a new trade — this kills the system during the quietest Asian-session hours and the first minutes after a holiday reopen, when the band itself is still warming up.

Order construction and stop placement

The order goes in as trade.Buy(Lots, _Symbol, ask, slBuy, tpBuy, InpTradeComment) with Lots=0.1 as the default. The stop is ask - ATR_MultiplierSL * atr = ask - 1.2 * ATR(14), and the take-profit is ask + FixedTP_Points * _Point = ask + 160 points. HardSL_Points=120 is held as a wide cap on the SL distance in points; in practice the ATR-based stop is narrower than 120 points on XAUUSD M5, so the cap is rarely the binding constraint. CloseOpposite() runs before the new order — if a position in the opposite direction is open, the EA attempts to close it via TryClose_EX12025 before opening the new one.

The dynamic lock-profit ladder

This is the EA's signature management feature. With EnableDynamicLockProfit=true (default), the EA reads POSITION_PROFIT on every tick. For every LockProfitEvery_X_Dollars=2.0 of open profit, it computes stepCount = floor(profit / 2) and locks stepCount * 2 - LockMinusBuffer=1.0 of profit by moving the stop to entry + priceDiff, where priceDiff = lockProfit / tickValue * tickSize. The stop only moves forward — never backward. Concretely, at $6 of open profit the stop is moved to lock $5; at $12 of open profit, $11; at $20, $19. This converts the open profit into a floor one step at a time, so a reversal that does not reach the fixed 160-point TP can still close at a locked gain via the trailing ladder rather than giving back to the move.

Three more management layers

On top of the lock-profit ladder, three more management layers run in this order. (1) The Gaussian cross exit — if the close crosses back through the mid-line (gaussNow), the position is force-closed via TryClose_EX12025. This is the failed-breakout exit and is essentially instantaneous. (2) The ATR trailing stop (UseTrailingStop=true by default) — the SL is recomputed every tick to bid - 1.2*ATR for longs and ratcheted forward only. (3) The break-even step (UseBreakeven=true by default) — once bid - entry > 1.2*ATR, the SL is dragged to entry. The order of operations in OnTick is: open new → check failed breakout → trail → break-even → lock-profit ladder, so each layer only moves the stop forward of where the previous one put it.

Pyramiding policy

OneTradeOnly=true (default) means the EA does not stack positions in the same direction. If the flag is flipped off, scaling in is allowed up to MaxOpenTrades=5, but every existing position must show at least MinProfitPerTradeToAdd=5.0 of unrealized profit before a new entry is allowed (AllowOnlyProfitableAdditions=true). AllPositionsHaveMinProfit() walks PositionsTotal() on every tick to confirm the gate is open; if any existing position is in loss, the EA refuses to add.

Risk guard and order plumbing

CheckMaxDrawdown() returns false and blocks new entries whenever 100 * (balance - equity) / balance > MaxDrawdownPercent=10. This is intraday floating-DD — once equity recovers, the EA resumes on the next tick. All order operations go through 3-retry wrappers. TryClose_EX12025 retries on REQUOTE / TIMEOUT / PRICE_OFF / PRICE_CHANGED with a 200ms sleep; TryModify_EX12025 retries only on REQUOTE and TIMEOUT with a 100ms sleep (PRICE_CHANGED is a hard fail for stop modifications because the original SL target may no longer make sense at the new price). The asymmetry between the close and modify retry windows is intentional — closing is a defensive action where PRICE_CHANGED is benign, but modifying a stop at a stale price is a precision action where PRICE_CHANGED is meaningful.

Practical fit

The shipped defaults — Lots=0.1, ATR_MultiplierSL=1.2, FixedTP_Points=160, MaxOpenTrades=5, MaxDrawdownPercent=10, OneTradeOnly=true — are tuned for XAUUSD M5 on a low-spread ECN or RAW account. The dynamic lock-profit ladder, the H4 EMA(50) gate, and the strict two-bar band confirm make this a low-frequency system. On a typical XAUUSD day in the London / New York overlap you should expect 1-3 entries, with the Asian session mostly skipped via the auto-tuned MinATR floor. To use the EA on FX majors instead, leave UseAutoFilter=true (so the floor is FX-scaled) and consider raising DistanceMultiplier to 1.0 or 1.2 to widen the band; for higher-frequency operation on gold, lower MinBreakDistance to 0.2 and raise Length to 14 so the band is smoother but the close-candle is more aggressive.

Strategy Deep Dive

On every tick the EA reads the EMA(10) handle, the ATR(14) handle, the H4 EMA(50) handle, and — when enabled — the Alligator SMMA trio and the 20-period Donchian channel, then runs a five-way gate: bar body ≥ 60% of range, two-bar band break in the trade direction, H4 EMA(50) agreement, EMA(10) slope agreement, and (price − gaussNow) > 0.3×ATR for longs. The order goes in with the broker-attached SL at 1.2×ATR and TP at 160 points. From that point OnTick walks the same ticket every tick to apply the failed-breakout Gaussian cross exit, the ATR trailing stop, the break-even step at 1.2×ATR, and the ratcheting lock-profit ladder, in that order. The whole trade-management stack is forward-only — no layer ever moves the stop backward. The 10% intraday drawdown check runs first thing in OnTick and blocks new entries when tripped.

Entry Signal

A long fires when the current close breaks above EMA(10) + 0.85×ATR(14) on the active timeframe with the prior two closes still below that band, the candle body covers at least 60% of its full high-low range, the H4 EMA(50) sits below price, the EMA(10) slope is positive, and the close is wider than 0.3×ATR above the mid-line. With optional filters on, the Alligator must show jaws > teeth > lips on the SMMA(13/8/5) trio, and/or price must break the 20-period Donchian high by 5 pips with a 2-bar confirm. The order is gated by intraday floating drawdown under 10%, position count under MaxOpenTrades (5 by default), and — if AllowOnlyProfitableAdditions is on — every existing ticket showing at least $5 of unrealized profit.

Exit Signal

Four management layers run in this order: a Gaussian-cross force close if price slips back through the EMA(10) mid-line, an ATR trailing stop ratcheted to bid − 1.2×ATR (forward only), a break-even step that drags the SL to entry once bid − entry > 1.2×ATR, and the dynamic lock-profit ladder that for every $2 of open profit moves the SL to lock stepCount × $2 − $1 as a forward-only floor. The fixed 160-point take-profit is the baseline exit, but the four management layers will frequently close the trade before TP is reached.

Stop Loss

The protective stop is 1.2×ATR(14) below the ask (long) or above the bid (short) at entry, with HardSL_Points=120 held as a wide cap in case the ATR-based stop would otherwise expand. A global 10% intraday floating drawdown guard (CheckMaxDrawdown) is the EA's session-level kill switch — once equity recovers above the floor, new entries resume on the next tick.

Take Profit

The take-profit is a fixed 160-point distance from entry (FixedTP_Points). On top of the fixed TP, the dynamic lock-profit ladder (EnableDynamicLockProfit, $2 steps with $1 buffer) progressively converts open profit into a locked floor as the trade moves in your favor, so the effective exit is whichever of fixed TP, Gaussian-cross early close, ATR trailing stop, or break-even fires first.

Best For

Sized for XAUUSD on M5 with a $100 minimum deposit and a MEDIUM risk label — the shipped defaults (Lots=0.1, ATR_SL×1.2, FixedTP=160pts, MaxOpenTrades=5, MaxDrawdown=10%, OneTradeOnly=true) are tuned for that bracket. The two-bar band confirm plus H4 EMA(50) trend gate needs a low-spread ECN or RAW broker so spread cost does not eat the breakout margin. The most useful sessions are the London and New York overlap on XAUUSD, where sustained moves produce clean band breaks; the Asian session is filtered out by the auto-tuned MinATR floor. With the dynamic lock-profit ladder active the system is suitable for unattended operation, but the strict two-bar confirm means it will sit through chop — best paired with patient capital and a broker that supports XAUUSD partial closes.

Strategy Logic

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

Family: MultiIndicatorConfluence Magic: 22212025 Version: 2.00

BRIEF: Adaptive volatility breakout EA using Gaussian bands and ATR-based stops. Combines Alligator, Donchian, and EMA trend filters with dynamic lock-profit, trailing stop, breakeven, and drawdown control for robust multi-condition entries. 12 layers: REGIME, SIGNAL, ENTRY, CONFIRM, NO-TRADE, CAPITAL CAP, RISK, SIZING, MANAGE, EXIT, SCALING, OnTester

INDICATOR STACK:

  • Standard MT5 indicators

KEY FUNCTIONS:

  • GetBuffer()
  • GaussianFilter()
  • GetATR()
  • GetEMA_HTF()
  • PositionExists()
  • CloseOpposite()
  • AutoTuneFilters()
  • CheckMaxDrawdown()
  • CountOpenTrades()
  • AllPositionsHaveMinProfit()
  • TryClose_EX12025()
  • TryClosePartial_EX12025()
  • ...and 1 more

INTERNAL CONSTANTS (0 total):

INPUT PARAMETERS (14 total across 5 groups):

  • [=== Identity ===] InpMagic = 22212025 // Magic number
  • [=== Identity ===] InpTradeComment = "Psgrowth.com Expert_12025" // Trade comment
  • [=== Signal ===] Timeframe = 0 // Timeframe (1=M1,2=M5,3=M15,4=M30,5=H1,6=H4,7=D1)
  • [=== Signal ===] TrendFilterTF = 6 // Timeframe (1=M1,2=M5,3=M15,4=M30,5=H1,6=H4,7=D1)
  • [=== Manage ===] MaxDrawdownPercent = 10.0 // Max drawdown % allowed
  • [=== Scaling ===] MaxOpenTrades = 5 // Maximum allowed open trades at the same time
  • [=== Scaling ===] AllowOnlyProfitableAdditions = true // Enable filter
  • [=== Scaling ===] MinProfitPerTradeToAdd = 5.0 // Minimum $ profit required per existing trade
  • [=== Scaling ===] LockProfitEvery_X_Dollars = 2.0 // Step: every $6 profit
  • [=== Scaling ===] LockMinusBuffer = 1.0 // Lock profit minus $1 buffer
  • [=== Confirm ===] AlligatorApplied = 5 // Applied price (1=close,2=open,3=high,4=low,5=median,6=typical,7=weighted)
  • [=== Confirm ===] DonchianPeriod = 20 // Lookback period
  • [=== Confirm ===] DonchianConfirmBars = 2 // Number of bars to confirm breakout
  • [=== Confirm ===] DonchianOffsetPips = 5.0 // Offset in pips for breakout buffer
Pseudocode
// Pipsgrowth EX12025 MultiIndicatorConfluence — Execution Flow (from source analysis)
// Family: MultiIndicatorConfluence
// Adaptive volatility breakout EA using Gaussian bands and ATR-based stops. Combines Alligator, Donchian, and EMA trend filters with dynamic lock-profit, trailing stop, breakeven, and drawdown control for robust multi-condition entries. 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
InpMagic22212025Magic number
InpTradeComment"Psgrowth.com Expert_12025"Trade comment
Timeframe0Timeframe (1=M1,2=M5,3=M15,4=M30,5=H1,6=H4,7=D1)
TrendFilterTF6Timeframe (1=M1,2=M5,3=M15,4=M30,5=H1,6=H4,7=D1)
MaxDrawdownPercent10.0Max drawdown % allowed
MaxOpenTrades5Maximum allowed open trades at the same time
AllowOnlyProfitableAdditionstrueEnable filter
MinProfitPerTradeToAdd5.0Minimum $ profit required per existing trade
LockProfitEvery_X_Dollars2.0Step: every $6 profit
LockMinusBuffer1.0Lock profit minus $1 buffer
AlligatorApplied5Applied price (1=close,2=open,3=high,4=low,5=median,6=typical,7=weighted)
DonchianPeriod20Lookback period
DonchianConfirmBars2Number of bars to confirm breakout
DonchianOffsetPips5.0Offset in pips for breakout buffer
Source Code (.mq5)Open Source
Pipsgrowth_com_EX12025.mq5
#property copyright "Pipsgrowth.com"
#property link      "https://pipsgrowth.com"
#property version   "2.00"
#property strict
#property description "Pipsgrowth.com EX12025 EA_5_13_2025 — Adaptive volatility Gaussian bands breakout EA, full 12-layer stack."
#include <Trade\Trade.mqh>
CTrade trade;

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_Timeframe = PERIOD_H1;
ENUM_TIMEFRAMES g_TrendFilterTF = PERIOD_H1;
ENUM_APPLIED_PRICE g_AlligatorApplied = PRICE_CLOSE;
input group "=== Identity ==="
input int    InpMagic            = 22212025; // Magic number
input string InpTradeComment     = "Psgrowth.com Expert_12025"; // Trade comment

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)

Full source code available on download

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

Tags:ex12025multiindicatorconfluencepipsgrowthfreemt5xauusd

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_EX12025.mq5
File Size20.1 KB
Versionv2.00
PlatformMetaTrader 5
File Type.mq5 Source
StrategyOther
Risk LevelMedium Risk
Timeframes
M5
Currency Pairs
XAUUSD
Min. Deposit$100