P
PipsGrowth
ScalpingOpen Source – Free

Pipsgrowth EX14011 Scalper

MT5 Expert Advisor (Open Source) · XAUUSD · M5

Pipsgrowth.com EX14011 SimpleGoldScalper_XAUUSD_5M — WPR/RSI confluence Gold scalper with risk-based lot sizing, full 12-layer stack.

Overview

Pipsgrowth EX14011 is a closed-bar, single-position Gold scalper that fires only when the Williams Percent Range(14) and the Relative Strength Index(14) sit on the same side of their extreme zones on the same M5 bar. The whole entry decision is the AND-gate between two oscillators — there is no regime filter, no trend overlay, no confirmation candle, no news blackout, and no multi-timeframe scan. When both indicators agree that price is stretched, the EA opens one market order in that direction with a hardcoded 300-point stop and a hardcoded 500-point target, then waits for the trade to close before the next signal is even considered.

The bar timing sits in OnTick. The handler refreshes the symbol, checks mysymbol.Spread() > InpMaxSpread (default 250 points, roughly 25 pips on a 5-digit Gold quote) as a hard no-trade gate, and then compares the current bar's iTime against a static lastBar timestamp. If the timestamp matches, OnTick returns immediately — meaning every evaluation, every indicator read, every lot calculation only happens once per fresh M5 bar. Inside CheckSignal the EA first checks PositionsTotal() > 0 and returns if anything is open, so this is strictly a one-position-at-a-time design: the EA will never pyramid, never hedge, never stack a grid, and never enter a second trade while the first is still running.

The signal logic in CheckSignal reads the previous bar's WPR(14) and RSI(14) values via CopyBuffer(hWPR, 0, 1, 1, bufWPR) and CopyBuffer(hRSI, 0, 1, 1, bufRSI). A buy fires only when wpr < -80 AND rsi < 30 — both oscillators saying oversold at the same time. A sell fires only when wpr > -20 AND rsi > 70 — both saying overbought. There is no in-between trigger: if WPR says oversold and RSI says neutral, nothing happens. This AND-conjunction is the entire entry engine. It is also why the EA is so sparse — two handles, two threshold pairs, one buy side, one sell side.

Lot sizing runs through CalculateLotSize(InpStopLoss). When InpRiskPercent > 0 (default 1.0), the function computes riskMoney = account.Balance() * InpRiskPercent / 100.0, then solves lot = riskMoney / riskPerLot where riskPerLot = stopLossPoints * (tickValue / (tickSize / pointVal)). That is a textbook stop-distance risk formula: the broker's tick value and tick size are used to translate the 300-point stop into the per-lot dollar exposure for XAUUSD, and the lot is rounded DOWN to the symbol's LotsStep, then clamped to LotsMin/LotsMax. When InpRiskPercent = 0 the function returns the fixed fallback InpFixedLot = 0.01. There is no compounding, no balance-based scaling beyond the 1% rule, and no per-trade risk override.

Order execution is delegated to the standard CTrade wrapper. OpenBuy sets the SL to Ask - 300 * Point and the TP to Ask + 500 * Point, then calls trade.Buy(lot, _Symbol, mysymbol.Ask(), sl, tp, InpTradeComment). OpenSell mirrors with Bid + 300 * Point and Bid - 500 * Point and trade.Sell(...). trade.SetExpertMagicNumber(22214011) ties every fill to that magic so the EA can identify its own orders in a multi-EA account. trade.SetTypeFilling(ORDER_FILLING_FOK) is hardcoded at OnInit, which is correct for most MT5 brokers that allow Fill-Or-Kill on Gold.

What the EA does NOT do is just as important as what it does. There is no trailing stop, no breakeven move, no partial close, no time-based exit, no equity-protection kill switch, no daily loss limit, no drawdown cap, no margin guard, no news filter, no session filter, no magic-per-symbol guard beyond the magic number, and no OnTester pass. The header advertises a 12-layer stack (REGIME, SIGNAL, ENTRY, CONFIRM, NO-TRADE, CAPITAL CAP, RISK, SIZING, MANAGE, EXIT, SCALING, OnTester) but the code wires only the SIGNAL, ENTRY, NO-TRADE, RISK, and SIZING layers — everything in the MANAGE / EXIT / SCALING / OnTester / REGIME / CONFIRM / CAPITAL CAP section is marketing copy. The file also defines three retry helpers — TryClose_EX14011, TryClosePartial_EX14011, TryModify_EX14011 — that each loop 3 times on REQUOTE / TIMEOUT / PRICE_OFF / PRICE_CHANGED with a 200ms sleep, but none of them are wired into a caller inside the EA. They are dead code, left from a heavier version of the template that this simpler Gold-scalper variant was forked from.

The retry helpers' existence is the strongest tell about the EA's design intent: the author was probably going to add a manage-position pass that calls TryModify_EX14011 to ratchet the stop, and a partial-close pass that calls TryClosePartial_EX14011 to scale out 50% at 1R and let the rest run to TP. None of that is active. The actual position lifecycle is: open with SL/TP set, walk away, let the broker hit one of the two prices, then PositionsTotal() drops to 0 and the EA is allowed to look for the next signal on the next fresh bar.

