P
PipsGrowth
OtherOpen Source – Free

Pipsgrowth EX12032 MultiIndicatorConfluence

MT5 Expert Advisor (Open Source) · XAUUSD · M5

Pipsgrowth.com EX12032 EA101 — Advanced Gaussian bands breakout with Heiken Ashi/SuperTrend filters, full 12-layer stack.

Overview

EX12032 is a Gaussian-bands breakout EA built around a single-pole Gaussian approximation, not the more common Ehlers 4-pole implementation that runs elsewhere in the corpus. The midline is a Length=10 EMA on the chart timeframe, then two parallel bands are drawn at a DistanceMultiplier=0.85×ATR(14) above and below it. That produces wider bands than a Bollinger setting at the same length because ATR(14) is wider than a 14-period standard deviation, which is what gives the EA room to filter false breakouts. Every band value is shifted by GaussianShift (default 0) and ATRShift (default 0), so the user can pull the entire channel backward or forward in time to match a slightly lagging regime classifier.

The signal function, CheckBreakoutSignal, demands a specific price geometry before it fires. For a buy, the current bar's close must trade above the upper band while the two previous closes traded below it. That "2 prior closes inside" requirement is the structural integrity test: a single-bar poke above the band is rejected. On top of that, the slope test requires gaussNow > gaussPrev, the distance test requires (price − gaussNow) > MinBreakDistance × ATR (default 0.3 ATR), the higher-timeframe trend filter requires price > emaHTF where emaHTF is a Length=50 EMA on TrendFilterTF (default H4), and a candle-strength test requires the body to be at least 60% of the full candle range. The last filter is the one most EAs in this family skip — it discards doji-shaped breakouts where the close is above the band but the candle has long wicks indicating indecision. A sell is the exact mirror.

The two optional class-based filters, CheckHeikenAshiDirection and GetSuperTrendDirection, are wired but disabled by default. When the user turns UseHeikenAshiFilter on, a buy is rejected if the current Heiken Ashi candle is bearish (HA close ≤ HA open). When UseSuperTrendFilter is on, a buy is rejected if the SuperTrend (default ATR period 22, multiplier 3.0, median price) is bearish. Both filters short-circuit the entry in CheckBreakoutSignal via the buyFiltersPass / sellFiltersPass checks. With both off, the EA trades purely on the breakout geometry plus the HTF filter, which is the configuration 90%+ of live runs will use.

AutoTuneFilters is the regime adaptation layer. When UseAutoFilter=true, the function recomputes minATR, breakDistance, and bandMult from the live spread every cycle. AUTO_NORMAL sets them to 0.0003 (or 0.03 for 2-digit pairs), 0.3, and 1.0 respectively. AUTO_AGGRESSIVE tightens the band to 0.85× and the breakout requirement to 0.25× ATR, then boosts the ATR floor to 1.5× when the spread exceeds 10 points. The intent is to keep the trade count roughly constant across volatility regimes — wide ATR widens the bands naturally, so the multiplier is dropped to compensate, and vice versa.

Position management runs in ManageTradeLogic on every tick. The first test is IsWithinTradingSession, which is hard-disabled by default (UseSessionFilter=false), but if the user enables it the function supports four named windows — London 08:00–16:00 server-local, New York 13:00–21:00, Tokyo 00:00–08:00, Sydney 22:00–06:00 — with a GMT_Offset=2 plus a March–November +1h DST bump when UseDaylightSaving=true. Outside the session window, the EA only manages existing positions (trailing, breakeven, profit lock) and never opens new ones. Inside the window, CheckBreakoutSignal runs.

Exits are stacked. CheckMeanReversionExit is the cleanup pass — if a long has price < gaussNow, or a short has price > gaussNow, the position is closed at market via TryClose_EX12032. That function retries three times at 200ms intervals on the four transient retcodes (REQUOTE, TIMEOUT, PRICE_OFF, PRICE_CHANGED). If the position is still healthy, ApplyTrailingStop ratchets the stop to currentPrice ± ATR_MultiplierSL × ATR (1.2×ATR) whenever that would tighten the stop. ApplyBreakeven moves the stop to the entry once price has moved more than 1.2×ATR in favor. ApplyDynamicProfitLock then locks profit in dollars — when unrealized P/L crosses $2, $4, $6, etc., the stop is moved to entry + (stepCount × 2 − 1) / tickValue × tickSize, i.e. one dollar below each $2 milestone. That is the unusual piece of the architecture: profit-locking is denominated in account currency, not in price points, so the spacing on the chart changes with your lot size and the symbol's tick value.

