P
PipsGrowth
OtherOpen Source – Free

Pipsgrowth EX12068 MultiIndicatorConfluence

MT5 Expert Advisor (Open Source) · XAUUSD · M5

Pipsgrowth.com EX12068 gen2 — Volatility Gaussian Bands EA with sessions and RSI filters, full 12-layer stack.

Overview

EX12068 is a session-aware, hold-time-disciplined Gen2 variant of the PipsGrowth MultiIndicatorConfluence family. The core signal is a volatility Gaussian bands breakout: a 10-period EMA acts as a midline, and the EA draws two bands at midline ± 0.85 × ATR(14) around it. Entries trigger when price crosses out of the upper or lower band with the previous two closes still inside the band, producing a 2-bar confirmed band-cross that filters single-tick spikes. The position-management stack layers an ATR trailing stop, a 1.2×ATR breakeven ratchet, and a dynamic lock-profit that lifts the stop in $2 increments (minus a $1 buffer) every $2 of unrealized profit.

The 6-stacked entry gates run in this order on every tick where canTrade is true. First, the drawdown gate: CheckMaxDrawdown() returns false the moment floating equity dips more than 10% below balance and OnTick exits immediately. Second, the auto-tuned volatility filter: AutoTuneFilters() measures the live spread, derives a pipFactor of 0.0001 on sub-3-point spreads (forex) or 0.01 on wider spreads (gold), and sets minATR = 3 × pipFactor. If ATR(14) < minATR the tick is skipped — a dead-market filter. Third, the strong-candle filter: the current bar's body must be ≥60% of its full high-low range. Fourth, the higher-timeframe trend gate: iMA(50, MODE_EMA, PERIOD_H4) — price must be above the EMA for buys and below for sells. Fifth, the Gaussian slope: gaussNow > gaussPrev for buys, < for sells. Sixth, the breakout distance: (price - gaussNow) > 0.3 × ATR for buys, (gaussNow - price) > 0.3 × ATR for sells.

RSI is the seventh and most rigorous gate when UseRSIForEntries = true (default). Buy entries require RSI(14) < 70 AND rsiPrev < rsi — RSI is below overbought AND rising. Sells mirror that: RSI > 30 AND rsiPrev > rsi (above oversold AND falling). This is a hard filter, not a soft overlay — when RSI fails the test, no trade fires regardless of how clean the band-cross looks. The rising-RSI requirement on buys is a momentum-confirmation check: even a valid breakout is rejected if RSI is rolling over. The optional divergence exit (UseRSIDivergenceExit = false by default) compares price 3-bar ago to current price against RSI 3-bar ago to current, looking for a higher-high in price with a lower-high in RSI (or mirror).

Position management runs every tick after the entry logic. The ATR trailing stop (UseTrailingStop = true, ATR_MultiplierSL = 1.2) moves the stop to bid - 1.2×ATR on longs (or ask + 1.2×ATR on shorts) whenever that value is closer to price than the current stop — a forward-only ratchet that never widens. The breakeven ratchet (UseBreakeven = true) promotes the stop to the entry price once price has travelled 1.2×ATR in favor. The dynamic lock-profit (EnableDynamicLockProfit = true) takes the floor of profit / 2 as stepCount, multiplies by $2 minus a $1 buffer, converts to price via lockProfit / tickValue × tickSize, and lifts the stop to entry + priceDiff for longs — also forward-only.

Three trading sessions are enabled by default: 01:00-05:00, 08:00-12:00, and 16:00-20:00 server time. IsWithinTradingSession() returns true only if the current server hour-minute falls inside at least one enabled window. At 01:00 server the EA can re-engage after the daily reset; the four-hour gap between session 1 and session 2 acts as a hard cooldown, and the four-hour gap before session 3 forces the EA to cool before New York. The Min Holding Time gate (UseMinHoldTime = true) asymmetrically enforces patience: profitable positions must be held at least 3 minutes (MinHoldTimeProfitMinutes = 3) before any exit can fire, and losing positions at least 1 minute (MinHoldTimeLossMinutes = 1). BlockCloseOnSameCandle = true adds a second patience layer — closes are blocked if the position opened on the current bar, preventing immediate scalp-out on the entry candle.

