Pipsgrowth EX16034 Trend
MT5 Expert Advisor (Open Source) · XAUUSD · M1, H1
Pipsgrowth.com EX16034 EX_X2_XAUUSD_v1_1 — dual-entry dual-confirm XAU scalper, full 12-layer stack.
Overview
Pipsgrowth EX16034 Trend is a four-signal consensus scalper for XAUUSD on the M1 timeframe. The entire strategy is a vote: two entry indicators and two confirmation indicators must all light up inside a sliding six-bar window before any order is sent. The vote is binary (long or short), and the side with the freshest signals wins. The four indicator slots are user-configurable — defaults are a 9/50 EMA cross for entry-one, an RSI(14) 55/45 threshold cross for entry-two, a 12/26/9 MACD main/signal cross for confirmation-one, and a 14/3/3 Stochastic %K/%D cross for confirmation-two — but each of the four slots can be swapped independently to any of five engine types (MA cross, RSI threshold, MACD cross, Stochastic cross, CCI threshold), which lets the operator turn the EA into a completely different consensus tool without editing code.
The core of the EA lives in CombinedWindowCheck(). For each side (buy, sell), it walks the last six closed bars and asks each of the four signal slots whether it fired on bar shift=1 through shift=6. There is a non-strict mode (the four signals may fire on different bars inside the window) and a strict-same-bar mode (InpRequireEntriesSameBar and InpRequireConfirmsSameBar — if either is true, the two entries must fire on the same bar inside the window, and the two confirms must also fire on the same bar). When both entry and both confirm votes come back positive, the function picks the bar shift closest to the current bar among all four firing shifts, and that is the "freshness" stamp. If both a buy and a sell consensus are valid at the same time, the side with the smaller shift wins, and the other is discarded.
The signature feature of EX16034 is the Dynamic Lock Profit ratchet implemented in ApplyDynamicLockProfitToPosition(). After every position is opened, the EA walks PositionsTotal() on every tick through MaintainPositions() and computes movedPts = (bid - entryPrice) / _Point for longs (mirror for shorts). Once the position has moved 150 points in profit, the function calculates steps = floor(movedPts / 150), then sets the new stop to entryPrice + (steps * 150 - 20) * _Point. The result is a staircase ratchet that only tightens — never widens — and steps up by 130 points of locked profit (150 minus the 20-point buffer) every 150 points of additional favorable movement. The ratchet respects the broker's SYMBOL_TRADE_FREEZE_LEVEL and skips updates that would push the stop too close to bid/ask, so it never trips a freeze-rejection on a gold symbol with a wide freeze.
Before any entry is taken, CanPlaceNewEntries() runs seven gates in sequence: pause-window check (set by OnTradeTransaction when the loss streak or daily PnL triggers), one-entry-per-bar (g_lastEntryBarTime must differ from the current bar time), session window (default London 07:00–17:00 and New York 13:00–22:00 server time, gated through IsWithinSessions()), spread cap (a dynamic median computed over the last 200 ticks times a 3x multiplier, plus an optional absolute cap), max-open count (5), volatility filter (a 14-period ATR floor of 80 points, off by default), bar quality (the previous bar's body-to-range ratio must exceed 0.20 if enabled), and daily guards (loss/profit/trade-count targets, off by default). Any one of these failing suppresses the entry.
The EA also layers a higher-timeframe trend filter on top of the consensus. If InpUseMTFTrendFilter is true, TrendFilterOK() reads a 200-period EMA on a user-selected higher timeframe (default M30) and only allows buy consensus if price is at or above the EMA, only allows sell consensus if price is at or below it. This single line is the difference between running EX16034 as a pure scalper and running it as a trend-aligned scalper. A second optional pause-guard layer, implemented inside OnTradeTransaction(), watches every closed deal through the deal-history: a DEAL_TRANSACTION_DEAL_ADD whose DEAL_ENTRY is DEAL_ENTRY_OUT updates g_lossStreakCount and g_lossStreakAmt. If PauseOnConsecutiveLosses is true and the streak reaches 3, trading is paused for 60 minutes; if PauseOnLossAmount is true and the cumulative loss reaches 100 account currency, trading is paused for 60 minutes. Any win or breakeven reset clears both counters.
Position management is split into initial and addition. The first order in a direction is tagged Initial BUY or Initial SELL in the comment; subsequent orders are tagged Add#1 BUY, Add#2 BUY, etc. By default, additions are blocked unless AllowOnlyProfitableAdditions is true AND every existing same-direction position is currently at least MinProfitPerTradeToAdd (5 points) in the green. The cap is MaxOpenTrades total positions across both directions, and the per-direction cooldown (InpCooldownSecondsDir = 20 by default) blocks a second entry in the same direction for 20 seconds after the previous one. These two constraints together mean a single news spike cannot open five positions back-to-back.
Risk and stop placement default to fixed 300-point stop and 600-point take-profit (1:2 risk-reward, sized to XAUUSD's M1 volatility envelope). If InpUseATRforSLTP is switched on, CalcSLTP() overrides the fixed points with atrPts * 3.0 for the stop and atrPts * 6.0 for the target, computed from a 14-period ATR on the signals timeframe — which keeps the SL/TP breathing with the volatility regime. Lot size is fixed at 0.10 with no money-management modules. The 3-attempt retry helpers TryClose_EX16034, TryClosePartial_EX16034, and TryModify_EX16034 are defined for the standard CTrade wrapper but the runtime uses direct request objects through SendOrder(), ModifyPositionSLTP(), and ClosePositionByTicket() — the retry helpers are dead code in the current build.
What to expect in a backtest: a one-minute XAUUSD chart during the London/New York overlap should produce a steady stream of small wins cut short by the 600-point TP and a smaller but consistent stream of 300-point stops. The ratchet rarely fires intrabar on M1 XAUUSD because gold's 30-pip M1 average true range cannot generate 150 points of profit on a single bar — it tends to step in over a few hours during a trending session. The MTF trend filter, when enabled, is the single biggest change to equity-curve character: it converts the EA from a coin-flip on choppy London opens to a directional follower that skips counter-trend signals on H1 or M30.
EX16034 is not a martingale or grid EA. There is no recovery multiplier, no basket averaging, no lot escalation after a loss. The five-trade cap is a hard cap. If you want a 20-position gold grid, this is not the EA; if you want a four-signal vote with a step-ratcheted stop, this is it.
Strategy Deep Dive
EX16034 is a four-vote consensus scalper — CombinedWindowCheck() walks the last six closed bars and only fires when a 9/50 EMA cross, an RSI(14) 55/45 cross, a 12/26/9 MACD main/signal cross, and a 14/3/3 Stochastic %K/%D cross all show the same direction inside the window. Each of the four slots is pluggable to any of five engine types (MA cross, RSI threshold, MACD cross, Stochastic cross, CCI threshold) through the InpEntry1Type / InpEntry2Type / InpConfirm1Type / InpConfirm2Type enums, and the strict-same-bar toggles InpRequireEntriesSameBar and InpRequireConfirmsSameBar can force the two entries (or the two confirms) to fire on the same bar inside the window. The Dynamic Lock Profit ratchet in ApplyDynamicLockProfitToPosition() is the signature: every 150 points of favorable movement, the stop steps to entry + steps*150 - 20 points, never widening, never crossing the broker's SYMBOL_TRADE_FREEZE_LEVEL. OnTradeTransaction() tracks DEAL_ENTRY_OUT deals to maintain g_lossStreakCount and g_lossStreakAmt, and pauses trading for 60 minutes when the streak hits the configured threshold or the cumulative loss hits the configured amount. CanPlaceNewEntries() chains seven gates — pause window, one-entry-per-bar, session, dynamic spread median, max-open count, ATR volatility floor, bar quality — and any one failure suppresses the entry. SendOrder() itself runs a 3-attempt retry on INVALID_STOPS and REQUOTE, dropping SL/TP on retry if the broker rejects the stops. Initial trades are tagged Initial BUY/SELL; additions become Add#1 BUY, Add#2 BUY, etc., capped at MaxOpenTrades total and gated by AllowOnlyProfitableAdditions.
Four-signal consensus inside a six-bar window: a 9/50 EMA cross and an RSI(14) 55/45 threshold cross for the two entry votes, plus a 12/26/9 MACD main/signal cross and a 14/3/3 Stochastic %K/%D cross for the two confirmation votes. All four must fire on bars shift 1 through 6 (or the same bar in strict mode), and the side with the freshest signals wins. A higher-timeframe 200-EMA filter can optionally block counter-trend entries.
Exit on the fixed 600-point take-profit (or 6× ATR if InpUseATRforSLTP is enabled), the fixed 300-point stop, or the Dynamic Lock Profit ratchet stepping the stop every 150 points of additional profit. There is no signal-based exit — once a position is open, it is closed by the SL/TP/ratchet combination only.
Fixed 300-point stop (or 3× ATR when InpUseATRforSLTP=true). The Dynamic Lock Profit ratchet then steps the stop every 150 points of favorable movement, holding the stop 20 points back from the running high/low, so once a position moves 300+ points the actual live stop is almost always inside the entry price.
Fixed 600-point take-profit (or 6× ATR when ATR mode is on) — a 1:2 risk-to-reward against the 300-point stop. Additions are allowed up to MaxOpenTrades (5 default) but only when the existing same-direction position is already at least 5 points in the green.
XAUUSD on M1 with $100 minimum (recommend $500+ for the 5-position addition path). Run during the London 07:00–17:00 and New York 13:00–22:00 server-time windows — outside these hours IsWithinSessions() blocks entries by default. The dynamic spread cap means an ECN or RAW-spread broker is required (IC Markets or Exness are typical fits); a 3-pip fixed-spread account will keep tripping the median cap and the EA will sit idle. MEDIUM risk profile assumes the 0.10 fixed lot and 1:2 fixed TP/SL defaults — switch to ATR-based SL/TP (3×/6×) for high-volatility gold sessions, and enable the M30 200-EMA trend filter when running through a non-trending day.
Strategy Logic
Pipsgrowth EX16034 Trend — Strategy Logic Analysis (from .mq5 source)
Family: Trend
Magic: 22216034
Version: 2.00
BRIEF:
XAU M1 scalper using dual-entry signals (EMA cross + RSI threshold) with dual confirmations (MACD + Stochastic) within an X-bar window. Dynamic Lock Profit ratchet, initial/addition trade management, session and spread filters. 12 layers: REGIME, SIGNAL, ENTRY, CONFIRM, NO-TRADE, CAPITAL CAP, RISK, SIZING, MANAGE, EXIT, SCALING, OnTester
INDICATOR STACK:
- Standard
MT5indicators
KEY FUNCTIONS:
DirStr()TickSize()TickValue()NormalizePriceToTick()NormalizeVol()IsWithinSessions()CurrentSpreadPoints()SpreadBufPush()MedianSpread()CheckSpreadOK()OwnsPositionByTicket()CountOpenPositionsAll()- ...and 44 more
INTERNAL CONSTANTS (0 total):
INPUT PARAMETERS (73 total across 15 groups):
- [===
CORESETTINGS===]MagicNumber=22216034// MagicNumber(uniqueEAidentifier) - [===
CORESETTINGS===]InpTradeComment= "Psgrowth.com Expert_16034" // TradeComment - [===
DYNAMICLOCKPROFIT===]InpEnableDynamicLockProfit=true// Enable Dynamic Lock Profit System - [===
DYNAMICLOCKPROFIT===]InpLockProfitEveryXPoints= 150 // Lock Profit Every X Points - [===
DYNAMICLOCKPROFIT===]InpLockMinusYPointsBuffer= 20 // LockBuffer(points back from high) - [===
TRADEMANAGEMENT===]MaxOpenTrades= 5 // Maximum Open Trades - [===
TRADEMANAGEMENT===]AllowOnlyProfitableAdditions=true// Allow Only Profitable Additions - [===
TRADEMANAGEMENT===]MinProfitPerTradeToAdd=5.0// Min Profit Per Trade toAdd(points) - [===
PAUSEGUARDS===]PauseOnConsecutiveLosses=false// Pause After Consecutive Losses - [===
PAUSEGUARDS===]PauseConsecutiveLossesCount= 3 // Consecutive Losses Count Trigger - [===
PAUSEGUARDS===]PauseConsecutiveLossesMinutes= 60 // PauseDuration(minutes) - [===
PAUSEGUARDS===]PauseOnLossAmount=false// Pause After Loss Amount - [===
PAUSEGUARDS===]PauseLossAmount=100.0// Loss AmountTrigger(account currency) - [===
PAUSEGUARDS===]PauseLossAmountMinutes= 60 // Loss PauseDuration(minutes) - [===
RISK&MONEYMANAGEMENT===]InpFixedLot=0.10// Fixed Lot Size - [===
RISK&MONEYMANAGEMENT===]InpUseATRforSLTP=false// UseATRfor SL/TP Calculation - [===
RISK&MONEYMANAGEMENT===]InpATRPeriod= 14 //ATRPeriod - [===
RISK&MONEYMANAGEMENT===]InpATR_SL_Mult=3.0//ATRStop Loss Multiplier - [===
RISK&MONEYMANAGEMENT===]InpATR_TP_Mult=6.0//ATRTake Profit Multiplier - [===
RISK&MONEYMANAGEMENT===]InpSL_Points= 300 // StopLoss(points) - [===
RISK&MONEYMANAGEMENT===]InpTP_Points= 600 // TakeProfit(points) - [===
RISK&MONEYMANAGEMENT===]InpSlippagePoints= 5 // MaximumSlippage(points) - [===
SPREAD&SESSIONCONTROL===]InpUseDynamicSpreadCap=true// Enable Dynamic Spread Cap - [===
SPREAD&SESSIONCONTROL===]InpSpreadLookbackTicks= 200 // Spread Lookback Ticks - [===
SPREAD&SESSIONCONTROL===]InpSpreadMedianMult=3.0// Spread Median Multiplier - [===
SPREAD&SESSIONCONTROL===]InpSpreadCapAbsPoints= 0 // Absolute SpreadCap(0=disabled) - [===
SPREAD&SESSIONCONTROL===]InpUseSessions=true// Enable Session Filter - [===
SPREAD&SESSIONCONTROL===]InpSession1StartHH= 7 // Session 1 StartHour(London) - [===
SPREAD&SESSIONCONTROL===]InpSession1EndHH= 17 // Session 1 End Hour - [===
SPREAD&SESSIONCONTROL===]InpSession2StartHH= 13 // Session 2 StartHour(New York) - [===
SPREAD&SESSIONCONTROL===]InpSession2EndHH= 22 // Session 2 End Hour - [===
SPREAD&SESSIONCONTROL===]InpOneEntryPerBar=true// One Entry Per Bar Only - [===
SIGNALWINDOWSETTINGS===]InpEntryWindowBars= 6 // EntryWindow(bars for all signals) - [===
SIGNALWINDOWSETTINGS===]InpRequireEntriesSameBar=false// Require Both Entries Same Bar - [===
SIGNALWINDOWSETTINGS===]InpRequireConfirmsSameBar=false// Require Both Confirmations Same Bar - [===
SIGNALWINDOWSETTINGS===]InpSignalsTF= 1 //Timeframe(1=M1,2=M5,3=M15,4=M30,5=H1,6=H4,7=D1) // Signals Timeframe - [===
ENTRYSIGNALSELECTION===]InpEntry1Type=SIG_MA_CROSS// Entry Signal 1 Type - [===
ENTRYSIGNALSELECTION===]InpEntry2Type=SIG_RSI_THRESH// Entry Signal 2 Type - [===
CONFIRMATIONSIGNALSELECTION===]InpConfirm1Type=SIG_MACD_CROSS// Confirmation Signal 1 Type - [===
CONFIRMATIONSIGNALSELECTION===]InpConfirm2Type=SIG_STOCH_CROSS// Confirmation Signal 2 Type - [===
MOVINGAVERAGESETTINGS===]InpMAFastPeriod= 9 // Fast MA Period - [===
MOVINGAVERAGESETTINGS===]InpMASlowPeriod= 50 // Slow MA Period - [===
MOVINGAVERAGESETTINGS===]InpMAMethod=MODE_EMA// MA Method - [===
MOVINGAVERAGESETTINGS===]InpMAPrice= 1 // Applied price (1=close,2=open,3=high,4=low,5=median,6=typical,7=weighted) // MA Applied Price - [===
RSISETTINGS===]InpRSIPeriod= 14 //RSIPeriod - [===
RSISETTINGS===]InpRSI_BuyLevel=55.0//RSIBuyLevel(cross above) - [===
RSISETTINGS===]InpRSI_SellLevel=45.0//RSISellLevel(cross below) - [===
MACDSETTINGS===]InpMACD_FastEMA= 12 //MACDFastEMAPeriod - [===
MACDSETTINGS===]InpMACD_SlowEMA= 26 //MACDSlowEMAPeriod - [===
MACDSETTINGS===]InpMACD_Signal= 9 //MACDSignal Period - [===
STOCHASTICSETTINGS===]InpStoch_K= 14 // Stochastic %K Period - [===
STOCHASTICSETTINGS===]InpStoch_D= 3 // Stochastic %D Period - [===
STOCHASTICSETTINGS===]InpStoch_Slowing= 3 // Stochastic Slowing - [===
STOCHASTICSETTINGS===]InpStoch_LowLvl= 20 // Stochastic LowLevel(buy filter) - [===
STOCHASTICSETTINGS===]InpStoch_HiLvl= 80 // Stochastic HighLevel(sell filter) - [===
CCISETTINGS===]InpCCIPeriod= 20 //CCIPeriod - [===
CCISETTINGS===]InpCCI_BuyLevel=100.0//CCIBuyLevel(cross above) - [===
CCISETTINGS===]InpCCI_SellLevel= -100.0//CCISellLevel(cross below) - [===
ADVANCEDFILTERS===]InpUseATRVolFilter=false// EnableATR-based volatility filter - [===
ADVANCEDFILTERS===]InpATRVolPeriod= 14 //ATRperiod for volatility filter - [===
ADVANCEDFILTERS===]InpMinATRPoints= 80 // MinATR(points) to allow trading (0=off) - [===
ADVANCEDFILTERS===]InpMaxATRPoints= 0 // MaxATR(points) (0=off / unlimited) - [===
ADVANCEDFILTERS===]InpUseMTFTrendFilter=false// Enable higher timeframeEMAtrend alignment - [===
ADVANCEDFILTERS===]InpMTFTrendTF= 4 //Timeframe(1=M1,2=M5,3=M15,4=M30,5=H1,6=H4,7=D1) // Higher timeframe for trend - [===
ADVANCEDFILTERS===]InpMTF_EMA_Period= 200 //MTFEMAperiod - [===
ADVANCEDFILTERS===]InpUseBarQuality=false// Enable bar quality filter (avoid tiny / extreme bars) - [===
ADVANCEDFILTERS===]InpMinBodyToRange=0.20// Minimum body/range ratio (0.0..1.0) - [===
ADVANCEDFILTERS===]InpMaxRangePoints= 0 // Max bar range in points (0=off) - [===
ADVANCEDFILTERS===]InpCooldownSecondsDir= 20 // Cooldown seconds per direction (0=off) - [===
ADVANCEDFILTERS===]InpUseDailyStops=false// Enable daily profit/loss & trade count stops - [===
ADVANCEDFILTERS===]InpDailyLossStop=0.0// Daily loss stop (account currency, 0=off) - [===
ADVANCEDFILTERS===]InpDailyProfitStop=0.0// Daily profit target (0=off) - [===
ADVANCEDFILTERS===]InpMaxTradesPerDay= 0 // Max trades per day (0=unlimited)
// Pipsgrowth EX16034 Trend — Execution Flow (from source analysis)
// Family: Trend
// XAU M1 scalper using dual-entry signals (EMA cross + RSI threshold) with dual confirmations (MACD + Stochastic) within an X-bar window. Dynamic Lock Profit ratchet, initial/addition trade management, session and spread filters. 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
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 | 22216034 | Magic Number (unique EA identifier) |
| InpTradeComment | "Psgrowth.com Expert_16034" | Trade Comment |
| InpEnableDynamicLockProfit | true | Enable Dynamic Lock Profit System |
| InpLockProfitEveryXPoints | 150 | Lock Profit Every X Points |
| InpLockMinusYPointsBuffer | 20 | Lock Buffer (points back from high) |
| MaxOpenTrades | 5 | Maximum Open Trades |
| AllowOnlyProfitableAdditions | true | Allow Only Profitable Additions |
| MinProfitPerTradeToAdd | 5.0 | Min Profit Per Trade to Add (points) |
| PauseOnConsecutiveLosses | false | Pause After Consecutive Losses |
| PauseConsecutiveLossesCount | 3 | Consecutive Losses Count Trigger |
| PauseConsecutiveLossesMinutes | 60 | Pause Duration (minutes) |
| PauseOnLossAmount | false | Pause After Loss Amount |
| PauseLossAmount | 100.0 | Loss Amount Trigger (account currency) |
| PauseLossAmountMinutes | 60 | Loss Pause Duration (minutes) |
| InpFixedLot | 0.10 | Fixed Lot Size |
| InpUseATRforSLTP | false | Use ATR for SL/TP Calculation |
| InpATRPeriod | 14 | ATR Period |
| InpATR_SL_Mult | 3.0 | ATR Stop Loss Multiplier |
| InpATR_TP_Mult | 6.0 | ATR Take Profit Multiplier |
| InpSL_Points | 300 | Stop Loss (points) |
| InpTP_Points | 600 | Take Profit (points) |
| InpSlippagePoints | 5 | Maximum Slippage (points) |
| InpUseDynamicSpreadCap | true | Enable Dynamic Spread Cap |
| InpSpreadLookbackTicks | 200 | Spread Lookback Ticks |
| InpSpreadMedianMult | 3.0 | Spread Median Multiplier |
| InpSpreadCapAbsPoints | 0 | Absolute Spread Cap (0=disabled) |
| InpUseSessions | true | Enable Session Filter |
| InpSession1StartHH | 7 | Session 1 Start Hour (London) |
| InpSession1EndHH | 17 | Session 1 End Hour |
| InpSession2StartHH | 13 | Session 2 Start Hour (New York) |
| InpSession2EndHH | 22 | Session 2 End Hour |
| InpOneEntryPerBar | true | One Entry Per Bar Only |
| InpEntryWindowBars | 6 | Entry Window (bars for all signals) |
| InpRequireEntriesSameBar | false | Require Both Entries Same Bar |
| InpRequireConfirmsSameBar | false | Require Both Confirmations Same Bar |
| InpSignalsTF | 1 | Timeframe (1=M1,2=M5,3=M15,4=M30,5=H1,6=H4,7=D1) // Signals Timeframe |
| InpEntry1Type | SIG_MA_CROSS | Entry Signal 1 Type |
| InpEntry2Type | SIG_RSI_THRESH | Entry Signal 2 Type |
| InpConfirm1Type | SIG_MACD_CROSS | Confirmation Signal 1 Type |
| InpConfirm2Type | SIG_STOCH_CROSS | Confirmation Signal 2 Type |
| InpMAFastPeriod | 9 | Fast MA Period |
| InpMASlowPeriod | 50 | Slow MA Period |
| InpMAMethod | MODE_EMA | MA Method |
| InpMAPrice | 1 | Applied price (1=close,2=open,3=high,4=low,5=median,6=typical,7=weighted) // MA Applied Price |
| InpRSIPeriod | 14 | RSI Period |
| InpRSI_BuyLevel | 55.0 | RSI Buy Level (cross above) |
| InpRSI_SellLevel | 45.0 | RSI Sell Level (cross below) |
| InpMACD_FastEMA | 12 | MACD Fast EMA Period |
| InpMACD_SlowEMA | 26 | MACD Slow EMA Period |
| InpMACD_Signal | 9 | MACD Signal Period |
| InpStoch_K | 14 | Stochastic %K Period |
| InpStoch_D | 3 | Stochastic %D Period |
| InpStoch_Slowing | 3 | Stochastic Slowing |
| InpStoch_LowLvl | 20 | Stochastic Low Level (buy filter) |
| InpStoch_HiLvl | 80 | Stochastic High Level (sell filter) |
| InpCCIPeriod | 20 | CCI Period |
| InpCCI_BuyLevel | 100.0 | CCI Buy Level (cross above) |
| InpCCI_SellLevel | -100.0 | CCI Sell Level (cross below) |
| InpUseATRVolFilter | false | Enable ATR-based volatility filter |
| InpATRVolPeriod | 14 | ATR period for volatility filter |
| InpMinATRPoints | 80 | Min ATR (points) to allow trading (0=off) |
| InpMaxATRPoints | 0 | Max ATR (points) (0=off / unlimited) |
| InpUseMTFTrendFilter | false | Enable higher timeframe EMA trend alignment |
| InpMTFTrendTF | 4 | Timeframe (1=M1,2=M5,3=M15,4=M30,5=H1,6=H4,7=D1) // Higher timeframe for trend |
| InpMTF_EMA_Period | 200 | MTF EMA period |
| InpUseBarQuality | false | Enable bar quality filter (avoid tiny / extreme bars) |
| InpMinBodyToRange | 0.20 | Minimum body/range ratio (0.0..1.0) |
| InpMaxRangePoints | 0 | Max bar range in points (0=off) |
| InpCooldownSecondsDir | 20 | Cooldown seconds per direction (0=off) |
| InpUseDailyStops | false | Enable daily profit/loss & trade count stops |
| InpDailyLossStop | 0.0 | Daily loss stop (account currency, 0=off) |
| InpDailyProfitStop | 0.0 | Daily profit target (0=off) |
| InpMaxTradesPerDay | 0 | Max trades per day (0=unlimited) |
#property copyright "Pipsgrowth.com"
#property link "https://pipsgrowth.com"
#property version "2.00"
#property strict
#property description "Pipsgrowth.com EX16034 EX_X2_XAUUSD_v1_1 — dual-entry dual-confirm XAU scalper, full 12-layer stack."
#include <Trade\Trade.mqh>
//------------------------------ INPUTS: CORE ------------------------
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;
case 4: return PRICE_LOW;
case 5: return PRICE_MEDIAN;
case 6: return PRICE_TYPICAL;
case 7: return PRICE_WEIGHTED;
default: return PRICE_CLOSE;
}
}
ENUM_TIMEFRAMES g_InpSignalsTF = PERIOD_H1;
ENUM_TIMEFRAMES g_InpMTFTrendTF = PERIOD_H1;
ENUM_APPLIED_PRICE g_InpMAPrice = PRICE_CLOSE;
input group "=== CORE SETTINGS ==="
input int MagicNumber = 22216034; // Magic Number (unique EA identifier)
input string InpTradeComment = "Psgrowth.com Expert_16034"; // Trade Comment
//----------------- DYNAMIC LOCK PROFIT (step-ratchet) ---------------
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.
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.