The drawdown cap is CheckMaxDrawdown — if (balance − equity) / balance × 100 > MaxDrawdownPercent (default 10%), the EA refuses to open new trades. The lot size is computed by CalculateLotSize from the ATR-derived SL distance when UseAutoLotSize=true, otherwise fixed at Lots=0.1. The scaling cap is MaxOpenTrades=5 with OneTradeOnly=true, but AllowOnlyProfitableAdditions=true lets a second position join only if every existing position on the symbol is in profit by at least MinProfitPerTradeToAdd=5.0 in account currency — a strong anti-martingale feature that filters scaling into losing positions.

The TryModify_EX12032 retry policy is asymmetric to the close: it loops three times at 100ms on REQUOTE and TIMEOUT only, and bails out on PRICE_OFF and PRICE_CHANGED rather than retrying. The reasoning is that a close that races a price change can still be filled at a slightly worse price, but a modify that races a price change should not silently reissue at a worse stop. MaxSlippage=10 is the cap the EA passes into trade.SetDeviationInPoints.

In backtest, expect a signal rate of roughly 1–4 trades per day on XAUUSD M5 with the default profile — band touches happen frequently but the 2-prior-closes-inside rule and the body-strength check reject most of them. The dollar-based profit lock is what holds the equity curve together when trades run into the 1.2×ATR trailing band: instead of waiting for the ATR trail to catch up, the stop gets walked to breakeven minus one dollar at the first $2 of profit, which means most winners exit at a small gain rather than reverting all the way to the mean. Disable EnableDynamicProfitLock if you want runners; leave it on if you want the equity curve to grind higher with shallow pullbacks. Disable UseHeikenAshiFilter and UseSuperTrendFilter unless you specifically want fewer trades; both off matches the default config that the .mq5 ships with.

Strategy Deep Dive

The Gaussian midline is a Length=10 EMA on the chart timeframe, with bands drawn 0.85×ATR(14) above and below. CheckBreakoutSignal needs two prior closes inside the band before accepting a breakout, plus a rising Gaussian slope, an ATR-distance filter, an H4 EMA(50) trend confirmation, and a 60% body-strength test that rejects doji-shaped breakouts. AutoTuneFilters rewrites the band and breakout parameters every cycle based on the live spread and AUTO_NORMAL vs AUTO_AGGRESSIVE, scaling band width inversely with ATR. Exits stack mean-reversion (close on midline cross), 1.2×ATR trailing, breakeven at +1.2×ATR, and a unique dollar-based profit lock that walks the stop to $1 below each $2 of unrealized profit. Position scaling is capped at 5 with anti-martingale gating: new positions only join when every existing one is at least $5 in profit.

Entry Signal

A buy fires when the current close trades above the upper Gaussian band (Length=10 EMA ± 0.85×ATR(14)) while the two prior closes traded below it, the Gaussian slope is rising, price is above the H4 EMA(50) trend filter, and the candle body is at least 60% of the full range. A sell is the mirror. Entries are skipped when MinATR floor is not met, when the optional Heiken Ashi or SuperTrend filters (default OFF) disagree, or when MinProfitPerTradeToAdd gate blocks scaling.

Exit Signal

Three exit layers run on every tick. Mean reversion closes at market if price crosses back through the Gaussian midline. A 1.2×ATR trailing stop ratchets tighter only in the favorable direction. Breakeven fires when price moves more than 1.2×ATR in favor. A dollar-based dynamic profit lock walks the stop to one dollar below each $2 milestone of unrealized P/L. CloseOnOppositeSignal also forces a market exit when the signal flips.

Stop Loss

Initial stop is the larger of ATR_MultiplierSL=1.2 × ATR(14) and a HardSL_Points=120 points floor, set on the entry bar and tightened thereafter by the trailing, breakeven, and profit-lock routines. A 10% account equity drawdown cap halts all new entries; the EA does not flatten open positions automatically on the cap.

Take Profit

