P
PipsGrowth
OtherOpen Source – Free

Pipsgrowth EX12046 MultiIndicatorConfluence

MT5 Expert Advisor (Open Source) · XAUUSD · M5

Pipsgrowth.com EX12046 EX105 — volatility Gaussian Bands breakout with multi-indicator confluence, full 12-layer stack.

Overview

EX12046 is a volatility-band breakout EA built around a single, clearly named mechanism: a Gaussian midline (an EMA of period Length=10 by default) wrapped in two ATR-scaled envelopes at upperBand = gauss + DistanceMultiplierATR and lowerBand = gauss − DistanceMultiplierATR (DistanceMultiplier=0.85). The OnTick engine fires a BUY when the close crosses above the upper envelope with the previous two closes still underneath, the price is also above the higher-timeframe EMA(50) on TrendFilterTF (H4 by default), and the close has separated from the midline by at least MinBreakDistance*ATR (0.3). A SELL mirrors that on the lower envelope. A breakout is therefore not a touch — it is a multi-bar, multi-timeframe, multi-filter event.

What makes EX12046 visibly heavier than a vanilla envelope system is the second decision rail. The EA refuses to fire unless four independent slope-based indicator confirmations all light up green. TEMA (period 14) is rebuilt as a triple-EMA cascade inside CalculateTEMA(), where ema2 and ema3 are recursively smoothed versions of ema1 and the final value is 3ema1 − 3ema2 + ema3. ZLEMA (period 14) is computed inside CalculateZLEMA() as ema + (price − ema)*0.5, which is the standard zero-lag adjustment that subtracts the lag from the EMA. T3 (period 14, volume factor 0.7) is the most expensive of the three — it builds six nested EMAs (e1..e6) and then applies the Tillson coefficients c1=−a³, c2=3a²+3a³, c3=−6a²−3a−3a³, c4=1+3a+a³+3a² in CalculateT3(). KAMA (period 10, fastSC=2, slowSC=30) is the only one of the four sourced from a native iAMA handle, and its slope is checked against KAMA_MinSlopePoints=1.2. Each of these can be toggled independently, but the trade only opens when every enabled one passes.

The third rail is four directional filters, run only after the band break has occurred. IsTrendMomentumSafe(direction) walks TrendLookbackPeriod=50 bars, computes a +1/−1 vote per bar, and blocks a BUY when the resulting strength is below −MinTrendStrength=0.6 (i.e. a strong downtrend) and a SELL when strength is above +0.6. It also requires the higher-timeframe EMA to be on the same side as the trade, and refuses to enter a trade that is more than 2.5 ATRs away from that higher-timeframe trend. IsOptimalMomentumAcceleration(direction) requires MinMomentumAcceleration=1.3 — the current bar's move must be at least 1.3x the previous bar's move — and, if RequireDirectionalSequence is on, that all three of the last three bars close in the trade direction. It also normalises the move by ATR and demands the directional move is at least 70% of the full bar move. IsOptimalFibonacciEntry(price, direction) computes a Fibonacci grid from the highest high and lowest low over FibSwingLookback=100 bars and accepts the trade only if the price is within FibTolerance=15 points of at least MinFibLevelsNear=2 of the 23.6/38.2/50/61.8/78.6 levels (the confluence requirement is on by default). IsHeikenAshiTrendBullish(direction) computes Heiken Ashi values with optional EMA smoothing, refuses doji candles (body < 30% of range), and demands HeikenAshi_TrendBars=3 consecutive HA bars on the trade side, optionally with a colour change within the last HeikenAshi_ColorChangeBars=5 bars. A breakout that survives all four indicator slope checks and all four directional filters is what the EA logs as "ALL FILTERS PASSED".

A second, separate block of filters is non-directional and runs on every tick. The anti-intervention block is explicitly JPY-aware: if the symbol contains "JPY", it blocks 0–3 GMT and 23:00 GMT (BOJ active hours), the ±5-minute windows around 8:30 / 12:30 / 1:30 GMT (the BOJ/EU/US data release slots), and 3:00–5:00 GMT on the first Friday of the month (BOJ meeting slot). For all symbols it blocks entries when the current ATR is more than MaxATRSpikeRatio=2.2x the ATRAverageWindow=15-bar average, when the live spread is more than MaxSpreadMultiplier=2.5x the broker's normal spread, when the current bar's range exceeds MaxCandleBodyRatio=4.0x ATR, or when the close has moved more than 2x ATR and is 3x the previous bar's move (sudden-reversal detection). A second volatility cluster check uses the last 3 ATR values and blocks when the current ATR is more than 2x that 3-bar mean. The session block, IsActiveSession(), uses TimeGMT() adjusted by the auto-detected broker offset (ManualBrokerOffset=0 by default) and DST flags, and accepts trades only during TradeLondon=7–15/16 GMT, TradeNewYork=12/13–20/21 GMT, or TradeAsian=0–8 GMT. The market-regime block, IsMarketTrending(), requires |directional votes / total votes| >= TrendingMarketThreshold=0.5 across RegimeLookbackPeriod=30 bars. The safe-time block, IsSafeTimeToTrade(), hard-blocks 12:25–12:35 GMT (US data), 11:40–11:50 GMT (ECB), 18:00–18:30 GMT (FOMC), and all of Friday after 15:00 GMT.