A 30-second cooldown between trades (MinSecondsBetweenTrades = 30) prevents the EA from rapid-firing entries on every qualifying tick during a session. Smart Slippage (UseSmartSlippage = true, SlippageATRFactor = 0.2) replaces the static 10-point cap with a dynamic allowance of MathMax(MaxSlippage, round(ATR / _Point × 0.2)), and on bars where volatility exceeds 0.1% of price the slippage gets a 1.5× multiplier on top. The 3-retry wrappers (TryClose_EX12068, TryClosePartial_EX12068, TryModify_EX12068) catch REQUOTE, TIMEOUT, PRICE_OFF, and PRICE_CHANGED with 200ms Sleeps (or 100ms for modify) between attempts before giving up.

Capital protection runs before everything. CheckMaxDrawdown() reads AccountInfoDouble(ACCOUNT_BALANCE) and ACCOUNT_EQUITY, computes 100 × (balance - equity) / balance, and rejects new entries above 10%. HardSL_Points = 120 is a hard stop-loss safety net at 120 points regardless of ATR conditions. Friday protection is the standard server-hour model: IsNearFridayClose() returns true when time.day_of_week == 5 and 17 - time.hour <= 2, after which CloseTrades2HoursBeforeFriday = true flushes open positions and AvoidTrading2HoursBeforeFriday = true blocks new entries until the next session.

What to expect in backtest: the 3-session schedule with 30-second cooldowns produces a low trade frequency, typically 1-3 entries per session on XAUUSD M5 during high-volatility windows and 0-1 in quiet ones. The 6-stacked entry plus RSI filter combination is strict — expect a high rejection rate on what looks like valid breakouts because the strong-candle gate or the rising-RSI gate is failing. The 0.85 band multiplier is tighter than the family default of 1.0 — the EA wants confirmed band-crosses, not first-tick touches. Run on XAUUSD M5 with $100 minimum, fixed 0.1 lots, ECN-RAW spread broker with sub-pip spreads for the best result. Single-position mode is the safer default (OneTradeOnly = true); flip to MaxOpenTrades = 5 with AllowOnlyProfitableAdditions = true only after validating the strategy on a long backtest.

Strategy Deep Dive

On every tick where CheckMaxDrawdown() passes, the EA measures the ATR(14) and computes a Gaussian midline as a 10-period EMA plus upper/lower bands at midline ± 0.85×ATR. Buy entries fire when the current close is above the upper band, the previous two closes were below it, the candle body is ≥60% of its range, price is above the H4 EMA(50), the Gaussian is sloping up, and the breakout distance is >0.3×ATR — and RSI(14) is below 70 with rsiPrev < rsi. Sell entries mirror the gates with RSI > 30 and rsiPrev > rsi. After entry, every tick runs ATR trailing at 1.2×ATR, a breakeven ratchet at 1.2×ATR, a $2-step dynamic lock-profit, an RSI early-exit with 2-period confirmation, and a hard 120-point stop fallback. The 3-retry wrappers (TryClose, TryClosePartial, TryModify) handle REQUOTE/TIMEOUT/PRICE_OFF/PRICE_CHANGED with 200ms (or 100ms for modify) Sleeps.

Entry Signal

Pulls entries when price crosses out of a 0.85×ATR band around a 10-period EMA midline, with the previous two closes still inside the band. Six gates stack before RSI: max-drawdown (10%), auto-tuned minimum ATR (3×pipFactor), strong-candle (body ≥60% of range), H4 EMA(50) trend, Gaussian slope, and breakout distance >0.3×ATR. RSI then acts as the primary filter — buys need RSI(14) < 70 with rsiPrev < rsi, sells need RSI > 30 with rsiPrev > rsi. Three trading sessions (01-05, 08-12, 16-20 server time) and a 30-second cooldown gate the entry timing.

