P
PipsGrowth
OtherOpen Source – Free

Pipsgrowth EX17018 Volatility

MT5 Expert Advisor (Open Source) · XAUUSD · M5

Pipsgrowth.com EX17018 GB100 — Volatility Gaussian Bands EA with multi-filter confirmation, full 12-layer stack.

Overview

Pipsgrowth EX17018 sits inside the Volatility family but pulls a different lever than its siblings. Instead of a Bollinger-band mean-reversion, a Donchian breakout, or a multi-mode ATR burst, it operates as a slope-confirmed Gaussian-band breakout with four independent auxiliary oscillators gating every entry. The "Gaussian" in its name is, in practice, a Length=10 period EMA on close, and the bands are simply that EMA plus and minus DistanceMultiplier (0.85) times a 14-period ATR. The result is a smooth mid-line with a volatility-scaled envelope that breathes with the market, and trades only fire when price decisively punches through one side of the envelope while a separate higher-timeframe EMA-50 on H4 confirms the direction.

The breakout itself is conservative by design. EX17018 requires not just one bar to close above the upper band, but the previous bar to have closed below it, and the bar before that too — a two-bar-inside-then-outside confirmation. A buy setup additionally demands that price sits above the H4 EMA-50, that the break distance is at least 0.3 ATR beyond the band, that the candle body fills at least 70% of its total range, that the candle's total range covers at least 0.8 of one ATR, and that the price is not parked within 30 points of the most recent 20-bar swing high. The mirror logic applies to sell setups against the lower band. The IsQualityBreakout function then checks that the breakout is actually leaving the recent high/low zone rather than chopping inside it, requiring at least SR_TouchSensitivity (5 points) of separation.

Before any of that even runs, four slope-based oscillators all have to agree the move has directional energy. The TEMA (period 14) must have a slope exceeding 1.0 point; the KAMA (period 10, fast SC 2, slow SC 30) must exceed 1.2 points; the T3 (period 14, volume factor 0.7) must exceed 1.1 points; the ZLEMA (period 14) must exceed 0.8 points. A flat or sideways TEMA-ZLEMA-KAMA-T3 panel fails the gate even if the band break is otherwise textbook. The volatility filter adds a final check that current ATR is at least 1.1 times the previous bar's ATR (MinVolatilityIncrease) and no more than 3.0 times (MaxVolatilityThreshold) — the upper bound exists to keep EX17018 out of the catastrophic gap spikes that follow news shocks on gold. Combine those with the slope filter (Gaussian move must exceed 2.0 points between bars) and you have an EA that needs almost every indicator to point the same direction before a market order is sent.

The session machinery is DST-aware. GetBrokerGMTOffset compares broker server time to GMT, IsDSTActive computes the EU and US daylight-saving windows using the last-Sunday-of-March and last-Sunday-of-October rules, and IsActiveSession translates the configured London and New York flags into the correct GMT windows for the current date. Asian trading is disabled by default. The result is a clean London+New York bias with automatic clock adjustment, so the EA does not need its session hours re-entered twice a year.

Risk management runs on three layers. Per-trade stop is the larger of 1.2 × ATR(14) and a 120-point hard floor, which on XAUUSD gives roughly a 0.6% stop on a $5,000 account at 0.1 lot. Take-profit is a flat 160 points (1:1.33 RR against the ATR stop, 1:1.0 against the 120-point floor). On every tick the trailing-stop function pushes the SL to bid ± 1.2 × ATR(14) provided it is forward-only; the breakeven function lifts the SL to entry once profit exceeds 1.2 × ATR(14); the dynamic lock-profit function then takes over, stepping the SL forward by LockProfitEvery_X_Dollars = $2 each time unrealized P&L clears a $2 multiple, retaining a $1 buffer back from the entry-anchored profit level. A position is also closed outright the moment price crosses back through the Gaussian line in the opposite direction — the mean-revert exit that complements the breakout entry. The reverse-direction exit runs through CloseOpposite, which calls TryClose_EX17018 with a 3-attempt / 200 ms sleep scaffold, the same retry pattern TryModify_EX17018 uses for any SL/TP adjustment.