Position management is where EX12046 differs most from a typical breakout EA. The initial stop is MathMax(ATR_MultiplierSL*atr, HardSL_Points*_Point) with ATR_MultiplierSL=1.2 and HardSL_Points=120, so a quiet market gets a 1.2-ATR stop and a spike gets a hard 120-point floor. The initial take-profit is a fixed FixedTP_Points=160 points. The OnTick loop then layers four independent stop adjustments. TrailingStop ratchets the stop to bid − 1.2ATR on every tick (for buys) but only tightens, never loosens. Breakeven moves the stop to entry once the trade is 1.2ATR in profit. EnableDynamicLockProfit implements a step-locking ratchet that runs every tick: when the floating profit reaches LockProfitEvery_X_Dollars=2.0, it moves the stop to lock in (step_count2 − LockMinusBuffer=1.0) dollars; at 4 dollars profit, it locks $3; at 6, it locks $5; and so on, with a 200ms-fill-aware TryModify_EX12046 retry on REQUOTE/TIMEOUT/PRICE_OFF/PRICE_CHANGED. The fourth stop adjustment is the band-reentry exit: if a BUY is open and price drops more than 0.3ATR below the Gaussian midline, TryClose_EX12046 is called, exiting the position regardless of TP/SL. The trailing and breakeven modifications use 100ms Sleep on retry, the close path uses 200ms.

The market-close stack is what the EA uses to defend against weekend gaps. EnableCloseProtection, on by default, splits every weekday into three phases relative to 17:00 EST: the first phase stops opening new trades 120 minutes before close, the second activates smart position management 60 minutes before close, and the third emergency-closes every position 30 minutes before close. Friday overrides are stricter: 180/90/45 minutes respectively, and Friday_AllowLossRecovery is forced off, so on a Friday any open loss gets cut during the manage phase. The manage phase runs four checks per position: it closes profits under $15 (weekday) or $20 (Friday) to avoid overnight swap charges, it cuts losses past −$10 (weekday) or −$8 (Friday), and it routes moderate losses through CanRecoverPosition() which scores the 20-bar directional trend and a 1.5x ATR distance from entry before allowing the loss to ride overnight. ManageMarketClose() is invoked from CanOpenNewTrades() so the same clock governs both the entry gate and the close-out gate. A separate EnableSmartRecovery toggle exists but is off by default.

The deployment shape is unusually explicit. Magic is 22212046. The default symbol and timeframe are XAUUSD on M5 (the source header marks FX majors and metals as portable). Default lot is 0.1, with the trade comment string Psgrowth.com Expert_12046. MaxOpenTrades=5, MaxDrawdownPercent=10, MinProfitPerTradeToAdd=5, and AllowOnlyProfitableAdditions=true. Suggested broker profile: low-spread ECN/raw account, because the breakout is sensitive to slippage at the band edge and the 1.2*ATR stop is tight relative to gold's intraday range. On timeframes higher than H1 the indicator stack turns the EA into a slow trend follower that trades once a day at most; below M5, the multi-bar confirmation plus session filter plus news-time block tends to gate most ticks. The strategy tester short-circuits the session filter and DST detection, so backtest equity curves on XAUUSD M5 will look smoother than the corresponding forward curve, especially around the New York open and the London–NY overlap where the band edge is hit most often. The two retry helpers (TryClose_EX12046, TryModify_EX12046) are identical except for which trade method they call and the 200/100ms Sleep interval, and both stop on DONE or DONE_PARTIAL retcodes.

Sizing note: the EA uses a fixed Lots input (0.1 default) and does not read MaxRiskPerTrade or account-equity scaling anywhere on the OnTick path. There is no per-trade ATR-percent risk computation; the ATR is used only to size the stop distance, not the lot. A user who wants 1% risk per trade needs to pre-compute the lot from their account size, the symbol's tick value, and the 1.2*ATR stop distance, and set Lots accordingly. The dynamic lock profit's LockProfitEvery_X_Dollars=2 default is calibrated to a 0.1-lot XAUUSD trade — for a smaller lot the lock steps will be too tight, and for a larger lot they will be too loose. A user who scales Lots up to 0.5 should consider LockProfitEvery_X_Dollars=10 as a more realistic step.