Exit Signal

Exits are driven by the 1.2×ATR trailing stop, the 1.2×ATR breakeven ratchet, the dynamic lock-profit that lifts the stop in $2 increments (minus $1 buffer), and a hard stop at 120 points. RSI early-exit (UseRSIEarlyExit=true, ConfirmationPeriods=2) closes positions when the last 2 RSI prints both register overbought (for longs) or oversold (for shorts), gated by RSI trend direction if UseRSITrendForExit is on. Min Holding Time forces profitable positions to wait 3 minutes and losing positions 1 minute before any close can fire, and BlockCloseOnSameCandle prevents bar-zero exits. Friday protection flushes all positions when hoursToClose ≤ 2.

Stop Loss

The ATR trailing stop rides at 1.2×ATR behind bid (longs) or ahead of ask (shorts), forward-only. A 1.2×ATR breakeven ratchet promotes the stop to entry once price travels 1.2×ATR in favor, and the dynamic lock-profit ratchets the stop in $2 increments minus a $1 buffer. HardSL = 120 points acts as a fixed fallback.

Take Profit

FixedTP_Points = 160 points at entry, applied as ask + 160 for buys and bid - 160 for sells. The dynamic lock-profit can close the position before TP if the lock step catches up. With FixedTP=160 and SL ~1.2×ATR (~120-150 points typical on XAUUSD M5), the R:R is roughly 1.1-1.3:1 in favor of the trade.

Best For

Minimum balance $100 with the default 0.1-lot fixed position on XAUUSD M5. Run on a low-spread ECN or RAW-spread account — the 0.85 band multiplier and the smart slippage logic both assume tight spreads to keep the band-cross signal clean. The 3-session schedule (01-05, 08-12, 16-20 server time) targets the Asian open, the London open, and the New York open in sequence, so the EA is most productive on brokers with server time set to GMT+0 or GMT+1. Single-position-at-a-time is the safer mode (OneTradeOnly = true), but MaxOpenTrades = 5 with AllowOnlyProfitableAdditions = true allows scaling in on confirmed winners.

Strategy Logic

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

Family: MultiIndicatorConfluence Magic: 22212068 Version: 2.00

BRIEF: Volatility Gaussian Bands EA with adaptive breakout, RSI entry/exit filters, trading sessions, min holding time, slippage control and Friday close management. 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()
  • GetRSI()
  • PositionExists()
  • CloseOpposite()
  • AutoTuneFilters()
  • CheckMaxDrawdown()
  • IsWithinTradingSession()
  • CountOpenTrades()
  • AllPositionsHaveMinProfit()
  • ...and 10 more

INTERNAL CONSTANTS (0 total):