Trade-slot control is also layered. MaxOpenTrades is 5 by default. With AllowOnlyProfitableAdditions enabled, an additional entry is only allowed when every existing position on the symbol has at least MinProfitPerTradeToAdd ($5) of unrealized profit, which prevents the EA from averaging into a losing grid. CheckMaxDrawdown runs first on every tick and refuses to act if the account is already down MaxDrawdownPercent (10%). OneTradeOnly is available as a single-position override.

The EA is configured for a $100 minimum deposit and is intended to be portable across FX majors and metals. The default lot of 0.1 with the 120-point SL implies a 0.6% risk on a 2,000 USD account, which gives traders enough room for the five-position maximum to coexist during a trending session without immediately breaching the 10% drawdown gate. Backtests on XAUUSD M5 will reflect the session bias most clearly: profitable setups cluster in the London and New York overlaps, and the Asian session produces almost no signals unless TradeAsian is flipped on. Setups during major news events are filtered out naturally by the volatility cap, but traders who want stricter control can lower MaxVolatilityThreshold toward 2.0.

There is no on-chart dashboard, no partial-close scaling, and no basket-profit lock. The close logic is binary: hard SL, hard TP, Gaussian-line cross, or trailing ratchet. That limited action surface is what makes the strategy auditable — every exit traces back to one of four functions (TrailingStop, Breakeven, DynamicLockProfit, or the implicit cross) and every entry has to clear nine separate boolean gates. If you need an EA that prints a panel, sends Telegram alerts, or compounds position size on a martingale ladder, this is not it. If you need a rule-bound Gaussian-band breakout that will sit on the sidelines when the four oscillators disagree, EX17018 fits.

Strategy Deep Dive

On every tick EX17018 first runs CheckMaxDrawdown — if the account is down 10% the EA stands down. It then pulls the Gaussian mid-line (a 10-period EMA on close) and the 14-period ATR, computes upper and lower bands at 0.85 × ATR distance, and pulls the H4 EMA-50 as a higher-timeframe side filter. The IsActiveSession function uses the broker GMT offset plus EU/US DST lookups to decide whether the current moment falls inside the configured London and New York windows (Asian trading is off by default). The volatility filter rejects bars where the ATR ratio is below 1.1 or above 3.0, the slope filter rejects flat Gaussians under 2 points, the candle filter rejects bars whose body is under 70% of range or whose range is under 0.8 × ATR, and the four auxiliary oscillators (TEMA 14, KAMA 10/2/30, T3 14 with volume factor 0.7, ZLEMA 14) each independently require a per-bar slope above their configured point floor. Only when all gates agree does the entry path check for the two-bar-inside-then-outside band break, the H4 side, the S/R distance, and the breakout-quality test. Once a position is open the same tick-loop runs the trailing ratchet, the breakeven lift, the $2-step dynamic lock-profit, and the Gaussian-line cross exit, all routed through the TryClose_EX17018 / TryModify_EX17018 3-retry scaffold.

Entry Signal

A buy entry requires price to close above the upper Gaussian band (10-EMA close + 0.85 × ATR(14)) while the previous two bars closed below it, price above the H4 EMA-50, the break extending at least 0.3 ATR beyond the band, the candle body filling ≥70% of its range, total range ≥0.8 ATR, the position not within 30 points of a recent 20-bar swing high, and all four auxiliary oscillators (TEMA 14, KAMA 10, T3 14, ZLEMA 14) each showing slope above their per-oscillator point thresholds. A sell entry mirrors this against the lower band and the H4 EMA-50 from below.

Exit Signal

Open positions are closed by any of four mechanisms: hitting the fixed 160-point take-profit; hitting the per-trade stop (max of 1.2 × ATR(14) and 120 points); the trailing-stop ratchet pushing the SL to bid ± 1.2 × ATR(14) as price moves in favor; the breakeven function lifting the SL to entry once profit clears 1.2 × ATR(14); the dynamic lock-profit function stepping the SL forward by $2 for every $2 of unrealized profit (minus a $1 buffer); or price crossing back through the Gaussian EMA in the opposite direction, which triggers CloseOpposite.

