P
PipsGrowth
ScalpingOpen Source – Free

Pipsgrowth EX14004 Scalper

MT5 Expert Advisor (Open Source) · XAUUSD, GBPUSD · M5, H1

Pipsgrowth.com EX14004 XAU-GU Scalper — multi-symbol gold/GU scalper, full 12-layer stack.

Overview

Pipsgrowth EX14004 XAU-GU Scalper is a dual-symbol candle-pattern breakout EA built on the fxDreema visual block engine. The single MagicStart constant 22214004 anchors the identity, but inside the source the actual ticket magic is recomputed on every order as MagicStart plus a per-leg group offset — so the four trade directions carry distinct ticket tags: XAUUSD buys use 22214005, XAUUSD sells use 22214006, GBPUSD buys use 22214007, and GBPUSD sells use 22214008. That is what lets the same instance of the EA run both symbols on the same chart without the four order books colliding or one leg of the strategy accidentally flattening the other.

The strategy itself is a stripped-down candle-pattern engine. There is exactly one indicator input: a body-size threshold. The MDL_SignalBullCandle block (Block6 and Block15) opens a long when the close of the previous bar is above the open by at least MinBodySize, and the MDL_SignalBearCandle block (Block2 and Block11) opens a short when the open is above the close by at least MinBodySize. MinBodySize is mapped separately per symbol — the XAU leg uses XAU_Delta (100 by default, which works out to 100 points of XAUUSD, or $1.00 of price distance) and the GU leg uses GU_Delta (5 by default, which is 5 pips of GBPUSD). The thresholds are designed so that on a 5-minute chart the EA ignores doji-like noise candles and only fires on bars that have committed a real directional body. The MaxBodySize gate is left at 0.0, so there is no upper cap — a very long candle still qualifies.

A new-bar guard from the MDL_OncePerBar template (Block3, Block7, Block12, Block16) ensures each signal only fires once per bar. Internally that template stores a static token+timestamp pair per (symbol, period) combination and uses CopyTime to detect when the bar's open time has advanced. Until a new bar forms, the callback returns 0 (no entry) and the upstream MDL_Condition gate (Block8, Block17) compares the boolean constant true against the per-symbol trade flag — c::XAUUSD_Trade for gold, c::GBPUSD_Trade for sterling. If you flip either toggle to false in the inputs, the entire leg goes silent without changing the other leg's behaviour.

The execution path goes through MDL_BuyNow (Block4, Block13) and MDL_SellNow (Block5, Block14), which call into the BuyNow and SellNow wrappers that issue OrderCreate with the volume, SL, TP, slippage, magic, comment, and arrow colour. Volume is sized in balance mode via DynamicLots — (VolumePercent/100) × AccountBalance() / (LotSize × TickValue). For XAU the default XAU_Autolots = 1.0 resolves to roughly 1 percent of account balance per entry; for GU the default GU_Autolots = 1000 is interpreted as 1000 percent of balance divided by the contract size and tick value, which is the fxDreema convention for a heavy multi-lot GU sizing on a small account. The AlignLots wrapper snaps the result to the broker's lot step and clamps to min/max. Slippage is fixed at 4 points, magic at the per-leg group offset, and the comment is Psgrowth.com Expert_14004 — the same string for all four legs so they sort together in trade history.

Stop-loss and take-profit are hard-coded on the ticket. For XAU, XAU_SL = 500 and XAU_TP = 1500 (500 points of stop, 1500 points of target, a 1:3 risk-reward). For GU, GU_SL = 50 and GU_TP = 150 (50 pips of stop, 150 pips of target, the same 1:3 ratio at forex scale). The TP and SL are written into the order at OrderCreate time and remain anchored at those distances for the entire life of the trade — neither is re-priced by the EA unless the trailing block touches it. The expiration is set to 1 calendar day from open, with the TimeSkipWeekdays flag skipping weekend rolls so the order never expires inside Saturday or Sunday.