INPUT PARAMETERS (45 total across 11 groups):

  • [=== 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)
  • [=== Risk ===] MaxDrawdownPercent = 10.0 // Max drawdown % allowed
  • [=== Trade Management ===] MaxOpenTrades = 5 // Maximum allowed open trades at the same time
  • [=== Trade Management ===] AllowOnlyProfitableAdditions = true // Enable filter
  • [=== Trade Management ===] MinProfitPerTradeToAdd = 5.0 // Minimum $ profit required per existing trade
  • [=== Lock Profit ===] LockProfitEvery_X_Dollars = 2.0 // Step: every $6 profit
  • [=== Lock Profit ===] LockMinusBuffer = 1.0 // Lock profit minus $1 buffer
  • [=== RSI ===] RSI_Period = 14 // RSI Period
  • [=== RSI ===] RSI_Overbought = 70 // RSI Overbought level
  • [=== RSI ===] RSI_Oversold = 30 // RSI Oversold level
  • [=== RSI ===] UseRSIEarlyExit = true // Use RSI for early exit
  • [=== RSI ===] UseRSIForEntries = true // Use RSI for trade entries
  • [=== RSI ===] RSI_ExitConfirmationPeriods = 2 // Periods to confirm RSI exit signal
  • [=== RSI ===] UseRSITrendForExit = true // Use RSI trend direction for exit
  • [=== RSI ===] RSI_ExitSensitivity = 1.5 // RSI sensitivity multiplier for exit
  • [=== RSI ===] UseRSIDivergenceExit = false // Use RSI divergence for exit
  • [=== Friday Control ===] CloseTrades2HoursBeforeFriday = true // Close all trades 2 hours before Friday close
  • [=== Friday Control ===] AvoidTrading2HoursBeforeFriday = true // Don't open trades 2 hours before Friday close
  • [=== Trading Sessions ===] EnableSession1 = true // Enable Trading Session 1
  • [=== Trading Sessions ===] Session1StartHour = 1 // Session 1 Start Hour (0-23)
  • [=== Trading Sessions ===] Session1StartMinute = 0 // Session 1 Start Minute (0-59)
  • [=== Trading Sessions ===] Session1EndHour = 5 // Session 1 End Hour (0-23)
  • [=== Trading Sessions ===] Session1EndMinute = 0 // Session 1 End Minute (0-59)
  • [=== Trading Sessions ===] EnableSession2 = true // Enable Trading Session 2
  • [=== Trading Sessions ===] Session2StartHour = 8 // Session 2 Start Hour (0-23)
  • [=== Trading Sessions ===] Session2StartMinute = 0 // Session 2 Start Minute (0-59)
  • [=== Trading Sessions ===] Session2EndHour = 12 // Session 2 End Hour (0-23)
  • [=== Trading Sessions ===] Session2EndMinute = 0 // Session 2 End Minute (0-59)
  • [=== Trading Sessions ===] EnableSession3 = true // Enable Trading Session 3
  • [=== Trading Sessions ===] Session3StartHour = 16 // Session 3 Start Hour (0-23)
  • [=== Trading Sessions ===] Session3StartMinute = 0 // Session 3 Start Minute (0-59)
  • [=== Trading Sessions ===] Session3EndHour = 20 // Session 3 End Hour (0-23)
  • [=== Trading Sessions ===] Session3EndMinute = 0 // Session 3 End Minute (0-59)
  • [=== Min Holding Time ===] UseMinHoldTime = true // Enable Min Holding Time feature
  • [=== Min Holding Time ===] MinHoldTimeProfitMinutes = 3 // Min minutes to hold PROFITABLE position
  • [=== Min Holding Time ===] MinHoldTimeLossMinutes = 1 // Min minutes to hold LOSING position
  • [=== Min Holding Time ===] BlockCloseOnSameCandle = true // Prevent closing on same candle as open
  • [=== Min Time Between Trades ===] UseMinTimeBetweenTrades = true // Enable Min Time Between Trades feature
  • [=== Min Time Between Trades ===] MinSecondsBetweenTrades = 30 // Minimum seconds between consecutive trades
  • [=== Slippage Control ===] MaxSlippagePoints = 10 // Maximum allowed slippage in points
  • [=== Slippage Control ===] UseSmartSlippage = true // Dynamically adjust slippage based on market volatility
  • [=== Slippage Control ===] SlippageATRFactor = 0.2 // Portion of ATR to use for smart slippage (0.1-0.5)
  • [=== Identity ===] InpMagicNumber = 22212068 // Magic Number
  • [=== Identity ===] InpTradeComment = "Psgrowth.com Expert_12068" // Trade Comment