In backtest this means the equity curve will be a sequence of fixed 5:3 reward-to-risk trades (500 TP / 300 SL) interspersed with skipped bars where one oscillator failed to confirm. The win rate required to break even on a 5:3 bracket is 37.5%; anything above that is profit. Because WPR and RSI are correlated but not identical, the AND-gate filters out a meaningful slice of marginal signals — the trade count will be lower than a single-oscillator system, but the per-trade quality should be higher. The flip side is that during trends that take Gold deep into overbought or oversold for many bars in a row, this EA will keep taking counter-trend entries at the extremes; the lack of a regime filter is by design but is the single biggest risk to know about before going live.

Practically: the EA is best understood as a small, auditable, indicator-confluence prototype. The entire strategy fits in CheckSignal (12 lines of actual logic), the entire money management fits in CalculateLotSize (12 lines), and the entire execution fits in OpenBuy / OpenSell (5 lines each). If you want a Gold scalper you can read end-to-end in two minutes and modify with confidence, this is exactly that. If you want a finished, multi-layered production system, this is the starting point, not the destination — the retry helpers and the 12-layer header are the roadmap for what was intended next.

Strategy Deep Dive

OnTick refreshes the symbol and rejects the tick entirely when spread exceeds 250 raw points, then guards every downstream action behind a static lastBar == iTime check so the signal evaluation, indicator reads, and lot calculation each run exactly once per fresh M5 bar. Inside CheckSignal the EA reads one bar of WPR(14) and one bar of RSI(14) and applies a strict AND gate: WPR<-80 AND RSI<30 arms a buy, WPR>-20 AND RSI>70 arms a sell, anything else is no-trade. CalculateLotSize then sizes the order against a 1%-of-balance risk budget using the broker's tick value and tick size to translate the 300-point stop into a per-lot dollar exposure, floors the result to the symbol's lot step, and clamps it to the broker's min/max lot. OpenBuy and OpenSell attach the hardcoded 300-point SL and 500-point TP to the fill, set the magic to 22214011, and submit a single market order via the CTrade wrapper in FOK mode. After submission, OnTick does nothing else — there is no manage-position pass, no trailing ratchet, no partial close, no time-based exit, and no equity or drawdown guard, so the lifecycle is open-and-walk-away until the broker hits SL or TP. The file defines three retry helpers (TryClose_EX14011, TryClosePartial_EX14011, TryModify_EX14011) that retry 3x with 200ms sleeps on REQUOTE / TIMEOUT / PRICE_OFF / PRICE_CHANGED, but none of them are wired into a caller in the current build — they are dead code left from the heavier template this scalper was forked from.

Entry Signal

Pipsgrowth EX14011 fires a buy only when WPR(14) sits below -80 AND RSI(14) sits below 30 on the just-closed M5 bar — a strict dual-oscillator oversold confluence. A sell fires only when WPR(14) is above -20 AND RSI(14) is above 70 on the same bar. Entries are evaluated once per fresh bar (the OnTick handler skips until iTime advances) and the EA refuses to open a new trade if PositionsTotal() > 0, so it is strictly one position at a time with no pyramiding.

Exit Signal

There is no EA-driven exit logic. Every order is opened with a hardcoded SL and TP attached at fill time, and the EA simply waits for the broker to hit one of them. The next signal is only evaluated after PositionsTotal() drops to 0, which means the EA will not enter a fresh trade until the current one has been closed by SL, TP, manual intervention, or a margin call.

Stop Loss

Every order is opened with a fixed 300-point stop loss attached to the fill. SL is set in raw points (Ask - 300Point for buys, Bid + 300Point for sells) and never modified afterwards — there is no trailing stop, no breakeven move, and no management pass. The same 300-point distance is also fed into CalculateLotSize so the risk-based lot formula sizes against the actual stop distance.

Take Profit

Every order is opened with a fixed 500-point take profit attached to the fill (Ask + 500Point for buys, Bid - 500Point for sells), giving a 5:3 reward-to-risk ratio against the 300-point stop. TP is never modified and there is no scaling out — the entire position either hits TP, hits SL, or is closed externally.

Best For