Strategy Deep Dive

Each tick, OnTick pulls the Gaussian midline (iMA(Length=10) on the chart TF), the ATR(14), the higher-timeframe EMA(50) on TrendFilterTF, and the KAMA(10, 2, 30) — the four native handles created in OnInit. It then computes upperBand and lowerBand as midline ± 0.85*ATR, checks the slope filter (>= 2 points bar-over-bar), the volatility ratio (current ATR / previous ATR between 1.1 and 3.0), the candle body/range filter (>= 70% body and >= 80% of ATR), the session and DST-corrected London/NY/Asian windows, and the market-regime and safe-time blocks. If a band break passes those, it then re-computes the four code-built indicators TEMA, ZLEMA, T3, KAMA on the current and previous bar, demands every enabled slope exceeds its threshold, and only then runs the four directional filters: 50-bar trend momentum (with HTF EMA distance and recent-momentum sub-checks), 3-bar directional momentum acceleration, Fibonacci level confluence from a 100-bar swing, and 3-bar Heiken Ashi trend. The anti-intervention block runs on every tick as a market gate. Position management runs the trailing stop, breakeven, step-locking profit ratchet, and band-reentry exit on every tick; the market-close stack runs ManageMarketClose on every tick; the close and modify paths use 3-attempt retry with 200ms/100ms Sleep on REQUOTE/TIMEOUT/PRICE_OFF/PRICE_CHANGED.

Entry Signal

Triggers a BUY when the close crosses above the Gaussian upper envelope (gaussNow + DistanceMultiplierATR) with the previous two closes still underneath, the close is above the higher-timeframe EMA(50), and the close has separated from the midline by at least MinBreakDistanceATR. A SELL mirrors that on the lower envelope. The OnTick loop also requires four indicator slope confirmations (TEMA, KAMA, T3, ZLEMA — each toggleable), four directional filters (trend momentum on 50 bars, momentum acceleration on 3-bar directional sequence, Fibonacci retracement confluence on 100-bar swing, Heiken Ashi 3-bar trend), and a clean anti-intervention gate (volatility/spread/candle/spike/JPY-hours checks). The logged signal is ALL FILTERS PASSED only when all gates agree.

Exit Signal

Exits at the fixed FixedTP_Points=160-point take-profit, or at the initial ATR-MathMax stop, or via the trailing stop that ratchets the stop to bid − 1.2ATR on every tick (only tightens). The breakeven adjustment moves the stop to entry once profit reaches 1.2ATR. The dynamic lock-profit ratchet closes part of the gap as profit grows (steps of LockProfitEvery_X_Dollars=$2 with a $1 buffer). A separate band-reentry exit closes the position if price moves more than 0.3*ATR past the Gaussian midline against the trade. The 3-phase market-close stack (120/60/30 min weekday, 180/90/45 min Friday) emergency-closes positions before 17:00 EST.

Stop Loss

Initial stop is MathMax(ATR_MultiplierSL*atr, HardSL_Points*_Point) — i.e. 1.2*ATR or 120 points, whichever is wider. The trailing-stop, breakeven, and step-locking dynamic lock-profit ratchets all run on every tick and only tighten, never loosen, so the live stop is always >= the initial stop. The MaxDrawdownPercent=10% gate halts all new entries if account drawdown breaches 10%.

Take Profit

Initial take-profit is a fixed FixedTP_Points=160 points (≈1.33x the 120-point hard SL floor). The fixed TP is set on the order ticket and is not trailed. The dynamic lock-profit ratchet progressively floors profit in $2 steps minus a $1 buffer, so a 0.1-lot XAUUSD trade that hits 160 points will have locked $~78 by the time TP fills.

Best For

Best deployed on XAUUSD M5 (the source header default) with a $100 minimum deposit, 0.1-lot sizing, and an ECN/raw-spread broker with sub-100ms order latency. The 1.2*ATR stop and 160-point TP are tuned for gold's intraday range — on slower majors (EURUSD M5) the bands rarely break, on faster minors (GBPUSD M5) the trailing and lock-profit ratchets will over-tighten. The anti-intervention filter is most relevant on JPY pairs and is a no-op for XAUUSD. The session filter favours London and the London-NY overlap; running outside those hours on a quiet pair will starve the strategy of signals. Timeframes above H1 turn the EA into a once-a-day trend follower; below M5 the multi-bar confirmation rejects most ticks. The 3-phase market-close stack makes the EA weekend-safe by default — the only configuration a user should not change is the magic number 22212046 (a per-instance magic is required to run multiple EX12-family EAs on the same account without interleaving their tickets).

