Pipsgrowth EX14022 Scalper
MT5 Expert Advisor (Open Source) · XAUUSD · M5, H1
Pipsgrowth.com EX14022 GalaxyGoldScalper — XAUUSD scalper with trend/momentum/volatility filters, full 12-layer stack.
Overview
Pipsgrowth EX14022 GalaxyGoldScalper is built around a deliberately counter-intuitive read of two familiar M5 indicators on XAUUSD. Where most EMA-cross systems buy the upward cross, this EA buys the downward cross of a fast EMA(8) through a slow EMA(21) — but only when the 10-period Momentum oscillator on the same closed bar is still above 100. The premise is that in a healthy uptrend, a brief pullback that pushes the fast EMA back below the slow EMA is the entry, not the exit, provided the underlying momentum has not actually rolled over. The mirror setup applies on the short side: a fast EMA crossing back up through the slow EMA while Momentum is still below 100 is read as a "sell the rip" in a still-intact downtrend. This is the entire signal of the EA in one bar.
The order of operations inside OnTick is strict and reveals the EA's real priorities. The very first gate is volatility: the 14-period ATR (in raw price, not points) must read between InpVolatilityMin=3.0 and InpVolatilityMax=50.0. That window is calibrated for XAUUSD on M5 — a normal XAUUSD M5 ATR(14) sits somewhere between $3 and $15 in active sessions, so the 3.0 floor kills the dead Asian-range and pre-London flat, and the 50.0 ceiling is set high enough that only the most extreme spike days (CPI, NFP, FOMC) would get blocked. This is the EA's "is the market actually moving?" check, and it runs before the trend and momentum logic even looks at the bar.
The second gate is operational. A new-bar guard (if(curBar == lastBarTime) return;) ensures the EA makes exactly one decision per closed M5 bar, so it cannot fire twice on the same setup. The current spread on the symbol must be at or below InpMaxSpread=80 points (roughly 8 pips on a typical XAUUSD quote), and the position count under magic 22214022 must be below InpMaxTrades=2. Both checks run before any indicator copy, so on a high-spread rollover or once the EA is already holding two positions, the rest of the function short-circuits cleanly.
On a bar that passes all gates, OnTick pulls two bars of data from each of the four indicator handles — iATR(14), iMA(8, MODE_EMA, PRICE_CLOSE), iMA(21, MODE_EMA, PRICE_CLOSE), and iMomentum(10, PRICE_CLOSE). The buy condition then resolves to: previous bar's fast EMA strictly above previous bar's slow EMA, current bar's fast EMA at or below current bar's slow EMA, and the previous bar's momentum above the 100 baseline. The sell condition is the exact mirror. SL and TP are computed as InpStopLoss * _Point (400 points = 40 pips on a 5-digit XAUUSD quote) and InpTakeProfit * _Point (600 points = 60 pips), giving a 1.5:1 reward-to-risk ratio. Lot sizing is either the fixed InpLotSize=0.01 default, or — when InpAutoLot=true — CalcLot(sl) computes a balance- and contract-aware lot from balance * InpRiskPct / (sl_dist / tick_size * tick_value), floored at 0.01 and rounded to 2 decimals. Entries go through trade.Buy(lot, _Symbol, ask, ask-sl, ask+tp, InpTradeComment) with trade.SetDeviationInPoints(20) set in OnInit — a 20-point slippage tolerance the broker is allowed to apply to the fill.
There are a few things this EA does not do, and they are worth knowing before you load it. The header advertises a "12-layer architecture" that includes a News Filter — and the inputs do expose InpNewsFilter=true, InpNewsMinsBefore=30, InpNewsMinsAfter=30. None of those values are read anywhere in OnTick. The actual code contains no news event check, no calendar hook, no scheduled pause, and no recovery after a release. The News Filter is a declared input with no implementation behind it. If you need news avoidance, you need to build it outside this EA. Similarly, the header mentions OnTester as one of the 12 layers, but there is no OnTester function in the file. There is no trailing stop, no break-even ratchet, no partial close, no time-based exit, no reverse-signal exit, no equity stop, no global drawdown cap, no session filter, and no day-of-week guard. Once a position is opened, the EA's only ongoing interaction with it is the count-trades check in OnTick that respects InpMaxTrades. The position's life is otherwise left entirely to the broker-side SL and TP that were attached at entry.
Three more pieces of the source are template scaffolding. The functions TryClose_EX14022, TryClosePartial_EX14022, and TryModify_EX14022 are all declared with 3-attempt retry loops (200ms close, 200ms partial, 100ms modify back-offs on REQUOTE / TIMEOUT / PRICE_OFF / PRICE_CHANGED) but none of them is called from OnTick. Live entries go straight through trade.Buy / trade.Sell, so users will see single-attempt failures on requotes rather than the silent retry these helpers were designed to absorb. OnDeinit releases all four indicator handles cleanly, and OnInit returns INIT_FAILED if any of the four handles comes back INVALID_HANDLE. The 18 inputs split into four groups — Money Management, Strategy, News Filter, and Trade Settings — and every one of them is exposed to the user, which is the part of the EA that does live up to the marketing copy.
In practice, GalaxyGoldScalper wants a broker with tight spreads on XAUUSD (the 80-point max is a hard cutoff, not a target — anything that runs hot at the rollover will be skipped), a sub-$1.5 commission per lot per side if possible, and reliable execution during the London and New York sessions when the 8/21 EMA cross and 10-period Momentum combination actually has signal to work with. A $100 minimum deposit runs 0.01 lots comfortably given the 40-pip stop; the AutoLot path with 1% risk scales this up automatically on larger balances without any manual recalibration. Test in the Strategy Tester on real tick data from the session you intend to trade — the "flat Asia" filter is doing real work in the 3.0 ATR floor, and that's the part of the backtest most likely to look different in live.
Strategy Deep Dive
On every tick, GalaxyGoldScalper first checks the new-bar guard so it makes exactly one decision per closed M5 bar. It then verifies the symbol's current spread is at or below InpMaxSpread=80 points and that fewer than InpMaxTrades=2 positions are already open under magic 22214022. Only after those operational gates does it copy two bars of data from the four indicator handles — iATR(14), iMA(8, MODE_EMA, PRICE_CLOSE), iMA(21, MODE_EMA, PRICE_CLOSE), iMomentum(10, PRICE_CLOSE) — and evaluate the volatility, trend, and momentum conditions. The volatility gate (atrVal < InpVolatilityMin=3.0 || atrVal > InpVolatilityMax=50.0) is the first condition evaluated on the indicator data; it returns early if the market is too flat or spiking. Only on a bar that passes volatility does the EA then check the EMA cross and Momentum direction. When a buy or sell fires, the entry is sent through trade.Buy or trade.Sell with the SL and TP pre-attached broker-side; after that, the EA does not touch the position again until it closes. The News Filter inputs (InpNewsFilter, InpNewsMinsBefore, InpNewsMinsAfter) are declared in the source but never read by OnTick — they are presentational only. Similarly, the three retry helpers TryClose_EX14022, TryClosePartial_EX14022, and TryModify_EX14022 exist in the source with 3-attempt retry loops but have no call sites in the live entry path.
Buy entry fires when the 8-period fast EMA has just crossed down through the 21-period slow EMA (previous bar fast>previous bar slow, current bar fast<=current bar slow) while the 10-period Momentum on the same bar is still above 100 — a pullback entry inside an intact uptrend. Sell entry mirrors the condition: fast EMA crossing up through slow EMA with Momentum below 100. The ATR(14) must also sit between 3.0 and 50.0 price units, spread must be at or below 80 points, and open positions under magic 22214022 must be below 2.
No EA-side exit logic — positions exit only when the broker hits the broker-side stop loss (400 points = 40 pips on XAUUSD) or take profit (600 points = 60 pips) that were attached at entry. There is no trailing stop, no break-even, no partial close, no time-based exit, and no reverse-signal exit. Once a position is open, the EA only checks the count against InpMaxTrades; the rest of position management is left to the attached SL/TP.
Fixed 400-point stop loss attached broker-side at entry, equivalent to 40 pips on a 5-digit XAUUSD quote (sl = InpStopLoss * _Point). The same InpStopLoss value feeds into the optional InpAutoLot path so lot size scales with the actual stop distance. No per-trade trailing, no break-even, no equity stop, no global drawdown cap — the SL is the only loss-control mechanism the EA actually wires.
Fixed 600-point take profit attached broker-side at entry, equivalent to 60 pips on a 5-digit XAUUSD quote (tp = InpTakeProfit * _Point). The reward-to-risk ratio is 1.5:1 (600/400), which the EA is built around — the strategy assumes a higher win rate can carry a sub-2:1 RR. There is no partial close, no trailing TP, no TP ratchet.
Best for traders who run XAUUSD on M5 during the London and New York sessions, when ATR(14) typically reads between 3 and 15 in price units and the 8/21 EMA cross + 10-period Momentum combination has actual signal. Minimum recommended balance is $100 for the fixed 0.01 lot default; balances above that can switch InpAutoLot to true with InpRiskPct=1.0% to let CalcLot scale position size with the actual 40-pip stop. The broker must offer tight XAUUSD spreads (the 80-point max is a hard cutoff, not a target), low commissions (sub-$1.5 per lot per side preferred), and fast execution — the EA does not retry entry on requotes, so a slow fill will hurt live results disproportionately to backtest.
Strategy Logic
Pipsgrowth EX14022 Scalper — Strategy Logic Analysis (from .mq5 source)
Family: Scalper
Magic: 22214022
Version: 2.00
BRIEF:
Precision XAUUSD scalper with 3-layer entry filter: trend (EMA crossover), momentum, and volatility gate. 12 layers: REGIME, SIGNAL, ENTRY, CONFIRM, NO-TRADE, CAPITAL CAP, RISK, SIZING, MANAGE, EXIT, SCALING, OnTester
INDICATOR STACK:
- Standard
MT5indicators
KEY FUNCTIONS:
CountOpenTrades()CalcLot()TryClose_EX14022()TryClosePartial_EX14022()TryModify_EX14022()
INTERNAL CONSTANTS (0 total):
INPUT PARAMETERS (18 total across 4 groups):
- [=== Money Management ===]
InpLotSize=0.01// Lot Size - [=== Money Management ===]
InpAutoLot=false// Auto Lot - [=== Money Management ===]
InpRiskPct=1.0// Risk % (ifAutoLot) - [=== Strategy ===]
InpATRPeriod= 14 //ATRPeriod - [=== Strategy ===]
InpEMAFast= 8 // FastEMAPeriod - [=== Strategy ===]
InpEMASlow= 21 // SlowEMAPeriod - [=== Strategy ===]
InpMomentPeriod= 10 // Momentum Period - [=== Strategy ===]
InpVolatilityMin=3.0// MinATRin price (avoid flat market) - [=== Strategy ===]
InpVolatilityMax=50.0// MaxATRin price (avoid news spikes) - [=== Strategy ===]
InpStopLoss= 400 // StopLoss(points) - [=== Strategy ===]
InpTakeProfit= 600 // TakeProfit(points) - [=== Strategy ===]
InpMaxSpread= 80 // MaxSpread(points) - [=== News Filter ===]
InpNewsFilter=true// Enable News Filter - [=== News Filter ===]
InpNewsMinsBefore= 30 // Minutes before news to pause - [=== News Filter ===]
InpNewsMinsAfter= 30 // Minutes after news to resume - [=== Trade Settings ===]
InpMagicNumber=22214022// Magic Number - [=== Trade Settings ===]
InpTradeComment= "Psgrowth.com Expert_14022" // TradeComment - [=== Trade Settings ===]
InpMaxTrades= 2 // Max simultaneous trades
// Pipsgrowth EX14022 Scalper — Execution Flow (from source analysis)
// Family: Scalper
// Precision XAUUSD scalper with 3-layer entry filter: trend (EMA crossover), momentum, and volatility gate. 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 from the Navigator onto any chart (M1 or M5 recommended)
- 7In the EA dialog, enable Allow Algo Trading and set your lot size
- 8Click OK — the EA will begin trading automatically
EA Parameters
| Parameter | Default | Description |
|---|---|---|
| InpLotSize | 0.01 | Lot Size |
| InpAutoLot | false | Auto Lot |
| InpRiskPct | 1.0 | Risk % (if AutoLot) |
| InpATRPeriod | 14 | ATR Period |
| InpEMAFast | 8 | Fast EMA Period |
| InpEMASlow | 21 | Slow EMA Period |
| InpMomentPeriod | 10 | Momentum Period |
| InpVolatilityMin | 3.0 | Min ATR in price (avoid flat market) |
| InpVolatilityMax | 50.0 | Max ATR in price (avoid news spikes) |
| InpStopLoss | 400 | Stop Loss (points) |
| InpTakeProfit | 600 | Take Profit (points) |
| InpMaxSpread | 80 | Max Spread (points) |
| InpNewsFilter | true | Enable News Filter |
| InpNewsMinsBefore | 30 | Minutes before news to pause |
| InpNewsMinsAfter | 30 | Minutes after news to resume |
| InpMagicNumber | 22214022 | Magic Number |
| InpTradeComment | "Psgrowth.com Expert_14022" | Trade Comment |
| InpMaxTrades | 2 | Max simultaneous trades |
#property copyright "Pipsgrowth.com"
#property link "https://pipsgrowth.com"
#property version "2.00"
#property strict
#property description "Pipsgrowth.com EX14022 GalaxyGoldScalper — XAUUSD scalper with trend/momentum/volatility filters, full 12-layer stack."
#include <Trade\Trade.mqh>
input group "=== Money Management ==="
input double InpLotSize = 0.01; // Lot Size
input bool InpAutoLot = false; // Auto Lot
input double InpRiskPct = 1.0; // Risk % (if AutoLot)
input group "=== Strategy ==="
input int InpATRPeriod = 14; // ATR Period
input int InpEMAFast = 8; // Fast EMA Period
input int InpEMASlow = 21; // Slow EMA Period
input int InpMomentPeriod = 10; // Momentum Period
input double InpVolatilityMin = 3.0; // Min ATR in price (avoid flat market)
input double InpVolatilityMax = 50.0; // Max ATR in price (avoid news spikes)
input int InpStopLoss = 400; // Stop Loss (points)
input int InpTakeProfit = 600; // Take Profit (points)
input int InpMaxSpread = 80; // Max Spread (points)
input group "=== News Filter ==="
input bool InpNewsFilter = true; // Enable News Filter
input int InpNewsMinsBefore = 30; // Minutes before news to pause
input int InpNewsMinsAfter = 30; // Minutes after news to resume
input group "=== Trade Settings ==="
input ulong InpMagicNumber = 22214022; // Magic Number
input string InpTradeComment = "Psgrowth.com Expert_14022"; // Trade Comment
input int InpMaxTrades = 2; // Max simultaneous trades
CTrade trade;
int hATR, hEMAFast, hEMASlow, hMomentum;
datetime lastBarTime = 0;
//+------------------------------------------------------------------+
int OnInit()
{
trade.SetExpertMagicNumber(InpMagicNumber);
trade.SetDeviationInPoints(20);
hATR = iATR(_Symbol, PERIOD_CURRENT, InpATRPeriod);
hEMAFast = iMA(_Symbol, PERIOD_CURRENT, InpEMAFast, 0, MODE_EMA, PRICE_CLOSE);
hEMASlow = iMA(_Symbol, PERIOD_CURRENT, InpEMASlow, 0, MODE_EMA, PRICE_CLOSE);
hMomentum = iMomentum(_Symbol, PERIOD_CURRENT, InpMomentPeriod, PRICE_CLOSE);
if(hATR==INVALID_HANDLE || hEMAFast==INVALID_HANDLE ||
hEMASlow==INVALID_HANDLE || hMomentum==INVALID_HANDLE)
{ Print("GalaxyGold: Indicator init failed"); return INIT_FAILED; }
return INIT_SUCCEEDED;
}
void OnDeinit(const int reason)
{
IndicatorRelease(hATR);
IndicatorRelease(hEMAFast);
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 Scalping strategy EAs from our library
Pipsgrowth EX14020 Scalper
Pipsgrowth.com EX14020 AIXAUUSDScalper — AI-assisted XAUUSD scalper, full 12-layer stack.
Pipsgrowth EX10006 Momentum-Scalper
Pipsgrowth.com EX10006 USDJPY Scalper — USDJPY pullback momentum scalper, full 12-layer stack.
Pipsgrowth EX14021 Scalper
Pipsgrowth.com EX14021 EURUSDScalper — BB + MACD divergence scalper, full 12-layer stack.
Community
Educational purposes only. Do NOT use with real money. Test on demo accounts only.