Pipsgrowth EX14024 Scalper
MT5 Expert Advisor (Open Source) · XAUUSD · M5
Pipsgrowth.com EX14024 GoldScalperPro — XAUUSD scalper with SMA200 trend filter and RSI confirmation, full 12-layer stack.
Overview
Pipsgrowth EX14024 GoldScalperPro is a single-position XAUUSD scalper that combines a long-term trend filter with mean-reversion entry triggers and an adaptive volatility stop. Unlike the momentum-following cross strategies common elsewhere in this family, this EA waits for a confirmed trend and then buys weakness inside that trend, expecting the gold market to revert toward its short-term mean before the directional move resumes.
The structural core of the EA is three indicators working in concert. A 200-period Simple Moving Average acts as the long-term trend gate. The Relative Strength Index at 14 periods with classic 30/70 thresholds is the entry trigger. The Average True Range at 14 periods, multiplied by 1.5, defines the per-trade stop loss dynamically. There is no separate signal smoothing, no multi-timeframe confirmation, and no predictive layer — the EA reads these three values once per closed M5 bar and acts on the bar where the conditions stack.
On the buy side, the EA looks for two conditions to align on the just-closed bar. The bid price must be strictly above the SMA(200) value from two bars ago, confirming the broader trend is up. The RSI must have just dipped into oversold territory — that is, on the previous bar it was above 30 and on the bar just closed it is now below 30. The EA is buying the moment of maximum pessimism within an uptrend, on the assumption that gold's intraday momentum will mean-revert and the trend will continue. The sell side is the mirror: the bid price must be below the SMA(200) value, and the RSI must have just spiked into overbought from below 70 on the prior bar to above 70 on the bar just closed. The EA is shorting strength at the top of a confirmed downtrend.
Because the EA only checks the prior-bar RSI transition, both buy and sell signals can theoretically fire on the same bar, though the SMA(200) gate prevents this in practice — if price is above SMA(200), the sell condition cannot be met, and vice versa. The two signals are therefore mutually exclusive by construction.
Each position is opened with a market order using a lot size that is either fixed or computed dynamically. When InpAutoLot is set to false, the EA always opens with the configured InpLotSize, default 0.01 lots. When InpAutoLot is true, the EA calls CalculateAutoLot() and divides the account balance by a stop-loss distance measured in ticks. The formula is lot = (balance * risk%) / (slTicks * tickValue), with slTicks derived from the ATR-derived stop distance divided by the symbol's tick size, the result floored at 0.01 lots and rounded to two decimals. The default risk percentage is 1.0% of balance per trade.
The stop loss is ATR-driven and adjusts to the current volatility environment. The code reads the ATR value from the prior bar and multiplies it by InpATRMultiplier, default 1.5. This means on a calm gold session with an ATR of, say, $2.50, the stop is placed at $3.75 from entry. On a high-volatility session with an ATR of $8, the stop widens to $12. The user can scale the SL by adjusting the multiplier. The take profit is fixed in raw points. The default is 25 points — on a 2-decimal XAUUSD feed, that is $0.25; on a 3-decimal feed, that is $0.025. Users should verify their broker's point size before interpreting the TP in dollar terms because the EA does not perform this conversion itself.
Position management is handled by a single function, ManageTrailingStop(), which is called on every bar once the position is open. The trailing stop activates only after the trade has moved into profit by at least InpTrailStart points, default 15. Once activated, the stop is moved to InpTrailStep points behind the current price, default 5, and is only ever moved in the protective direction — it never widens. This creates a stair-step ratchet effect: as the trade moves further into profit, the stop is ratcheted up, locking in gains progressively. The TP and SL are both attached to the order at entry by the broker, so the trailing stop is the additional protective layer rather than the primary exit. There is no break-even function, no partial close, and no time-based exit. The trade closes when either the SL, the TP, or the trailing stop is hit.
The EA enforces a hard position cap of one trade at a time through InpMaxTrades. The CountOpenTrades() function walks all open positions on the account, filters by the magic number 22214024 and the current symbol, and counts only those that match. The OnTick function returns early if the count has reached the cap. This is a single-position-at-a-time EA; there is no grid, no martingale, no averaging.
The session filter is the only time-based gate. When InpUseSession is true, the EA reads the current server hour and only allows entries between InpSessionStart (default 7) and InpSessionEnd (default 20). Outside this window, no new entries are placed, but open positions continue to be managed and the trailing stop still ratchets. This window is tuned for XAUUSD's main active hours — roughly the London session through the first half of the New York session. The spread filter, with InpMaxSpread default 30 points, blocks entries when the current market spread is too wide, which is common during the Asian session or around high-impact news releases.
The OnInit function validates the symbol, warning the user if the current symbol is not XAUUSD, GOLD, or contains XAU, and hard-fails if any of the three indicator handles returns INVALID_HANDLE. The OnDeinit function releases all three handles cleanly. The order filling policy is set to FOK (Fill or Kill), and the slippage tolerance is 20 points. The magic number is 22214024, embedded in every order and used by the position counter and trailing stop to filter only EA-owned trades.
Three retry helper functions — TryClose_EX14024, TryClosePartial_EX14024, and TryModify_EX14024 — are declared and correctly written with 3-attempt loops on requote, timeout, price-off, and price-changed return codes. However, none of them are actually called by the live OnTick logic, which uses trade.Buy() and trade.Sell() directly. The retry helpers are dead code from the EX14 family template, and a single close or modify failure under live conditions will not be retried.
This EA works best in environments where gold is trending and RSI regularly visits oversold in uptrends or overbought in downtrends — the conditions the strategy is designed to exploit. The combination of a 200-bar trend filter with mean-reversion entries means the EA will sit out extended chop where the SMA(200) is flat, and it will only take signals that have directional context. The fixed TP and ATR-adaptive SL are simple by design, leaving the trailing stop as the main mechanism for converting winners into larger winners when the trend extends beyond the initial TP. Users should still pause the EA manually around major data releases because a single M5 candle can move through both the SL and the TP under high-volatility conditions, and the EA has no time-based or news-based exit to protect against such events.
Strategy Deep Dive
Once per closed M5 bar, OnTick checks the current server hour against the configured session window (default 7-20), the live spread against the 30-point cap, and the current position count against the 1-trade cap. It then copies RSI(14), SMA(200), and ATR(14) for the last two completed bars. A buy fires when bid price is above SMA(200) and RSI has just dipped from above 30 to below 30 on the prior bar; a sell fires when price is below SMA(200) and RSI has just spiked from below 70 to above 70. The position is opened with market order, FOK filling, and 20-point slippage tolerance, sized either fixed or via the ATR-based risk formula. ManageTrailingStop() runs each bar to ratchet the protective stop after the trade moves 15 points into profit, stepping in 5-point increments. Three retry helpers (TryClose/TryClosePartial/TryModify) are declared but never called from the live close or modify paths.
Buy signals fire when price is above the 200-period SMA and RSI(14) just crossed down through the 30 oversold level on the prior closed M5 bar — the EA is buying the dip inside a confirmed uptrend. Sell signals are the mirror: price below SMA(200) and RSI(14) just crossed up through the 70 overbought level. Both directions are gated by the ATR(14)-derived stop and a 30-point spread cap, with one position open at a time.
Trades exit via fixed TP (25 raw points) attached broker-side at entry, the ATR-derived stop, or the trailing stop. The trailing stop activates after 15 points of profit and ratchets the SL in 5-point steps, locking in gains progressively. There is no time-based exit, no break-even function, and no reverse-signal exit — once a position is open, it runs to SL, TP, or trailing stop.
The stop loss is ATR-driven: ATR(14) on the prior bar multiplied by 1.5, expressed in price units. A higher InpATRMultiplier widens the protective distance, a lower value tightens it. There is no global drawdown cap — risk is per-trade only.
The take profit is fixed at 25 raw points (InpTakeProfit * _Point), attached broker-side at entry. On a 2-decimal XAUUSD feed this is $0.25; on a 3-decimal feed it is $0.025 — users should verify their broker's point size. The trailing stop can capture moves larger than the initial TP if the trend extends.
Minimum recommended balance is $100, with the EA's default 0.01 lot and 1% risk-per-trade model. The strategy requires a low-spread broker — the 30-point spread cap and ATR-derived SL need tight execution to make the 25-point TP viable, so ECN or RAW-spread accounts on XAUUSD are strongly preferred. Best run on XAUUSD M5 during the London-through-NY session (server hours 7-20), and users should pause the EA manually around NFP, FOMC, and CPI releases where ATR spikes can blow through both the SL and the TP within a single candle. The trailing stop works best when the market trends cleanly; in sustained ranges the EA may give back profits as the trailing stop gets clipped.
Strategy Logic
Pipsgrowth EX14024 Scalper — Strategy Logic Analysis (from .mq5 source)
Family: Scalper
Magic: 22214024
Version: 2.00
BRIEF:
XAUUSD scalping EA using SMA200 trend filter and RSI confirmation. Targets 10-30 pip moves on M5/M15. 12 layers: REGIME, SIGNAL, ENTRY, CONFIRM, NO-TRADE, CAPITAL CAP, RISK, SIZING, MANAGE, EXIT, SCALING, OnTester
INDICATOR STACK:
- Standard
MT5indicators
KEY FUNCTIONS:
CountOpenTrades()CalculateAutoLot()ManageTrailingStop()TryClose_EX14024()TryClosePartial_EX14024()TryModify_EX14024()
INTERNAL CONSTANTS (0 total):
INPUT PARAMETERS (20 total across 4 groups):
- [=== Money Management ===]
InpLotSize=0.01// Lot Size - [=== Money Management ===]
InpAutoLot=false// AutoLot(% of balance) - [=== Money Management ===]
InpRiskPct=1.0// Risk % per trade (ifAutoLot) - [=== Strategy Parameters ===]
InpRSIPeriod= 14 //RSIPeriod - [=== Strategy Parameters ===]
InpRSIOverbought= 70 //RSIOverbought Level - [=== Strategy Parameters ===]
InpRSIOversold= 30 //RSIOversold Level - [=== Strategy Parameters ===]
InpSMAPeriod= 200 //SMATrend Filter Period - [=== Strategy Parameters ===]
InpATRPeriod= 14 //ATRPeriod - [=== Strategy Parameters ===]
InpATRMultiplier=1.5//ATRStop Loss Multiplier - [=== Strategy Parameters ===]
InpTakeProfit= 25 // TakeProfit(points) - [=== Strategy Parameters ===]
InpMaxSpread= 30 // Max AllowedSpread(points) - [=== Session Filter ===]
InpUseSession=true// Use Session Filter - [=== Session Filter ===]
InpSessionStart= 7 // Session StartHour(server) - [=== Session Filter ===]
InpSessionEnd= 20 // Session EndHour(server) - [=== Trade Management ===]
InpMagicNumber=22214024// Magic Number - [=== Trade Management ===]
InpTradeComment= "Psgrowth.com Expert_14024" // TradeComment - [=== Trade Management ===]
InpMaxTrades= 1 // Max simultaneous trades - [=== Trade Management ===]
InpUseTrailing=true// Use Trailing Stop - [=== Trade Management ===]
InpTrailStart= 15 // TrailStart(points in profit) - [=== Trade Management ===]
InpTrailStep= 5 // TrailStep(points)
// Pipsgrowth EX14024 Scalper — Execution Flow (from source analysis)
// Family: Scalper
// XAUUSD scalping EA using SMA200 trend filter and RSI confirmation. Targets 10-30 pip moves on M5/M15. 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 (% of balance) |
| InpRiskPct | 1.0 | Risk % per trade (if AutoLot) |
| InpRSIPeriod | 14 | RSI Period |
| InpRSIOverbought | 70 | RSI Overbought Level |
| InpRSIOversold | 30 | RSI Oversold Level |
| InpSMAPeriod | 200 | SMA Trend Filter Period |
| InpATRPeriod | 14 | ATR Period |
| InpATRMultiplier | 1.5 | ATR Stop Loss Multiplier |
| InpTakeProfit | 25 | Take Profit (points) |
| InpMaxSpread | 30 | Max Allowed Spread (points) |
| InpUseSession | true | Use Session Filter |
| InpSessionStart | 7 | Session Start Hour (server) |
| InpSessionEnd | 20 | Session End Hour (server) |
| InpMagicNumber | 22214024 | Magic Number |
| InpTradeComment | "Psgrowth.com Expert_14024" | Trade Comment |
| InpMaxTrades | 1 | Max simultaneous trades |
| InpUseTrailing | true | Use Trailing Stop |
| InpTrailStart | 15 | Trail Start (points in profit) |
| InpTrailStep | 5 | Trail Step (points) |
#property copyright "Pipsgrowth.com"
#property link "https://pipsgrowth.com"
#property version "2.00"
#property strict
#property description "Pipsgrowth.com EX14024 GoldScalperPro — XAUUSD scalper with SMA200 trend filter and RSI confirmation, full 12-layer stack."
#include <Trade\Trade.mqh>
#include <Trade\PositionInfo.mqh>
//--- Input Parameters
input group "=== Money Management ==="
input double InpLotSize = 0.01; // Lot Size
input bool InpAutoLot = false; // Auto Lot (% of balance)
input double InpRiskPct = 1.0; // Risk % per trade (if AutoLot)
input group "=== Strategy Parameters ==="
input int InpRSIPeriod = 14; // RSI Period
input int InpRSIOverbought = 70; // RSI Overbought Level
input int InpRSIOversold = 30; // RSI Oversold Level
input int InpSMAPeriod = 200; // SMA Trend Filter Period
input int InpATRPeriod = 14; // ATR Period
input double InpATRMultiplier = 1.5; // ATR Stop Loss Multiplier
input int InpTakeProfit = 25; // Take Profit (points)
input int InpMaxSpread = 30; // Max Allowed Spread (points)
input group "=== Session Filter ==="
input bool InpUseSession = true; // Use Session Filter
input int InpSessionStart = 7; // Session Start Hour (server)
input int InpSessionEnd = 20; // Session End Hour (server)
input group "=== Trade Management ==="
input int InpMagicNumber = 22214024; // Magic Number
input string InpTradeComment = "Psgrowth.com Expert_14024"; // Trade Comment
input int InpMaxTrades = 1; // Max simultaneous trades
input bool InpUseTrailing = true; // Use Trailing Stop
input int InpTrailStart = 15; // Trail Start (points in profit)
input int InpTrailStep = 5; // Trail Step (points)
//--- Global variables
CTrade trade;
int hRSI, hSMA, hATR;
datetime lastBarTime = 0;
//+------------------------------------------------------------------+
int OnInit()
{
// Validate symbol
if(Symbol() != "XAUUSD" && StringFind(Symbol(), "GOLD") < 0 &&
StringFind(Symbol(), "XAU") < 0)
Print("Warning: This EA is optimised for XAUUSD");
trade.SetExpertMagicNumber(InpMagicNumber);
trade.SetDeviationInPoints(20);
trade.SetTypeFilling(ORDER_FILLING_FOK);
hRSI = iRSI(_Symbol, PERIOD_CURRENT, InpRSIPeriod, PRICE_CLOSE);
hSMA = iMA(_Symbol, PERIOD_CURRENT, InpSMAPeriod, 0, MODE_SMA, PRICE_CLOSE);
hATR = iATR(_Symbol, PERIOD_CURRENT, InpATRPeriod);
if(hRSI == INVALID_HANDLE || hSMA == INVALID_HANDLE || hATR == INVALID_HANDLE)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.