Best suited for XAUUSD on the M5 timeframe with a minimum recommended balance of $100 (the EA's default 1% risk on a 300-point Gold stop sizes to roughly 0.01-0.03 lots, so even small accounts are workable) and a broker that supports ORDER_FILLING_FOK with raw-point spread on Gold — most ECN and RAW-spread MT5 brokers qualify. The lack of an equity cap and the lack of a session filter mean the EA is the trader's responsibility to babysit or wrap with a parent safety EA; expect signals clustered into the London and New York sessions when Gold volatility is highest, and few or no trades during the quiet Asian session. Slippage tolerance is set very tight at 3 points, so do not run this on a broker with a wide variable spread or a dealing-desk execution model.

Strategy Logic

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

Family: Scalper Magic: 22214011 Version: 2.00

BRIEF: Simple Gold scalper using WPR and RSI confluence for entry signals (oversold/overbought), with risk-based lot sizing and fixed SL/TP in points. 12 layers: REGIME, SIGNAL, ENTRY, CONFIRM, NO-TRADE, CAPITAL CAP, RISK, SIZING, MANAGE, EXIT, SCALING, OnTester

INDICATOR STACK:

  • Standard MT5 indicators

KEY FUNCTIONS:

  • CheckSignal()
  • OpenBuy()
  • OpenSell()
  • CalculateLotSize()
  • TryClose_EX14011()
  • TryClosePartial_EX14011()
  • TryModify_EX14011()

INTERNAL CONSTANTS (0 total):

INPUT PARAMETERS (10 total across 3 groups):

  • [=== Strategy Parameters ===] InpWPRPeriod = 14 // WPR Period
  • [=== Strategy Parameters ===] InpRSIPeriod = 14 // RSI Period
  • [=== Money Management ===] InpRiskPercent = 1.0 // Risk Percent per Trade
  • [=== Money Management ===] InpFixedLot = 0.01 // Fixed Lot (if Risk=0)
  • [=== Money Management ===] InpStopLoss = 300 // Stop Loss (points)
  • [=== Money Management ===] InpTakeProfit = 500 // Take Profit (points)
  • [=== Trade Management ===] InpMagicNumber = 22214011 // Magic Number
  • [=== Trade Management ===] InpTradeComment = "Psgrowth.com Expert_14011" // Trade Comment
  • [=== Trade Management ===] InpMaxSpread = 250 // Max Spread (points)
  • [=== Trade Management ===] InpSlippage = 3 // Slippage
Pseudocode
// Pipsgrowth EX14011 Scalper — Execution Flow (from source analysis)
// Family: Scalper
// Simple Gold scalper using WPR and RSI confluence for entry signals (oversold/overbought), with risk-based lot sizing and fixed SL/TP in points. 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

Optimized Brokers:
ExnessIC Markets
Optimized Symbols:
XAUUSD
Optimized Timeframes:
M5

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
InpWPRPeriod14WPR Period
InpRSIPeriod14RSI Period
InpRiskPercent1.0Risk Percent per Trade
InpFixedLot0.01Fixed Lot (if Risk=0)
InpStopLoss300Stop Loss (points)
InpTakeProfit500Take Profit (points)
InpMagicNumber22214011Magic Number
InpTradeComment"Psgrowth.com Expert_14011"Trade Comment
InpMaxSpread250Max Spread (points)
InpSlippage3Slippage
Source Code (.mq5)Open Source
Pipsgrowth_com_EX14011.mq5
#property copyright "Pipsgrowth.com"
#property link      "https://pipsgrowth.com"
#property version   "2.00"
#property strict
#property description "Pipsgrowth.com EX14011 SimpleGoldScalper_XAUUSD_5M — WPR/RSI confluence Gold scalper with risk-based lot sizing, full 12-layer stack."

#include <Trade\Trade.mqh>
#include <Trade\PositionInfo.mqh>
#include <Trade\SymbolInfo.mqh>
#include <Trade\AccountInfo.mqh>

CTrade         trade;
CPositionInfo  position;
CSymbolInfo    mysymbol;
CAccountInfo   account;

//--- Input Groups
input group "=== Strategy Parameters ==="
input int      InpWPRPeriod      = 14;       // WPR Period
input int      InpRSIPeriod      = 14;       // RSI Period

input group "=== Money Management ==="
input double   InpRiskPercent    = 1.0;      // Risk Percent per Trade
input double   InpFixedLot       = 0.01;     // Fixed Lot (if Risk=0)
input int      InpStopLoss       = 300;      // Stop Loss (points)
input int      InpTakeProfit     = 500;      // Take Profit (points)

input group "=== Trade Management ==="
input int      InpMagicNumber    = 22214011;  // Magic Number
input string   InpTradeComment   = "Psgrowth.com Expert_14011"; // Trade Comment
input int      InpMaxSpread      = 250;      // Max Spread (points)
input int      InpSlippage       = 3;        // Slippage

//--- Handles
int    hWPR;
int    hRSI;

//--- Global Buffers
double bufWPR[];
double bufRSI[];

//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
   trade.SetExpertMagicNumber(InpMagicNumber);
   trade.SetDeviationInPoints(InpSlippage);
   trade.SetTypeFilling(ORDER_FILLING_FOK);

   hWPR = iWPR(_Symbol, _Period, InpWPRPeriod);
   hRSI = iRSI(_Symbol, _Period, InpRSIPeriod, PRICE_CLOSE);
   
   if(hWPR == INVALID_HANDLE || hRSI == INVALID_HANDLE) 
      return(INIT_FAILED);
   
   return(INIT_SUCCEEDED);
  }

//+------------------------------------------------------------------+

Full source code available on download

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

Tags:ex14011scalperpipsgrowthfreemt5xauusd

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_EX14011.mq5
File Size8.7 KB
Versionv2.00
PlatformMetaTrader 5
File Type.mq5 Source
StrategyScalping
Risk LevelHigh Risk
Timeframes
M5
Currency Pairs
XAUUSD
Min. Deposit$100