Strategy Logic

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

Family: MultiIndicatorConfluence Magic: 22212046 Version: 2.00

BRIEF: Volatility Gaussian Bands breakout EA with adaptive breakout detection, multi-indicator confluence (TEMA, ZLEMA, KAMA, T3, Fibonacci, Heiken Ashi), momentum acceleration, anti-intervention, trend momentum, and smart loss recovery. 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()
  • CalculateTEMA()
  • CalculateZLEMA()
  • CalculateT3()
  • IsHeikenAshiTrendBullish()
  • PositionExists()
  • CloseOpposite()
  • CheckMaxDrawdown()
  • GetBrokerGMTOffset()
  • ...and 21 more

INTERNAL CONSTANTS (0 total):

INPUT PARAMETERS (108 total across 20 groups):

  • [=== BASIC SETTINGS ===] Timeframe = 0 // Timeframe (1=M1,2=M5,3=M15,4=M30,5=H1,6=H4,7=D1)
  • [=== BASIC SETTINGS ===] TrendFilterTF = 6 // Timeframe (1=M1,2=M5,3=M15,4=M30,5=H1,6=H4,7=D1)
  • [=== BASIC SETTINGS ===] MaxDrawdownPercent = 10.0 // Max drawdown % allowed
  • [=== BASIC SETTINGS ===] MaxOpenTrades = 5 // Maximum allowed open trades at the same time
  • [=== BASIC SETTINGS ===] AllowOnlyProfitableAdditions = true // Enable filter
  • [=== BASIC SETTINGS ===] MinProfitPerTradeToAdd = 5.0 // Minimum $ profit required per existing trade
  • [=== BASIC SETTINGS ===] InpTradeComment = "Psgrowth.com Expert_12046" // Trade comment
  • [=== Dynamic Lock Profit ===] LockProfitEvery_X_Dollars = 2.0 // Step: every $6 profit
  • [=== Dynamic Lock Profit ===] LockMinusBuffer = 1.0 // Lock profit minus $1 buffer
  • [=== Filters ===] UseSlopeFilter = true // Enable slope confirmation
  • [=== Filters ===] MinSlopePoints = 2.0 // Minimum slope in points for confirmation
  • [=== Filters ===] UseEnhancedCandleFilter = true // Enable enhanced candle detection
  • [=== Filters ===] MinBodyRatio = 0.7 // Minimum body/candle ratio (0.6 = 60%)
  • [=== Filters ===] MinCandleSizeATR = 0.8 // Minimum candle size vs ATR (0.8 = 80% of ATR)
  • [=== Filters ===] UseVolatilityFilter = true // Enable volatility filtering
  • [=== Filters ===] MinVolatilityIncrease = 1.1 // ATR must be X times previous ATR
  • [=== Filters ===] MaxVolatilityThreshold = 3.0 // Avoid extreme volatility spikes
  • [=== Market Sessions ===] UseSessionFilter = true // Enable market session filtering
  • [=== Market Sessions ===] TradeLondon = true // Trade during London session
  • [=== Market Sessions ===] TradeNewYork = true // Trade during New York session
  • [=== Market Sessions ===] TradeAsian = false // Trade during Asian session
  • [=== Market Sessions ===] AutoDetectBrokerTZ = true // Auto-detect broker timezone
  • [=== Market Sessions ===] ManualBrokerOffset = 0 // Manual GMT offset if auto-detect fails
  • [=== Support/Resistance ===] UseSRFilter = true // Enable Support/Resistance filter
  • [=== Support/Resistance ===] SR_LookbackPeriod = 20 // Bars to look back for S/R levels
  • [=== Support/Resistance ===] SR_MinDistance = 30.0 // Minimum distance from S/R (points)
  • [=== Support/Resistance ===] SR_TouchSensitivity = 5.0 // How close price can get to S/R (points)
  • [=== TEMA ===] UseTEMAConfirmation = true // Enable TEMA trend confirmation
  • [=== TEMA ===] TEMA_Period = 14 // TEMA period (faster response)
  • [=== TEMA ===] TEMA_MinSlopePoints = 1.0 // Minimum TEMA slope for confirmation
  • [=== ZLEMA ===] ZLEMA_Period = 14 // ZLEMA period (faster response)
  • [=== ZLEMA ===] UseZLEMAConfirmation = true // Enable ZLEMA trend confirmation
  • [=== ZLEMA ===] ZLEMA_MinSlopePoints = 0.8 // Minimum ZLEMA slope
  • [=== KAMA ===] UseKAMAConfirmation = true // Enable KAMA adaptive confirmation
  • [=== KAMA ===] KAMA_Period = 10 // KAMA efficiency period
  • [=== KAMA ===] KAMA_FastSC = 2 // Fast smoothing constant
  • [=== KAMA ===] KAMA_SlowSC = 30 // Slow smoothing constant
  • [=== KAMA ===] KAMA_MinSlopePoints = 1.2 // Minimum KAMA slope
  • [=== T3 ===] UseT3Confirmation = true // Enable T3 trend confirmation
  • [=== T3 ===] T3_Period = 14 // T3 period
  • [=== T3 ===] T3_VolumeFactor = 0.7 // T3 volume factor (0.0-1.0)
  • [=== T3 ===] T3_MinSlopePoints = 1.1 // Minimum T3 slope for confirmation
  • [=== Fibonacci Retracement Filter ===] UseFibFilter = true // Enable Fibonacci retracement filter
  • [=== Fibonacci Retracement Filter ===] FibSwingLookback = 100 // Bars to find swing high/low
  • [=== Fibonacci Retracement Filter ===] FibRetracement_236 = 0.236 // 23.6% Fibonacci level
  • [=== Fibonacci Retracement Filter ===] FibRetracement_382 = 0.382 // 38.2% Fibonacci level
  • [=== Fibonacci Retracement Filter ===] FibRetracement_500 = 0.500 // 50.0% Fibonacci level
  • [=== Fibonacci Retracement Filter ===] FibRetracement_618 = 0.618 // 61.8% Fibonacci level
  • [=== Fibonacci Retracement Filter ===] FibRetracement_786 = 0.786 // 78.6% Fibonacci level
  • [=== Fibonacci Retracement Filter ===] FibTolerance = 15.0 // Points tolerance for Fib levels
  • [=== Fibonacci Retracement Filter ===] RequireFibConfluence = true // Require multiple Fib level confluence
  • [=== Fibonacci Retracement Filter ===] MinFibLevelsNear = 2 // Minimum Fib levels near price for confluence
  • [=== Momentum Acceleration Filter ===] UseMomentumAcceleration = true // Enable momentum acceleration filter
  • [=== Momentum Acceleration Filter ===] MinMomentumAcceleration = 1.3 // Current move must be 30% faster than previous
  • [=== Momentum Acceleration Filter ===] RequireDirectionalSequence = true // All 3 bars must move in same direction
  • [=== Momentum Acceleration Filter ===] UseATRNormalizedMomentum = true // Normalize momentum using ATR
  • [=== Anti-Intervention Filter (JPY Protection) ===] UseAntiInterventionFilter = true // Enable intervention detection
  • [=== Anti-Intervention Filter (JPY Protection) ===] MaxATRSpikeRatio = 2.2 // Block if ATR > 2.2x recent average
  • [=== Anti-Intervention Filter (JPY Protection) ===] MaxSpreadMultiplier = 2.5 // Block if spread > 2.5x normal
  • [=== Anti-Intervention Filter (JPY Protection) ===] ATRAverageWindow = 15 // ATR averaging window
  • [=== Anti-Intervention Filter (JPY Protection) ===] UseVolumeSpikeDection = true // Enable volume spike detection
  • [=== Anti-Intervention Filter (JPY Protection) ===] MaxVolumeSpikeRatio = 3.0 // Block if volume > 3x average
  • [=== Anti-Intervention Filter (JPY Protection) ===] UsePriceActionIntervention = true // Detect intervention price patterns
  • [=== Anti-Intervention Filter (JPY Protection) ===] MaxCandleBodyRatio = 4.0 // Block if candle > 4x ATR
  • [=== Anti-Intervention Filter (JPY Protection) ===] UseTimeBasedProtection = true // Block high-risk times for JPY
  • [=== Trend Momentum Filter (Loss Prevention) ===] UseTrendMomentumFilter = true // Enable trend momentum protection
  • [=== Trend Momentum Filter (Loss Prevention) ===] TrendLookbackPeriod = 50 // Bars to analyze trend strength
  • [=== Trend Momentum Filter (Loss Prevention) ===] MinTrendStrength = 0.6 // Minimum trend strength (60%)
  • [=== Trend Momentum Filter (Loss Prevention) ===] RequireTrendAlignment = true // Require trend alignment across timeframes
  • [=== Trend Momentum Filter (Loss Prevention) ===] MaxCounterTrendRisk = 0.3 // Maximum allowed counter-trend risk
  • [=== Trend Momentum Filter (Loss Prevention) ===] UseAdvancedTrendAnalysis = true // Enable multi-layer trend analysis
  • [=== Advanced Entry Confirmation ===] UseAdvancedEntryFilter = true // Enable advanced entry timing
  • [=== Advanced Entry Confirmation ===] ConfirmationBars = 3 // Bars to confirm breakout
  • [=== Advanced Entry Confirmation ===] MinBreakoutStrength = 1.2 // Minimum breakout strength vs ATR
  • [=== Advanced Entry Confirmation ===] UseMarketRegimeFilter = true // Enable market regime detection
  • [=== Advanced Entry Confirmation ===] RegimeLookbackPeriod = 30 // Bars to analyze market regime
  • [=== Advanced Entry Confirmation ===] TrendingMarketThreshold = 0.5 // 50% directional moves = trending
  • [=== Heiken Ashi Trend Confirmation ===] UseHeikenAshiConfirmation = true // Enable Heiken Ashi trend confirmation
  • [=== Heiken Ashi Trend Confirmation ===] HeikenAshi_Period = 14 // Period for HA smoothing (1 = standard HA)
  • [=== Heiken Ashi Trend Confirmation ===] HeikenAshi_UseSmoothing = true // Enable smoothed Heiken Ashi
  • [=== Heiken Ashi Trend Confirmation ===] HeikenAshi_MinBodySize = 0.3 // Minimum HA body size vs ATR (0.3 = 30%)
  • [=== Heiken Ashi Trend Confirmation ===] HeikenAshi_TrendBars = 3 // Consecutive HA bars required for trend
  • [=== Heiken Ashi Trend Confirmation ===] HeikenAshi_RequireColorChange = false // Require recent color change for entry
  • [=== Heiken Ashi Trend Confirmation ===] HeikenAshi_ColorChangeBars = 5 // Max bars since color change
  • [=== Heiken Ashi Trend Confirmation ===] HeikenAshi_AvoidDoji = true // Avoid trading during HA doji patterns
  • [=== Heiken Ashi Trend Confirmation ===] HeikenAshi_DojiRatio = 0.3 // Doji threshold (body < 30% of total range)
  • [=== Market Close Protection - Weekdays (Mon-Thu) ===] EnableCloseProtection = true // Enable market close management
  • [=== Market Close Protection - Weekdays (Mon-Thu) ===] Weekday_StopNewTrades = 120 // Stop new trades X minutes before close
  • [=== Market Close Protection - Weekdays (Mon-Thu) ===] Weekday_ManagePositions = 60 // Start position management X minutes before close
  • [=== Market Close Protection - Weekdays (Mon-Thu) ===] Weekday_ForceCloseAll = 30 // Force close all trades X minutes before close
  • [=== Weekday Position Management Rules ===] Weekday_CloseSmallProfit_USD = 15.0 // Close profits smaller than $X (overnight fees protection)
  • [=== Weekday Position Management Rules ===] Weekday_MaxLossToKeep_USD = -10.0 // Close losses bigger than $X (cut losses)
  • [=== Weekday Position Management Rules ===] Weekday_AllowLossRecovery = true // Allow small losses to recover overnight
  • [=== Weekday Position Management Rules ===] Weekday_RecoveryThreshold_USD = -5.0 // Allow losses up to $X to recover
  • [=== Market Close Protection - Friday (Weekend Gap Protection) ===] Friday_ExtraProtection = true // Enable extra Friday protection
  • [=== Market Close Protection - Friday (Weekend Gap Protection) ===] Friday_StopNewTrades = 180 // Stop new trades X minutes before Friday close
  • [=== Market Close Protection - Friday (Weekend Gap Protection) ===] Friday_ManagePositions = 90 // Start position management X minutes before Friday close
  • [=== Market Close Protection - Friday (Weekend Gap Protection) ===] Friday_ForceCloseAll = 45 // Force close all trades X minutes before Friday close
  • [=== Friday Position Management Rules ===] Friday_CloseSmallProfit_USD = 20.0 // Close profits smaller than $X (higher threshold for weekend)
  • [=== Friday Position Management Rules ===] Friday_MaxLossToKeep_USD = -8.0 // Close losses bigger than $X (stricter for weekend)
  • [=== Friday Position Management Rules ===] Friday_AllowLossRecovery = false // Don't allow loss recovery over weekend
  • [=== Friday Position Management Rules ===] Friday_CloseAllBreakeven = true // Close all breakeven trades on Friday
  • [=== Friday Position Management Rules ===] Friday_BreakevenRange_USD = 3.0 // Consider trades within ±$X as breakeven
  • [=== Smart Loss Recovery System ===] EnableSmartRecovery = false // Enable intelligent loss recovery
  • [=== Smart Loss Recovery System ===] RecoveryAnalysisPeriod = 20 // Bars to analyze for recovery potential
  • [=== Smart Loss Recovery System ===] MinRecoveryTrendStrength = 0.6 // Minimum trend strength for recovery (0.6 = 60%)
  • [=== Smart Loss Recovery System ===] UseATRBasedRecovery = true // Use ATR to assess recovery potential
  • [=== Smart Loss Recovery System ===] RecoveryATRMultiplier = 1.5 // Allow recovery if price within X ATRs of breakeven