Fixed TP at FixedTP_Points=160 points from entry, sent to the broker as a hard TP order. Most profitable exits come from the dollar-based dynamic profit lock, not from the fixed TP, since the lock fires at small dollar milestones while the fixed TP requires the full 160-point move to be reached.

Best For

Built for XAUUSD M5 with magic 22212032. Minimum deposit $100 at MEDIUM risk; risk scales with the optional 1% auto-lot mode. Best on low-spread ECN brokers (Exness, IC Markets) since the band-width adaptation reads the live spread every cycle. Default config trades London and New York only, so an ECN broker with a tight Asian-session XAUUSD spread (under 30 points) will see fewer whipsaws than a high-spread broker.

Strategy Logic

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

Family: MultiIndicatorConfluence Magic: 22212032 Version: 2.00

BRIEF: Advanced volatility Gaussian bands breakout EA with Heiken Ashi and SuperTrend filters, shift parameters for all indicators, adaptive auto-filter modes, dynamic profit locking, trailing stop, breakeven, session filters, and drawdown protection. 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()
  • GetHeikenAshiData()
  • CheckHeikenAshiDirection()
  • GetSuperTrendDirection()
  • AutoTuneFilters()
  • CheckMeanReversionExit()
  • CountOpenTrades()
  • AllPositionsHaveMinProfit()
  • PositionExists()
  • ...and 12 more

INTERNAL CONSTANTS (1 total):

  • MAX_RETRIES = 3 // +------------------------------------------------------------------+

