Pipsgrowth EX16075 Trend
MT5 Expert Advisor (Open Source) · XAUUSD · M5
Pipsgrowth.com EX16075 Simple Gen — Gaussian Bands breakout with multi-filter confirmation, full 12-layer stack.
Overview
Pipsgrowth EX16075 Trend is a breakout EA that wraps price action around a Gaussian-smoothed midline and waits for a confirmed piercing move beyond the band. Rather than chasing fast M1 ticks or stacking indicators into a vote, it does one thing deliberately: it draws two ATR-width bands above and below a 10-period Gaussian filter on the working timeframe, then enters only when the close crosses outside the band on the same bar, with the band slope already pointing in the trade direction and a higher-timeframe EMA agreeing with the side. The result is a slower, more selective engine that prefers to miss a fast spike than to fade one.
The signal logic is built around a single indicator — an iMA(close, 0, MODE_EMA, 10) handle that the EA calls GaussianFilter() even though the underlying call is the standard EMA. The midline is what the EA actually treats as the noise-cleared price. Two bands are then placed at a fixed multiple of ATR(7): upper = gauss + 0.8 × ATR, lower = gauss − 0.8 × ATR. The DistanceMultiplier=0.8 input governs the band width. A long entry fires when close crosses above the upper band (close[0] > upper && close[1] < upper) AND the Gaussian slope is up (gauss[0] > gauss[1]) AND close[0] is above the H4 EMA(20) that the EA pulls via GetEMA_HTF(). The short side mirrors every condition. The MinBreakDistance=0.3 input is exposed but explicitly disabled in the OnTick code with a comment that the original extra distance check was removed — the band-cross is the only distance gate.
The higher-timeframe agreement is a meaningful design choice. The EA does not trust a band break by itself; it demands that the H4 EMA(20) sit on the correct side of price. That single filter is what turns the system from a generic Bollinger-band-piercing strategy into a directional breakout engine. It also explains why the default Timeframe input is 4 (M30): the bands are drawn on M30, the H4 EMA is sampled on a higher frame, and the EA waits for both to align. The TrendFilterTF input is exposed separately at 6 (H4) and is the timeframe from which the EMA is pulled, not the signal timeframe.
Filtering happens on three independent gates before any entry is considered. First, a volatility band gate: ATR(7) must be above MinATR=0.04 and below MaxATR=0.2 — a tiny ATR means the band is too narrow and breakouts are noise; a giant ATR means the band is so wide that almost any close crosses it. UseAutoFilter=true calls AutoTuneFilters() which scales MinATR to 1.5× the current spread in points, so the EA can adapt its dead-zone to the broker's spread regime. Second, a regime gate: with UseADXFilter=true, the ADX(7) main line must be at or above ADXTrendThreshold=20. A sub-20 ADX means price is ranging, and band breaks in a range revert. Third, a spread gate: a hard block at MaxSpreadPoints=12 — if the live spread is wider than 12 points, the EA prints a warning and refuses to enter on that tick. CheckMaxDrawdown() also runs on every tick and halts new entries once the open equity drawdown exceeds MaxDrawdownPercent=10%.
Position management is layered. The initial stop is ATR(7) × ATR_MultiplierSL=1.0 behind entry. The take-profit is a fixed FixedTP_Points=100 points. After the position is open, four management modules can intervene: (1) ExitOnGaussCross=true closes the trade the moment close crosses back across the Gaussian midline against the trade direction; (2) UseTrailingStop=true re-anchors the stop to ATR(7) × 1.0 behind the current bid/ask, but only forward — it never widens the stop; (3) UseBreakeven=true moves the stop to entry plus a 1-point slippage buffer once price has travelled 0.8×ATR in profit (BreakevenTriggerATR=0.8); (4) EnableDynamicLockProfit=false, when flipped on, ratchets the stop in $2 steps (LockProfitEvery_X_Dollars=2.0) with a $1 buffer (LockMinusBuffer=1.0), turning a $10 profit into roughly a $9 locked stop. Position sizing uses the standard equity-percent formula: lots = equity × 1% / (SL distance × value per point per lot), snapped to the symbol's volume step and clamped to volume min/max. UseFixedFractionalRisk=true with RiskPercent=1.0 is the default; the FixedLots=0.01 fallback fires only when risk calculation cannot produce a positive lot.
Trade management uses three local retry helpers — TryClose_EX16075, TryClosePartial_EX16075, and TryModify_EX16075 — each of which retries up to three times on requote, timeout, price-off, or price-changed, sleeping 100–200 ms between attempts. TryClosePartial_EX16075 is defined but never called from OnTick (it is dead code, present for future partial-close work). OneTradeOnly=true is the default; with MaxOpenTrades=1 the EA holds a single position per symbol. If the user sets MaxOpenTrades > 1, AllowOnlyProfitableAdditions gates new entries behind AllPositionsHaveMinProfit — every open position must show at least MinProfitPerTradeToAdd=$5 of profit before another layer is added. CloseOpposite() runs before every entry, so a flip in signal direction closes the existing trade and opens the new one in the same tick.
What to expect in backtest: the M30 signal bar combined with the H4 EMA filter is slow. On a quiet FX major or XAUUSD M5 chart, this EA will print a handful of trades a day, most of them in the direction of the dominant H4 trend. Band crosses that happen against the H4 EMA are filtered out silently, so the equity curve should be smoother than a pure band-piercing system but with more trades missed. The Gaussian-cross exit is a distinctive feature: it tends to close trades near the midline before the fixed 100-point TP is reached, which means the realised RR is usually below 1:1 — the trade is small and frequent, sized so that even sub-1R winners compound. Users who want longer holds should set ExitOnGaussCross=false and let the trail + fixed TP carry. AvoidNews=true is wired to a placeholder function that always returns false; the news filter is exposed in inputs but does nothing until the user implements a real calendar. For live deployment, a low-spread ECN broker is required because the spread gate at 12 points will block entries during wide-quote events on retail accounts.
Strategy Deep Dive
Each tick the EA reads four indicator handles — iMA(EMA, 10) as the Gaussian midline, iATR(7) for band width and sizing, iMA(EMA, 20) on the H4 timeframe for the trend filter, and iADX(7) for the regime gate. The OnTick flow gates first on three filters: ATR must sit between MinATR=0.04 and MaxATR=0.2, ADX must clear ADXTrendThreshold=20, and the live spread must not exceed 12 points. If all three pass, it computes the upper/lower bands as gauss ± 0.8 × ATR and watches for a single-bar band cross combined with a sloping Gaussian and agreement from the H4 EMA. The fixed-fractional lot is sized from the ATR-derived stop distance and 1% equity risk before the entry fires, and any open position is then re-evaluated against the Gaussian-cross exit, ATR trailing stop, breakeven trigger at 0.8 × ATR, and the optional $2-step dynamic profit lock. A new signal in the opposite direction closes the existing trade first and opens the reversal in the same tick.
Long entries fire when the close crosses above the upper Gaussian band (EMA(10) midline + 0.8 × ATR(7)) on the same bar, the Gaussian slope is rising (current value > previous), and the close sits above the H4 EMA(20) trend filter. Short entries mirror every condition with the lower band and a falling slope. The ADX(7) main line must be ≥ 20 to confirm a trending regime, ATR(7) must be between 0.04 and 0.20, and the live spread must be ≤ 12 points.
Positions exit on three triggers, in priority order: an immediate close when the close crosses back across the Gaussian midline against the trade direction (ExitOnGaussCross), the trailing-stop module ratcheting the stop to ATR(7) × 1.0 behind price (only forward, never widening), or the fixed 100-point take-profit. A signal in the opposite direction calls CloseOpposite() and reverses the position in the same tick.
Initial stop loss is ATR(7) × ATR_MultiplierSL=1.0 placed behind entry. After a profit of 0.8 × ATR(7) the stop ratchets to breakeven plus 1 point of slippage buffer. The trailing module then maintains the stop at ATR(7) × 1.0 behind the current bid/ask, only moving it forward.
Take profit is a fixed FixedTP_Points=100 points from entry on both sides. The Gaussian-cross exit often fires before the fixed TP, so realised reward-to-risk is typically below 1:1 — the strategy is sized for high win rate and compounding rather than large winners.
Best suited to a $100 minimum-balance account on a low-spread ECN broker running XAUUSD M5 (the recommended symbol in the source header) or any FX major that exhibits a clean H4 trend. The M30 signal timeframe combined with the H4 EMA filter means the strategy prefers directional, liquid sessions — London open through the New York close — and produces a handful of trades per day rather than dozens. MaxDrawdownPercent=10% and the 1% per-trade risk make this an MEDIUM-risk EA; users who want fewer, larger winners can disable ExitOnGaussCross and let the trail + fixed 100-point TP carry trades further.
Strategy Logic
Pipsgrowth EX16075 Trend — Strategy Logic Analysis (from .mq5 source)
Family: Trend
Magic: 22216075
Version: 2.00
BRIEF:
Volatility Gaussian Bands breakout EA with adaptive filters. Uses Gaussian-filter bands around price with ATR-based distance for breakout entry, confirmed by EMA trend, ATR volatility, and ADX regime filters. Includes ATR SL, fixed TP, trailing, BE, dynamic profit lock, and fixed-fractional risk sizing
INDICATOR STACK:
- Standard
MT5indicators
KEY FUNCTIONS:
GetBuffer()GaussianFilter()GetATR()GetEMA_HTF()GetADX()PositionExists()CloseOpposite()AutoTuneFilters()CheckMaxDrawdown()IsNearNewsEvent()CalculateLotSize()CountOpenTrades()- ...and 4 more
INTERNAL CONSTANTS (0 total):
INPUT PARAMETERS (34 total across 1 groups):
- []
MagicNumber=22216075// Magic number - [] Timeframe = 4 //
Timeframe(1=M1,2=M5,3=M15,4=M30,5=H1,6=H4,7=D1) // Chart timeframe for signals - [] Length = 10 // Gaussian Filter length
- []
DistanceMultiplier=0.8// Band distance multiplier (applied toATR) - []
MinBreakDistance=0.3// Min distance from band for entry (ATRmultiple) - []
UseAutoFilter=true// Auto-adjustMinATR/BreakDistance(basic) - []
TrendFilterTF= 6 //Timeframe(1=M1,2=M5,3=M15,4=M30,5=H1,6=H4,7=D1) // Timeframe for trendEMA - []
TrendEMA= 20 // Period for trendEMA - [] ATR_Period = 7 //
ATRcalculation period - []
MinATR=0.04// MinimumATRvalue to trade (in price units, e.g.,0.04forEURUSD) - []
MaxATR=0.2// MaximumATRvalue to trade (0 = disabled) - []
UseADXFilter=true// EnableADXtrend strength filter - [] ADXPeriod = 7 //
ADXcalculation period - [] ADXTrendThreshold = 20 // Minimum
ADXvalue to consider trending - []
OneTradeOnly=true// Allow only one trade open at a time per symbol - []
MaxOpenTrades= 1 // Maximum allowed open trades (ifOneTradeOnly=false) - []
AllowOnlyProfitableAdditions=false// IfMaxOpenTrades> 1, only add if existing trades are profitable - []
MinProfitPerTradeToAdd=5.0// Minimum $ profit required per existing trade to add more - [] ATR_MultiplierSL =
1.0//ATRmultiplier for initial Stop Loss - []
FixedTP_Points= 100 // Fixed Take Profit in points - []
UseTrailingStop=true// EnableATR-based trailing stop - []
UseBreakeven=true// Enable move SL to breakeven - []
BreakevenTriggerATR=0.8//ATRmultiple profit needed to trigger Breakeven - []
BreakevenSlippagePoints=1.0// Add points to BE price to cover slippage/spread - []
EnableDynamicLockProfit=false// Enable dynamic profit locking - []
LockProfitEvery_X_Dollars=2.0// Lock profit in steps of this amount ($) - []
LockMinusBuffer=1.0//Buffer($) subtracted from locked profit SL - []
UseFixedFractionalRisk=true// Use % risk calculation for lot size - []
RiskPercent=1.0// Risk % of equity per trade (ifUseFixedFractionalRisk=true) - []
FixedLots=0.01// Fixed lot size (ifUseFixedFractionalRisk=false) - []
MaxDrawdownPercent=10.0// Max account drawdown % allowed (stops new trades) - []
MaxSpreadPoints= 12 // Max allowed spread in points for entry (0 = disabled) - []
AvoidNews=true// Placeholder: Avoid trading around news - []
ExitOnGaussCross=true// Close trade if price crosses back over Gaussian filter
// Pipsgrowth EX16075 Trend — Execution Flow (from source analysis)
// Family: Trend
// Volatility Gaussian Bands breakout EA with adaptive filters. Uses Gaussian-filter bands around price with ATR-based distance for breakout entry, confirmed by EMA trend, ATR volatility, and ADX regime filters. Includes ATR SL, fixed TP, trailing, BE, dynamic profit lock, and fixed-fractional risk sizing
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
How to Install This EA on MT5
- 1Download the .mq5 file using the button above
- 2Open MetaTrader 5 on your computer
- 3Click File → Open Data Folder in the top menu
- 4Navigate to MQL5 → Experts and paste the .mq5 file there
- 5In MT5, right-click Expert Advisors in the Navigator panel → Refresh
- 6Drag the EA onto an H4 or Daily chart for best results
- 7Configure EMA periods, ADX threshold, and lot size in the dialog
- 8Enable Allow Algo Trading and click OK
EA Parameters
| Parameter | Default | Description |
|---|---|---|
| MagicNumber | 22216075 | Magic number |
| Timeframe | 4 | Timeframe (1=M1,2=M5,3=M15,4=M30,5=H1,6=H4,7=D1) // Chart timeframe for signals |
| Length | 10 | Gaussian Filter length |
| DistanceMultiplier | 0.8 | Band distance multiplier (applied to ATR) |
| MinBreakDistance | 0.3 | Min distance from band for entry (ATR multiple) |
| UseAutoFilter | true | Auto-adjust MinATR/BreakDistance (basic) |
| TrendFilterTF | 6 | Timeframe (1=M1,2=M5,3=M15,4=M30,5=H1,6=H4,7=D1) // Timeframe for trend EMA |
| TrendEMA | 20 | Period for trend EMA |
| ATR_Period | 7 | ATR calculation period |
| MinATR | 0.04 | Minimum ATR value to trade (in price units, e.g., 0.04 for EURUSD) |
| MaxATR | 0.2 | Maximum ATR value to trade (0 = disabled) |
| UseADXFilter | true | Enable ADX trend strength filter |
| ADXPeriod | 7 | ADX calculation period |
| ADXTrendThreshold | 20 | Minimum ADX value to consider trending |
| OneTradeOnly | true | Allow only one trade open at a time per symbol |
| MaxOpenTrades | 1 | Maximum allowed open trades (if OneTradeOnly=false) |
| AllowOnlyProfitableAdditions | false | If MaxOpenTrades > 1, only add if existing trades are profitable |
| MinProfitPerTradeToAdd | 5.0 | Minimum $ profit required per existing trade to add more |
| ATR_MultiplierSL | 1.0 | ATR multiplier for initial Stop Loss |
| FixedTP_Points | 100 | Fixed Take Profit in points |
| UseTrailingStop | true | Enable ATR-based trailing stop |
| UseBreakeven | true | Enable move SL to breakeven |
| BreakevenTriggerATR | 0.8 | ATR multiple profit needed to trigger Breakeven |
| BreakevenSlippagePoints | 1.0 | Add points to BE price to cover slippage/spread |
| EnableDynamicLockProfit | false | Enable dynamic profit locking |
| LockProfitEvery_X_Dollars | 2.0 | Lock profit in steps of this amount ($) |
| LockMinusBuffer | 1.0 | Buffer ($) subtracted from locked profit SL |
| UseFixedFractionalRisk | true | Use % risk calculation for lot size |
| RiskPercent | 1.0 | Risk % of equity per trade (if UseFixedFractionalRisk=true) |
| FixedLots | 0.01 | Fixed lot size (if UseFixedFractionalRisk=false) |
| MaxDrawdownPercent | 10.0 | Max account drawdown % allowed (stops new trades) |
| MaxSpreadPoints | 12 | Max allowed spread in points for entry (0 = disabled) |
| AvoidNews | true | Placeholder: Avoid trading around news |
| ExitOnGaussCross | true | Close trade if price crosses back over Gaussian filter |
#property copyright "Pipsgrowth.com"
#property link "https://pipsgrowth.com"
#property version "2.00"
#property strict
#property description "Pipsgrowth.com EX16075 Simple Gen — Gaussian Bands breakout with multi-filter confirmation, full 12-layer stack."
#include <Trade\Trade.mqh>
CTrade trade;
sinput const string GroupIdentity="";//=== Identity ===
input ulong MagicNumber = 22216075; // Magic number
input string InpTradeComment = "Psgrowth.com Expert_16075";
sinput const string GroupGeneral="";//=== General ===
input int Timeframe = 4; // Timeframe (1=M1,2=M5,3=M15,4=M30,5=H1,6=H4,7=D1) // Chart timeframe for signals
sinput const string GroupEntry="";//=== Entry Logic: Gaussian Bands ===
input int Length = 10; // Gaussian Filter length
input double DistanceMultiplier = 0.8; // Band distance multiplier (applied to ATR)
input double MinBreakDistance = 0.3; // Min distance from band for entry (ATR multiple)
input bool UseAutoFilter = true; // Auto-adjust MinATR/BreakDistance (basic)
sinput const string GroupTrend="";//=== Trend Filter ===
input int TrendFilterTF = 6; // Timeframe (1=M1,2=M5,3=M15,4=M30,5=H1,6=H4,7=D1) // Timeframe for trend EMA
input int TrendEMA = 20; // Period for trend EMA
sinput const string GroupVolatility="";//=== Volatility Filter (ATR) ===
input int ATR_Period = 7; // ATR calculation period
input double MinATR = 0.04; // Minimum ATR value to trade (in price units, e.g., 0.04 for EURUSD)
input double MaxATR = 0.2; // Maximum ATR value to trade (0 = disabled)
sinput const string GroupADX="";//=== Market Regime Filter (ADX) ===
input bool UseADXFilter = true; // Enable ADX trend strength filter
input int ADXPeriod = 7; // ADX calculation period
input double ADXTrendThreshold = 20; // Minimum ADX value to consider trending
sinput const string GroupTradeMgmt="";//=== Trade Management ===
input bool OneTradeOnly = true; // Allow only one trade open at a time per symbol
input int MaxOpenTrades = 1; // Maximum allowed open trades (if OneTradeOnly=false)
input bool AllowOnlyProfitableAdditions = false; // If MaxOpenTrades > 1, only add if existing trades are profitable
input double MinProfitPerTradeToAdd = 5.0; // Minimum $ profit required per existing trade to add more
sinput const string GroupSL="";//=== Stop Loss ===
input double ATR_MultiplierSL = 1.0; // ATR multiplier for initial Stop Loss
sinput const string GroupTP="";//=== Take Profit ===
input double FixedTP_Points = 100; // Fixed Take Profit in points
sinput const string GroupTrailing="";//=== Trailing Stop ===
input bool UseTrailingStop = true; // Enable ATR-based trailing stop
sinput const string GroupBreakeven="";//=== Breakeven ===
input bool UseBreakeven = true; // Enable move SL to breakeven
input double BreakevenTriggerATR = 0.8; // ATR multiple profit needed to trigger Breakeven
input double BreakevenSlippagePoints = 1.0; // Add points to BE price to cover slippage/spread
sinput const string GroupDynLock="";//=== Dynamic Profit Lock ===
input bool EnableDynamicLockProfit = false; // Enable dynamic profit locking
input double LockProfitEvery_X_Dollars = 2.0; // Lock profit in steps of this amount ($)
input double LockMinusBuffer = 1.0; // Buffer ($) subtracted from locked profit SL
sinput const string GroupRisk="";//=== Risk Management ===Full source code available on download
Educational purposes only. Do NOT use with real money. Test on demo accounts only.
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
Markets.com
Exness
IC Markets
Similar Expert Advisors
View All Expert AdvisorsMore Trend Following strategy EAs from our library
Pipsgrowth EX16080 Trend
Pipsgrowth.com EX16080 EURUSDTrendFollower — triple-EMA H4 trend follower, full 12-layer stack.
Pipsgrowth EX16081 Trend
Pipsgrowth.com EX16081 GoldTrendEA — XAUUSD H4 EMA cross with Fib targets, full 12-layer stack.
Pipsgrowth EX16033 Trend
Pipsgrowth.com EX16033 EA_Price_Action — price-action grid scalper, full 12-layer stack.
Community
Educational purposes only. Do NOT use with real money. Test on demo accounts only.