Stop Loss

Per-trade stop loss is the larger of 1.2 × ATR(14) and a 120-point hard floor (whichever is greater). The stop is then actively managed by a forward-only trailing ratchet at 1.2 × ATR(14) distance, an early breakeven move to entry once profit clears 1.2 × ATR(14), and a dynamic lock-profit that steps SL forward in $2 increments with a $1 buffer. Account-level hard cap is a 10% drawdown gate checked on every tick.

Take Profit

Take-profit is a flat 160 points on every order, applied symmetrically to buys and sells (ask + 160pt for buy, bid − 160pt for sell). At the default 0.85 DistanceMultiplier and 14-period ATR, this implies roughly 1:1.0 RR against the 120-point SL floor and slightly above 1:1 RR against the dynamic ATR stop, with the dynamic lock-profit and Gaussian-cross exits providing the typical early-exit path.

Best For

XAUUSD on M5 is the canonical deployment: $100 minimum deposit, 0.1 lot, the H4 EMA-50 side filter wired to gold's day-session rhythm, and 5-position cap sized to fit a 10% drawdown gate. The session filter is London + New York (Asian off by default) with automatic DST handling, so the EA prints signals during the actual liquidity windows without manual clock adjustment twice a year. Use a low-spread broker with reliable execution on XAUUSD because the 120-point SL floor plus 160-point TP gives roughly a 1:1 RR against the floor and the dynamic ATR stop shrinks that further on quiet days — slippage on the entry is the main cost. The MEDIUM risk label reflects 0.1 lot on a $1,000 account producing about 0.6% per-trade risk at the 120-point floor, which most retail prop-firm and standard retail setups can absorb.

Strategy Logic

Pipsgrowth EX17018 Volatility — Strategy Logic Analysis (from .mq5 source)

Family: Volatility Magic: 22217018 Version: 2.00

BRIEF: Volatility Gaussian Bands EA with adaptive breakout, enhanced candle/volatility/slope filters, session control, S/R levels, TEMA/ZLEMA/KAMA/T3 trend confirmation. 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()
  • PositionExists()
  • CloseOpposite()
  • AutoTuneFilters()
  • CheckMaxDrawdown()
  • IsNewBar()
  • ...and 10 more

INTERNAL CONSTANTS (0 total):