INPUT PARAMETERS (53 total across 10 groups):

  • [=== Identity ===] InpMagic = 22212032 // Magic number
  • [=== Identity ===] InpTradeComment = "Psgrowth.com Expert_12032" // Trade comment
  • [=== Signal ===] UseAutoFilter = true // Enable auto-adjustment of filters
  • [=== Signal ===] AutoMode = AUTO_NORMAL // Auto adjustment mode
  • [=== Signal ===] Length = 10 // Gaussian EMA length
  • [=== Signal ===] DistanceMultiplier = 0.85 // Band distance multiplier
  • [=== Signal ===] Timeframe = 0 // Timeframe (1=M1,2=M5,3=M15,4=M30,5=H1,6=H4,7=D1) // Main timeframe
  • [=== Signal ===] TrendFilterTF = 6 // Timeframe (1=M1,2=M5,3=M15,4=M30,5=H1,6=H4,7=D1) // Trend filter timeframe
  • [=== Signal ===] TrendEMA = 50 // Trend EMA period
  • [=== Signal ===] MinATR = 0.03 // Minimum ATR value
  • [=== Signal ===] MinBreakDistance = 0.3 // Minimum breakout distance (ATR multiples)
  • [=== Shift Parameters ===] GaussianShift = 0 // Gaussian EMA shift (positive = past, negative = future)
  • [=== Shift Parameters ===] ATRShift = 0 // ATR indicator shift
  • [=== Shift Parameters ===] TrendEMAShift = 0 // Trend EMA shift
  • [=== Shift Parameters ===] HeikenAshiShift = 0 // Heiken Ashi shift
  • [=== Shift Parameters ===] SuperTrendShift = 0 // SuperTrend shift
  • [=== Heiken Ashi Filter Settings ===] UseHeikenAshiFilter = false // Enable Heiken Ashi filter
  • [=== Heiken Ashi Filter Settings ===] HeikenAshiSmoothing = 1 // Smoothing period (1 = standard Heiken Ashi)
  • [=== SuperTrend Filter Settings ===] UseSuperTrendFilter = false // Enable SuperTrend filter
  • [=== SuperTrend Filter Settings ===] SuperTrendATRPeriod = 22 // SuperTrend ATR period
  • [=== SuperTrend Filter Settings ===] SuperTrendMultiplier = 3.0 // SuperTrend multiplier
  • [=== SuperTrend Filter Settings ===] SuperTrendPrice = 5 // Applied price (1=close,2=open,3=high,4=low,5=median,6=typical,7=weighted) // SuperTrend price type
  • [=== SuperTrend Filter Settings ===] SuperTrendWicks = true // Take wicks into account for SuperTrend
  • [=== Entry & Position Settings ===] Lots = 0.1 // Fixed lot size
  • [=== Entry & Position Settings ===] UseAutoLotSize = false // Enable automatic lot sizing
  • [=== Entry & Position Settings ===] RiskPercent = 1.0 // Risk percent when auto lot size is enabled
  • [=== Entry & Position Settings ===] OneTradeOnly = true // Allow only one trade per symbol
  • [=== Entry & Position Settings ===] MaxOpenTrades = 5 // Maximum allowed open trades
  • [=== Entry & Position Settings ===] AllowOnlyProfitableAdditions = true // Only add positions when existing are profitable
  • [=== Entry & Position Settings ===] MinProfitPerTradeToAdd = 5.0 // Minimum profit required per trade to add new position
  • [=== Stop Loss & Take Profit Settings ===] ATR_MultiplierSL = 1.2 // ATR multiplier for stop loss
  • [=== Stop Loss & Take Profit Settings ===] HardSL_Points = 120 // Hard stop loss in points (if ATR calculation fails)
  • [=== Stop Loss & Take Profit Settings ===] FixedTP_Points = 160 // Fixed take profit in points
  • [=== Stop Loss & Take Profit Settings ===] UseTrailingStop = true // Enable trailing stop loss
  • [=== Stop Loss & Take Profit Settings ===] UseBreakeven = true // Enable breakeven stop
  • [=== Profit Lock Settings ===] EnableDynamicLockProfit = true // Enable dynamic profit locking
  • [=== Profit Lock Settings ===] LockProfitEvery_X_Dollars = 2.0 // Lock profit at every X dollars
  • [=== Profit Lock Settings ===] LockMinusBuffer = 1.0 // Buffer amount subtracted from locked profit
  • [=== Risk Management Settings ===] MaxDrawdownPercent = 10.0 // Maximum allowed drawdown percentage
  • [=== Risk Management Settings ===] MaxSlippage = 10 // Maximum allowed slippage in points
  • [=== Risk Management Settings ===] CloseOnOppositeSignal = true // Close positions on opposite signal
  • [=== Session Filter Settings ===] UseSessionFilter = false // Enable session time filter
  • [=== Session Filter Settings ===] TradeLondonSession = true // Trade during London session
  • [=== Session Filter Settings ===] TradeNewYorkSession = true // Trade during New York session
  • [=== Session Filter Settings ===] TradeTokyoSession = false // Trade during Tokyo session
  • [=== Session Filter Settings ===] TradeSydneySession = false // Trade during Sydney session
  • [=== Session Filter Settings ===] GMT_Offset = 2 // GMT offset for broker's server time (winter)
  • [=== Session Filter Settings ===] UseDaylightSaving = true // Adjust for daylight saving time
  • [=== Session Filter Settings ===] TradeMonday = true // Allow trading on Monday
  • [=== Session Filter Settings ===] TradeTuesday = true // Allow trading on Tuesday
  • [=== Session Filter Settings ===] TradeWednesday = true // Allow trading on Wednesday
  • [=== Session Filter Settings ===] TradeThursday = true // Allow trading on Thursday
  • [=== Session Filter Settings ===] TradeFriday = true // Allow trading on Friday