Pseudocode
// Pipsgrowth EX12068 MultiIndicatorConfluence — Execution Flow (from source analysis)
// Family: MultiIndicatorConfluence
// Volatility Gaussian Bands EA with adaptive breakout, RSI entry/exit filters, trading sessions, min holding time, slippage control and Friday close management. 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
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
RSI_Period14RSI Period
RSI_Overbought70RSI Overbought level
RSI_Oversold30RSI Oversold level
UseRSIEarlyExittrueUse RSI for early exit
UseRSIForEntriestrueUse RSI for trade entries
RSI_ExitConfirmationPeriods2Periods to confirm RSI exit signal
UseRSITrendForExittrueUse RSI trend direction for exit
RSI_ExitSensitivity1.5RSI sensitivity multiplier for exit
UseRSIDivergenceExitfalseUse RSI divergence for exit
CloseTrades2HoursBeforeFridaytrueClose all trades 2 hours before Friday close
AvoidTrading2HoursBeforeFridaytrueDon't open trades 2 hours before Friday close
EnableSession1trueEnable Trading Session 1
Session1StartHour1Session 1 Start Hour (0-23)
Session1StartMinute0Session 1 Start Minute (0-59)
Session1EndHour5Session 1 End Hour (0-23)
Session1EndMinute0Session 1 End Minute (0-59)
EnableSession2trueEnable Trading Session 2
Session2StartHour8Session 2 Start Hour (0-23)
Session2StartMinute0Session 2 Start Minute (0-59)
Session2EndHour12Session 2 End Hour (0-23)
Session2EndMinute0Session 2 End Minute (0-59)
EnableSession3trueEnable Trading Session 3
Session3StartHour16Session 3 Start Hour (0-23)
Session3StartMinute0Session 3 Start Minute (0-59)
Session3EndHour20Session 3 End Hour (0-23)
Session3EndMinute0Session 3 End Minute (0-59)
UseMinHoldTimetrueEnable Min Holding Time feature
MinHoldTimeProfitMinutes3Min minutes to hold PROFITABLE position
MinHoldTimeLossMinutes1Min minutes to hold LOSING position
BlockCloseOnSameCandletruePrevent closing on same candle as open
UseMinTimeBetweenTradestrueEnable Min Time Between Trades feature
MinSecondsBetweenTrades30Minimum seconds between consecutive trades
MaxSlippagePoints10Maximum allowed slippage in points
UseSmartSlippagetrueDynamically adjust slippage based on market volatility
SlippageATRFactor0.2Portion of ATR to use for smart slippage (0.1-0.5)
InpMagicNumber22212068Magic Number
InpTradeComment"Psgrowth.com Expert_12068"Trade Comment
Source Code (.mq5)Open Source
Pipsgrowth_com_EX12068.mq5
#property copyright "Pipsgrowth.com"
#property link      "https://pipsgrowth.com"
#property version   "2.00"
#property strict
#property description "Pipsgrowth.com EX12068 gen2 — Volatility Gaussian Bands EA with sessions and RSI filters, 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_TIMEFRAMES g_Timeframe = PERIOD_H1;
ENUM_TIMEFRAMES g_TrendFilterTF = PERIOD_H1;
input group "=== Signal ==="
input bool   UseAutoFilter       = true;
input int    Length              = 10;
input double DistanceMultiplier = 0.85;
input int Timeframe = 0; // Timeframe (1=M1,2=M5,3=M15,4=M30,5=H1,6=H4,7=D1)
input int TrendFilterTF = 6; // Timeframe (1=M1,2=M5,3=M15,4=M30,5=H1,6=H4,7=D1)
input int    TrendEMA            = 50;
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_TIMEFRAMES g_Timeframe = PERIOD_H1;
ENUM_TIMEFRAMES g_TrendFilterTF = PERIOD_H1;
input group "=== Risk ==="
input double Lots               = 0.1;
input bool   OneTradeOnly       = true;
input double ATR_MultiplierSL   = 1.2;
input double HardSL_Points      = 120;
input double FixedTP_Points     = 160;
input bool   UseTrailingStop    = true;
input bool   UseBreakeven       = true;
input double MinATR             = 0.03;
input double MinBreakDistance   = 0.3;
input double MaxDrawdownPercent = 10.0; // Max drawdown % allowed

ENUM_TIMEFRAMES MapTimeframeInt(int tf)

Full source code available on download

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

Tags:ex12068multiindicatorconfluencepipsgrowthfreemt5xauusd

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