INPUT PARAMETERS (42 total across 9 groups):

  • [=== General Settings ===] Timeframe = 0 // Timeframe (1=M1,2=M5,3=M15,4=M30,5=H1,6=H4,7=D1)
  • [=== General Settings ===] TrendFilterTF = 6 // Timeframe (1=M1,2=M5,3=M15,4=M30,5=H1,6=H4,7=D1)
  • [=== General Settings ===] MaxDrawdownPercent = 10.0 // Max drawdown % allowed
  • [=== General Settings ===] MaxOpenTrades = 5 // Maximum allowed open trades at the same time
  • [=== General Settings ===] AllowOnlyProfitableAdditions = true // Enable filter
  • [=== General Settings ===] MinProfitPerTradeToAdd = 5.0 // Minimum $ profit required per existing trade
  • [=== General Settings ===] LockProfitEvery_X_Dollars = 2.0 // Step: every $6 profit
  • [=== General Settings ===] LockMinusBuffer = 1.0 // Lock profit minus $1 buffer
  • [=== Identity ===] InpTradeComment = "Psgrowth.com Expert_17018" // Trade comment for orders
  • [=== Enhanced Filters ===] UseSlopeFilter = true // Enable slope confirmation
  • [=== Enhanced Filters ===] MinSlopePoints = 2.0 // Minimum slope in points for confirmation
  • [=== Enhanced Filters ===] UseEnhancedCandleFilter = true // Enable enhanced candle detection
  • [=== Enhanced Filters ===] MinBodyRatio = 0.7 // Minimum body/candle ratio (0.6 = 60%)
  • [=== Enhanced Filters ===] MinCandleSizeATR = 0.8 // Minimum candle size vs ATR (0.8 = 80% of ATR)
  • [=== Enhanced Filters ===] UseVolatilityFilter = true // Enable volatility filtering
  • [=== Enhanced Filters ===] MinVolatilityIncrease = 1.1 // ATR must be X times previous ATR
  • [=== Enhanced Filters ===] MaxVolatilityThreshold = 3.0 // Avoid extreme volatility spikes
  • [=== Session Filter ===] UseSessionFilter = true // Enable market session filtering
  • [=== Session Filter ===] TradeLondon = true // Trade during London session
  • [=== Session Filter ===] TradeNewYork = true // Trade during New York session
  • [=== Session Filter ===] TradeAsian = false // Trade during Asian session
  • [=== Session Filter ===] AutoDetectBrokerTZ = true // Auto-detect broker timezone
  • [=== Session Filter ===] ManualBrokerOffset = 0 // Manual GMT offset if auto-detect fails
  • [=== Support/Resistance Filter ===] UseSRFilter = true // Enable Support/Resistance filter
  • [=== Support/Resistance Filter ===] SR_LookbackPeriod = 20 // Bars to look back for S/R levels
  • [=== Support/Resistance Filter ===] SR_MinDistance = 30.0 // Minimum distance from S/R (points)
  • [=== Support/Resistance Filter ===] SR_TouchSensitivity = 5.0 // How close price can get to S/R (points)
  • [=== TEMA Confirmation ===] UseTEMAConfirmation = true // Enable TEMA trend confirmation
  • [=== TEMA Confirmation ===] TEMA_Period = 14 // TEMA period (faster response)
  • [=== TEMA Confirmation ===] TEMA_MinSlopePoints = 1.0 // Minimum TEMA slope for confirmation
  • [=== ZLEMA Confirmation ===] ZLEMA_Period = 14 // ZLEMA period (faster response)
  • [=== ZLEMA Confirmation ===] UseZLEMAConfirmation = true // Enable ZLEMA trend confirmation
  • [=== ZLEMA Confirmation ===] ZLEMA_MinSlopePoints = 0.8 // Minimum ZLEMA slope
  • [=== KAMA Confirmation ===] UseKAMAConfirmation = true // Enable KAMA adaptive confirmation
  • [=== KAMA Confirmation ===] KAMA_Period = 10 // KAMA efficiency period
  • [=== KAMA Confirmation ===] KAMA_FastSC = 2 // Fast smoothing constant
  • [=== KAMA Confirmation ===] KAMA_SlowSC = 30 // Slow smoothing constant
  • [=== KAMA Confirmation ===] KAMA_MinSlopePoints = 1.2 // Minimum KAMA slope
  • [=== T3 Confirmation ===] UseT3Confirmation = true // Enable T3 trend confirmation
  • [=== T3 Confirmation ===] T3_Period = 14 // T3 period
  • [=== T3 Confirmation ===] T3_VolumeFactor = 0.7 // T3 volume factor (0.0-1.0)
  • [=== T3 Confirmation ===] T3_MinSlopePoints = 1.1 // Minimum T3 slope for confirmation
Pseudocode
// Pipsgrowth EX17018 Volatility — Execution Flow (from source analysis)
// Family: Volatility
// Volatility Gaussian Bands EA with adaptive breakout, enhanced candle/volatility/slope filters, session control, S/R levels, TEMA/ZLEMA/KAMA/T3 trend confirmation. 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
InpTradeComment"Psgrowth.com Expert_17018"Trade comment for orders
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
Source Code (.mq5)Open Source
Pipsgrowth_com_EX17018.mq5
#property copyright "Pipsgrowth.com"
#property link      "https://pipsgrowth.com"
#property version   "2.00"
#property strict
#property description "Pipsgrowth.com EX17018 GB100 — Volatility Gaussian Bands EA with multi-filter confirmation, 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 "=== General 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 bool   EnableDynamicLockProfit = true;
input double LockProfitEvery_X_Dollars = 2.0;   // Step: every $6 profit
input double LockMinusBuffer          = 1.0;    // Lock profit minus $1 buffer

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;

Full source code available on download

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

Tags:ex17018volatilitypipsgrowthfreemt5xauusd

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