Pseudocode
// Pipsgrowth EX12032 MultiIndicatorConfluence — Execution Flow (from source analysis)
// Family: MultiIndicatorConfluence
// Advanced volatility Gaussian bands breakout EA with Heiken Ashi and SuperTrend filters, shift parameters for all indicators, adaptive auto-filter modes, dynamic profit locking, trailing stop, breakeven, session filters, and drawdown protection. 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
InpMagic22212032Magic number
InpTradeComment"Psgrowth.com Expert_12032"Trade comment
UseAutoFiltertrueEnable auto-adjustment of filters
AutoModeAUTO_NORMALAuto adjustment mode
Length10Gaussian EMA length
DistanceMultiplier0.85Band distance multiplier
Timeframe0Timeframe (1=M1,2=M5,3=M15,4=M30,5=H1,6=H4,7=D1) // Main timeframe
TrendFilterTF6Timeframe (1=M1,2=M5,3=M15,4=M30,5=H1,6=H4,7=D1) // Trend filter timeframe
TrendEMA50Trend EMA period
MinATR0.03Minimum ATR value
MinBreakDistance0.3Minimum breakout distance (ATR multiples)
GaussianShift0Gaussian EMA shift (positive = past, negative = future)
ATRShift0ATR indicator shift
TrendEMAShift0Trend EMA shift
HeikenAshiShift0Heiken Ashi shift
SuperTrendShift0SuperTrend shift
UseHeikenAshiFilterfalseEnable Heiken Ashi filter
HeikenAshiSmoothing1Smoothing period (1 = standard Heiken Ashi)
UseSuperTrendFilterfalseEnable SuperTrend filter
SuperTrendATRPeriod22SuperTrend ATR period
SuperTrendMultiplier3.0SuperTrend multiplier
SuperTrendPrice5Applied price (1=close,2=open,3=high,4=low,5=median,6=typical,7=weighted) // SuperTrend price type
SuperTrendWickstrueTake wicks into account for SuperTrend
Lots0.1Fixed lot size
UseAutoLotSizefalseEnable automatic lot sizing
RiskPercent1.0Risk percent when auto lot size is enabled
OneTradeOnlytrueAllow only one trade per symbol
MaxOpenTrades5Maximum allowed open trades
AllowOnlyProfitableAdditionstrueOnly add positions when existing are profitable
MinProfitPerTradeToAdd5.0Minimum profit required per trade to add new position
ATR_MultiplierSL1.2ATR multiplier for stop loss
HardSL_Points120Hard stop loss in points (if ATR calculation fails)
FixedTP_Points160Fixed take profit in points
UseTrailingStoptrueEnable trailing stop loss
UseBreakeventrueEnable breakeven stop
EnableDynamicLockProfittrueEnable dynamic profit locking
LockProfitEvery_X_Dollars2.0Lock profit at every X dollars
LockMinusBuffer1.0Buffer amount subtracted from locked profit
MaxDrawdownPercent10.0Maximum allowed drawdown percentage
MaxSlippage10Maximum allowed slippage in points
CloseOnOppositeSignaltrueClose positions on opposite signal
UseSessionFilterfalseEnable session time filter
TradeLondonSessiontrueTrade during London session
TradeNewYorkSessiontrueTrade during New York session
TradeTokyoSessionfalseTrade during Tokyo session
TradeSydneySessionfalseTrade during Sydney session
GMT_Offset2GMT offset for broker's server time (winter)
UseDaylightSavingtrueAdjust for daylight saving time
TradeMondaytrueAllow trading on Monday
TradeTuesdaytrueAllow trading on Tuesday
TradeWednesdaytrueAllow trading on Wednesday
TradeThursdaytrueAllow trading on Thursday
TradeFridaytrueAllow trading on Friday
Source Code (.mq5)Open Source
Pipsgrowth_com_EX12032.mq5
#property copyright "Pipsgrowth.com"
#property link      "https://pipsgrowth.com"
#property version   "2.00"
#property strict
#property description "Pipsgrowth.com EX12032 EA101 — Advanced Gaussian bands breakout with Heiken Ashi/SuperTrend filters, full 12-layer stack."

//+------------------------------------------------------------------+
//| 1. INCLUDES                                                       |
//+------------------------------------------------------------------+
#include <Trade\Trade.mqh>
#include <Trade\PositionInfo.mqh>
#include <Trade\SymbolInfo.mqh>

//+------------------------------------------------------------------+
//| 2. ENUMS                                                          |
//+------------------------------------------------------------------+
enum ENUM_SIGNAL_TYPE {
   SIGNAL_NONE,     // No signal
   SIGNAL_BUY,      // Buy signal
   SIGNAL_SELL      // Sell signal
};

enum ENUM_AUTO_MODE {
   AUTO_OFF,        // Manual settings
   AUTO_NORMAL,     // Standard auto-adjustment
   AUTO_AGGRESSIVE  // Aggressive auto-adjustment
};

//+------------------------------------------------------------------+
//| 3. CONSTANTS                                                      |
//+------------------------------------------------------------------+
#define EA_NAME "Volatility Gaussian Bands Pro"
#define EA_VERSION "2.2.0"
#define MAX_RETRIES 3

//+------------------------------------------------------------------+
//| 4. INPUT PARAMETERS                                               |
//+------------------------------------------------------------------+
// === Identity ===
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;

Full source code available on download

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

Tags:ex12032multiindicatorconfluencepipsgrowthfreemt5xauusd

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