Pseudocode
// Pipsgrowth EX12046 MultiIndicatorConfluence — Execution Flow (from source analysis)
// Family: MultiIndicatorConfluence
// Volatility Gaussian Bands breakout EA with adaptive breakout detection, multi-indicator confluence (TEMA, ZLEMA, KAMA, T3, Fibonacci, Heiken Ashi), momentum acceleration, anti-intervention, trend momentum, and smart loss recovery. 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
InpTradeComment"Psgrowth.com Expert_12046"Trade comment
LockProfitEvery_X_Dollars2.0Step: every $6 profit
LockMinusBuffer1.0Lock profit minus $1 buffer
UseSlopeFiltertrueEnable slope confirmation
MinSlopePoints2.0Minimum slope in points for confirmation
UseEnhancedCandleFiltertrueEnable enhanced candle detection
MinBodyRatio0.7Minimum body/candle ratio (0.6 = 60%)
MinCandleSizeATR0.8Minimum candle size vs ATR (0.8 = 80% of ATR)
UseVolatilityFiltertrueEnable volatility filtering
MinVolatilityIncrease1.1ATR must be X times previous ATR
MaxVolatilityThreshold3.0Avoid extreme volatility spikes
UseSessionFiltertrueEnable market session filtering
TradeLondontrueTrade during London session
TradeNewYorktrueTrade during New York session
TradeAsianfalseTrade during Asian session
AutoDetectBrokerTZtrueAuto-detect broker timezone
ManualBrokerOffset0Manual GMT offset if auto-detect fails
UseSRFiltertrueEnable Support/Resistance filter
SR_LookbackPeriod20Bars to look back for S/R levels
SR_MinDistance30.0Minimum distance from S/R (points)
SR_TouchSensitivity5.0How close price can get to S/R (points)
UseTEMAConfirmationtrueEnable TEMA trend confirmation
TEMA_Period14TEMA period (faster response)
TEMA_MinSlopePoints1.0Minimum TEMA slope for confirmation
ZLEMA_Period14ZLEMA period (faster response)
UseZLEMAConfirmationtrueEnable ZLEMA trend confirmation
ZLEMA_MinSlopePoints0.8Minimum ZLEMA slope
UseKAMAConfirmationtrueEnable KAMA adaptive confirmation
KAMA_Period10KAMA efficiency period
KAMA_FastSC2Fast smoothing constant
KAMA_SlowSC30Slow smoothing constant
KAMA_MinSlopePoints1.2Minimum KAMA slope
UseT3ConfirmationtrueEnable T3 trend confirmation
T3_Period14T3 period
T3_VolumeFactor0.7T3 volume factor (0.0-1.0)
T3_MinSlopePoints1.1Minimum T3 slope for confirmation
UseFibFiltertrueEnable Fibonacci retracement filter
FibSwingLookback100Bars to find swing high/low
FibRetracement_2360.23623.6% Fibonacci level
FibRetracement_3820.38238.2% Fibonacci level
FibRetracement_5000.50050.0% Fibonacci level
FibRetracement_6180.61861.8% Fibonacci level
FibRetracement_7860.78678.6% Fibonacci level
FibTolerance15.0Points tolerance for Fib levels
RequireFibConfluencetrueRequire multiple Fib level confluence
MinFibLevelsNear2Minimum Fib levels near price for confluence
UseMomentumAccelerationtrueEnable momentum acceleration filter
MinMomentumAcceleration1.3Current move must be 30% faster than previous
RequireDirectionalSequencetrueAll 3 bars must move in same direction
UseATRNormalizedMomentumtrueNormalize momentum using ATR
UseAntiInterventionFiltertrueEnable intervention detection
MaxATRSpikeRatio2.2Block if ATR > 2.2x recent average
MaxSpreadMultiplier2.5Block if spread > 2.5x normal
ATRAverageWindow15ATR averaging window
UseVolumeSpikeDectiontrueEnable volume spike detection
MaxVolumeSpikeRatio3.0Block if volume > 3x average
UsePriceActionInterventiontrueDetect intervention price patterns
MaxCandleBodyRatio4.0Block if candle > 4x ATR
UseTimeBasedProtectiontrueBlock high-risk times for JPY
UseTrendMomentumFiltertrueEnable trend momentum protection
TrendLookbackPeriod50Bars to analyze trend strength
MinTrendStrength0.6Minimum trend strength (60%)
RequireTrendAlignmenttrueRequire trend alignment across timeframes
MaxCounterTrendRisk0.3Maximum allowed counter-trend risk
UseAdvancedTrendAnalysistrueEnable multi-layer trend analysis
UseAdvancedEntryFiltertrueEnable advanced entry timing
ConfirmationBars3Bars to confirm breakout
MinBreakoutStrength1.2Minimum breakout strength vs ATR
UseMarketRegimeFiltertrueEnable market regime detection
RegimeLookbackPeriod30Bars to analyze market regime
TrendingMarketThreshold0.550% directional moves = trending
UseHeikenAshiConfirmationtrueEnable Heiken Ashi trend confirmation
HeikenAshi_Period14Period for HA smoothing (1 = standard HA)
HeikenAshi_UseSmoothingtrueEnable smoothed Heiken Ashi
HeikenAshi_MinBodySize0.3Minimum HA body size vs ATR (0.3 = 30%)
HeikenAshi_TrendBars3Consecutive HA bars required for trend
HeikenAshi_RequireColorChangefalseRequire recent color change for entry
HeikenAshi_ColorChangeBars5Max bars since color change
HeikenAshi_AvoidDojitrueAvoid trading during HA doji patterns
HeikenAshi_DojiRatio0.3Doji threshold (body < 30% of total range)
EnableCloseProtectiontrueEnable market close management
Weekday_StopNewTrades120Stop new trades X minutes before close
Weekday_ManagePositions60Start position management X minutes before close
Weekday_ForceCloseAll30Force close all trades X minutes before close
Weekday_CloseSmallProfit_USD15.0Close profits smaller than $X (overnight fees protection)
Weekday_MaxLossToKeep_USD-10.0Close losses bigger than $X (cut losses)
Weekday_AllowLossRecoverytrueAllow small losses to recover overnight
Weekday_RecoveryThreshold_USD-5.0Allow losses up to $X to recover
Friday_ExtraProtectiontrueEnable extra Friday protection
Friday_StopNewTrades180Stop new trades X minutes before Friday close
Friday_ManagePositions90Start position management X minutes before Friday close
Friday_ForceCloseAll45Force close all trades X minutes before Friday close
Friday_CloseSmallProfit_USD20.0Close profits smaller than $X (higher threshold for weekend)
Friday_MaxLossToKeep_USD-8.0Close losses bigger than $X (stricter for weekend)
Friday_AllowLossRecoveryfalseDon't allow loss recovery over weekend
Friday_CloseAllBreakeventrueClose all breakeven trades on Friday
Friday_BreakevenRange_USD3.0Consider trades within ±$X as breakeven
EnableSmartRecoveryfalseEnable intelligent loss recovery
RecoveryAnalysisPeriod20Bars to analyze for recovery potential
MinRecoveryTrendStrength0.6Minimum trend strength for recovery (0.6 = 60%)
UseATRBasedRecoverytrueUse ATR to assess recovery potential
RecoveryATRMultiplier1.5Allow recovery if price within X ATRs of breakeven
Source Code (.mq5)Open Source
Pipsgrowth_com_EX12046.mq5
#property copyright "Pipsgrowth.com"
#property link      "https://pipsgrowth.com"
#property version   "2.00"
#property strict
#property description "Pipsgrowth.com EX12046 EX105 — volatility Gaussian Bands breakout with multi-indicator confluence, 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 "=== BASIC SETTINGS ==="
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;
input double Lots               = 0.1;
input bool   OneTradeOnly       = false;
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

input int MaxOpenTrades = 5;  // Maximum allowed open trades at the same time
input bool   AllowOnlyProfitableAdditions = true;     // Enable filter
input double MinProfitPerTradeToAdd       = 5.0;      // Minimum $ profit required per existing trade
input string InpTradeComment = "Psgrowth.com Expert_12046"; // 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;

Full source code available on download

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

Tags:ex12046multiindicatorconfluencepipsgrowthfreemt5xauusd

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