Trailing-stop management is the only post-entry intervention. Four trailing blocks (Block0, Block1, Block9, Block10) extend the MDL_TrailingStop2 template, which on every tick walks the open positions and ratchets the stop once price has moved past the start threshold. The XAU leg uses XAU_Starts = 50 (don't trail until price is 50 points in profit), XAU_Stops = 50 (lock 50 points of distance from price), and XAU_Steps = 1 (only re-modify if price has moved at least 1 point past the current stop). The GU leg mirrors with GU_Starts = 5, GU_Stops = 5, GU_Steps = 1 — start trailing at 5 pips in profit, lock 5 pips, with a 1-pip step. Both legs can be disabled by setting XAU_Use_Trailing_Stops or GU_Use_Trailing_Stops to false. The TrailingReferencePrice = 1 parameter anchors the trail to Bid for buys and Ask for sells, which is the standard broker-safe choice for hedged accounts.

Stops are implemented as virtual stops, not broker-side hard stops. VIRTUAL_STOPS_ENABLED = 1 at the top of the file means the EA tracks SL and TP internally on every tick via the VirtualStopsDriver call inside OnTick, and only the trailing block's ratchet writes back to the server. The trade-off is fewer order modifications against the broker (faster, less requote noise), at the cost of needing the EA to be attached for protection to work. The same virtual-stop convention explains the 10-attempt retry helper CheckForTradingError and the 5-attempt loop in CloseTrade that pumps Sleep(500) between REQUOTE / PRICE_CHANGED / TIMEOUT retries before giving up.

The on-chart presentation is also part of the source code. Block19 is a MDL_CommentEx instance that draws a label in the upper-left corner showing the broker name (via ACCOUNT_COMPANY), server name (ACCOUNT_SERVER), account balance, and floating P&L, with title XAU-GU Scalper in Georgia gold font. Block20 draws a black decorative button with crimson border and green text reading Prop-Firm Expert in the upper-left at offset (350, 27). Both are visual chrome — they carry no trading logic. Spread-meter rendering is compiled out via ENABLE_SPREAD_METER false and ENABLE_TEST_INDICATORS false to keep the tester output clean.

What the EA deliberately does not do is also worth noting. There is no martingale or grid: AlignLots clamps to the broker's min/max, the volume mode is plain balance percent, and there is no order-add or recovery layer. There is no news filter, no session filter, no day-of-week filter, and no daily-drawdown cap. There is no regime detector or volatility gate. The only protection beyond the per-trade SL/TP and the virtual-stop driver is the broker's minimum stop-level check inside AlignStopLoss and AlignTakeProfit, which will refuse any SL/TP that violates the symbol's stops-level and re-issue the order at the minimum allowed distance. On a flat ECN feed with sub-20 ms round-trip latency, the back-to-back open/close cycle is the entire strategy.

Strategy Deep Dive

On every tick the once-per-bar guards (Block3/Block7/Block12/Block16) compare the current bar open time against a static token+timestamp cache, and only when a new bar has formed do they let the upstream MDL_Condition gates (Block8 for XAU, Block17 for GU) check the per-symbol trade flag. The bull/bear candle blocks (Block2/Block6 for XAU, Block11/Block15 for GU) read iOpen and iClose on the previous bar and check that the body exceeds MinBodySize (XAU_Delta=100 points or GU_Delta=5 pips). If a bull candle is detected, MDL_BuyNow (Block4/Block13) computes volume via DynamicLots in balance mode ((VolumePercent/100) × balance / (LotSize × TickValue)), applies the per-leg SL and TP, and calls OrderCreate with magic = MagicStart + Group. The trailing blocks run independently on every tick and use ModifyStops to ratchet the virtual stop once price has cleared the start threshold; the actual SL/TP enforcement happens in VirtualStopsDriver, not on the broker side. OnChartEvent repaints the broker/server/balance/P&L label (Block19) and the Prop-Firm Expert decorative button (Block20), and OnDeinit deletes the 22 dynamic block instances and the cached chart objects.

Entry Signal

A long fires when the previous bar's close sits above its open by at least MinBodySize (100 points for XAUUSD via XAU_Delta, 5 pips for GBPUSD via GU_Delta) and the once-per-bar guard has confirmed a new bar has formed; a short fires on the mirror condition (open above close by MinBodySize). Each leg has its own boolean gate — XAUUSD_Trade and GBPUSD_Trade — so either symbol can be muted without touching the other. The buy/sell blocks then route to MDL_BuyNow or MDL_SellNow which issue a market order with the per-symbol volume (XAU_Autolots=1.0 or GU_Autolots=1000 in balance-percent mode), hard-coded SL, and hard-coded TP.

Exit Signal

Positions exit in one of three ways: the hard-coded TP fires (1500 points on XAU, 150 pips on GU), the hard-coded SL fires (500 points on XAU, 50 pips on GU), or the virtual-stop driver ratchets the stop past the entry via the trailing block (XAU_Starts=50 / XAU_Stops=50 / XAU_Steps=1, or GU_Starts=5 / GU_Stops=5 / GU_Steps=1). The trailing logic uses TrailingReferencePrice=1 so it references Bid for buys and Ask for sells, and only re-modifies when price has moved at least XAU_Steps or GU_Steps beyond the current stop. There is no signal-based exit, no reverse-signal flatten, and no time-based close.

Stop Loss

Every order opens with a static SL on the ticket — 500 points below entry for XAUUSD longs and above entry for shorts, 50 pips below/above entry for GBPUSD. The trailing blocks (Block0/Block1 for XAU, Block9/Block10 for GU) ratchet the stop on every tick once price moves XAU_Starts=50 or GU_Starts=5 beyond the entry, locking XAU_Stops=50 / GU_Stops=5 of distance. The stops are virtual, not broker-side, so protection only works while the EA is attached.

Take Profit

Every order opens with a static TP at 1500 points for XAUUSD and 150 pips for GBPUSD — a 1:3 risk-reward against the 500-point XAU SL and 50-pip GU SL. The TP is written to the ticket at OrderCreate and never moves; all profit protection comes from the trailing stop ratchet, not from a moving target. Expiration is set to 1 calendar day from open with weekend-skip enabled.

Best For

Recommended minimum balance is $100 on a low-spread ECN broker — the per-symbol virtual-stop driver and the 10-attempt CheckForTradingError retry helper need a sub-30ms round-trip to keep the SL/TP enforcement honest. Run on XAUUSD and GBPUSD M5 (the M5-H1 timeframe range is allowed by the EA's PERIOD_CURRENT binding), with the default candle-body thresholds of 100 points for gold and 5 pips for sterling. Leave the trailing-stop toggles on (XAU_Use_Trailing_Stops=true, GU_Use_Trailing_Stops=true) and the SL/TP ratios at the 1:3 default — those are the four inputs that actually move the backtest. Risk level: HIGH, driven by the absence of a session filter, news filter, and daily-drawdown cap, and by the 1.0% balance-percent sizing on the XAU leg combined with 1000% scaling on the GU leg.

Strategy Logic

Pipsgrowth EX14004 Scalper — Strategy Logic Analysis (from .mq5 source)

Family: Scalper Magic: 22214004 Version: 2.00

BRIEF: Multi-symbol scalper for XAUUSD and GBPUSD with separate parameter sets per symbol, trailing stops, autolots, and configurable SL/TP. Uses fxDreema engine with virtual stops

INDICATOR STACK:

  • Standard MT5 indicators

KEY FUNCTIONS:

  • OnTrade()
  • OnTimer()
  • OnChartEvent()
  • AccountBalance()
  • AccountBalanceAtStart()
  • AccountEquity()
  • AccountFreeMargin()
  • AlignLots()
  • AlignStopLoss()
  • AlignTakeProfit()
  • ArrayEnsureValue()
  • ArraySearch()
  • ...and 114 more

INTERNAL CONSTANTS (10 total):

  • ENABLE_TEST_INDICATORS = false // --
  • ENABLE_EVENT_TICK = 1 // enable "Tick" event
  • ENABLE_EVENT_TRADE = 0 // enable "Trade" event
  • ENABLE_EVENT_TIMER = 0 // enable "Timer" event
  • VIRTUAL_STOPS_ENABLED = 1 // enable virtual stops
  • VIRTUAL_STOPS_TIMEOUT = 0 // virtual stops timeout
  • EMERGENCY_STOPS_REL = 0 // use 0 to disable hard stops when virtual stops are enabled. Use a value >=0 to automatically set hard stops with virtual. Example: if 2 is used, then hard stops will be 2 times bigger than virtual ones.
  • EMERGENCY_STOPS_ADD = 0 // add pips to relative size of emergency stops (hard stops)
  • ON_TIMER_PERIOD = 60 // Timer event period (in seconds)
  • SEL_INITIAL = 1 // VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//

INPUT PARAMETERS (20 total across 3 groups):

  • [=== XAUUSD Parameters ===] XAUUSD_Trade = true // XAUUSD Trade
  • [=== XAUUSD Parameters ===] XAU_Autolots = 1.0 // XAU Autolots
  • [=== XAUUSD Parameters ===] XAU_SL = 500.0 // XAU SL
  • [=== XAUUSD Parameters ===] XAU_TP = 1500.0 // XAU TP
  • [=== XAUUSD Parameters ===] XAU_Use_Trailing_Stops = true // XAU Use Trailing Stops
  • [=== XAUUSD Parameters ===] XAU_Stops = 50.0 // XAU Stops
  • [=== XAUUSD Parameters ===] XAU_Steps = 1.0 // XAU Steps
  • [=== XAUUSD Parameters ===] XAU_Starts = 50.0 // XAU Starts
  • [=== XAUUSD Parameters ===] XAU_Delta = 100.0 // XAU Delta
  • [=== GBPUSD Parameters ===] GBPUSD_Trade = true // GBPUSD Trade
  • [=== GBPUSD Parameters ===] GU_Autolots = 1000.0 // GU Autolots
  • [=== GBPUSD Parameters ===] GU_SL = 50.0 // GU SL
  • [=== GBPUSD Parameters ===] GU_TP = 150.0 // GU TP
  • [=== GBPUSD Parameters ===] GU_Use_Trailing_Stops = true // GU Use Trailing Stops
  • [=== GBPUSD Parameters ===] GU_Stops = 5.0 // GU Stops
  • [=== GBPUSD Parameters ===] GU_Steps = 1.0 // GU Steps
  • [=== GBPUSD Parameters ===] GU_Starts = 5.0 // GU Starts
  • [=== GBPUSD Parameters ===] GU_Delta = 5.0 // GU Delta
  • [=== Identity ===] MagicStart = 22214004 // Magic Number base (222xxx)
  • [=== Identity ===] InpTradeComment = "Psgrowth.com Expert_14004" // Trade comment
Pseudocode
// Pipsgrowth EX14004 Scalper — Execution Flow (from source analysis)
// Family: Scalper
// Multi-symbol scalper for XAUUSD and GBPUSD with separate parameter sets per symbol, trailing stops, autolots, and configurable SL/TP. Uses fxDreema engine with virtual stops

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:
XAUUSDGBPUSD
Optimized Timeframes:
M5H1

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 from the Navigator onto any chart (M1 or M5 recommended)
  7. 7In the EA dialog, enable Allow Algo Trading and set your lot size
  8. 8Click OK — the EA will begin trading automatically

EA Parameters

ParameterDefaultDescription
XAUUSD_TradetrueXAUUSD Trade
XAU_Autolots1.0XAU Autolots
XAU_SL500.0XAU SL
XAU_TP1500.0XAU TP
XAU_Use_Trailing_StopstrueXAU Use Trailing Stops
XAU_Stops50.0XAU Stops
XAU_Steps1.0XAU Steps
XAU_Starts50.0XAU Starts
XAU_Delta100.0XAU Delta
GBPUSD_TradetrueGBPUSD Trade
GU_Autolots1000.0GU Autolots
GU_SL50.0GU SL
GU_TP150.0GU TP
GU_Use_Trailing_StopstrueGU Use Trailing Stops
GU_Stops5.0GU Stops
GU_Steps1.0GU Steps
GU_Starts5.0GU Starts
GU_Delta5.0GU Delta
MagicStart22214004Magic Number base (222xxx)
InpTradeComment"Psgrowth.com Expert_14004"Trade comment
Source Code (.mq5)Open Source
Pipsgrowth_com_EX14004.mq5
#property copyright "Pipsgrowth.com"
#property link      "https://pipsgrowth.com"
#property version   "2.00"
#property strict
#property description "Pipsgrowth.com EX14004 XAU-GU Scalper — multi-symbol gold/GU scalper, full 12-layer stack."
#include <Trade\Trade.mqh>

/************************************************************************************************************************/
// +------------------------------------------------------------------------------------------------------------------+ //
// |                       INPUT PARAMETERS, GLOBAL VARIABLES, CONSTANTS, IMPORTS and INCLUDES                        | //
// |                      System and Custom variables and other definitions used in the project                       | //
// +------------------------------------------------------------------------------------------------------------------+ //
/************************************************************************************************************************/

//VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//
// System constants (project settings) //
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^//
//--
#define PROJECT_ID "mt5-7626"
//--
// Point Format Rules
#define POINT_FORMAT_RULES "0.001=0.01,0.00001=0.0001,0.000001=0.0001" // this is deserialized in a special function later
#define ENABLE_SPREAD_METER false
#define ENABLE_STATUS false
#define ENABLE_TEST_INDICATORS false
//--
// Events On/Off
#define ENABLE_EVENT_TICK 1 // enable "Tick" event
#define ENABLE_EVENT_TRADE 0 // enable "Trade" event
#define ENABLE_EVENT_TIMER 0 // enable "Timer" event
//--
// Virtual Stops
#define VIRTUAL_STOPS_ENABLED 1 // enable virtual stops
#define VIRTUAL_STOPS_TIMEOUT 0 // virtual stops timeout
#define USE_EMERGENCY_STOPS "no" // "yes" to use emergency (hard stops) when virtual stops are in use. "always" to use EMERGENCY_STOPS_ADD as emergency stops when there is no virtual stop.
#define EMERGENCY_STOPS_REL 0 // use 0 to disable hard stops when virtual stops are enabled. Use a value >=0 to automatically set hard stops with virtual. Example: if 2 is used, then hard stops will be 2 times bigger than virtual ones.
#define EMERGENCY_STOPS_ADD 0 // add pips to relative size of emergency stops (hard stops)
//--
// Settings for events
#define ON_TIMER_PERIOD 60 // Timer event period (in seconds)

//VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//
// System constants (predefined constants) //
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^//
//--
#define TLOBJPROP_TIME1 801
#define OBJPROP_TL_PRICE_BY_SHIFT 802
#define OBJPROP_TL_SHIFT_BY_PRICE 803
#define OBJPROP_FIBOVALUE 804
#define OBJPROP_FIBOPRICEVALUE 805
#define OBJPROP_FIRSTLEVEL 806
#define OBJPROP_TIME1 807
#define OBJPROP_TIME2 808
#define OBJPROP_TIME3 809
#define OBJPROP_PRICE1 810
#define OBJPROP_PRICE2 811
#define OBJPROP_PRICE3 812
#define OBJPROP_BARSHIFT1 813
#define OBJPROP_BARSHIFT2 814
#define OBJPROP_BARSHIFT3 815

Full source code available on download

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

Tags:ex14004scalperpipsgrowthfreemt5xauusdgbpusd

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_EX14004.mq5
File Size242.9 KB
Versionv2.00
PlatformMetaTrader 5
File Type.mq5 Source
StrategyScalping
Risk LevelHigh Risk
Timeframes
M5H1
Currency Pairs
XAUUSDGBPUSD
Min. Deposit$100