P
PipsGrowth
ScalpingOpen Source – Free

Pipsgrowth EX10001 Momentum-Scalper

MT5 Expert Advisor (Open Source) · XAUUSD · M5, M15

Pipsgrowth.com EX10001 GoldScalpingEA — 4-vote momentum confluence scalper, full 12-layer stack.

Overview

Pipsgrowth EX10001 Momentum-Scalper turns a single indicator disagreement into a four-way vote. The EA loads eight indicator handles on init — EMA(20), EMA(50), MACD(12,26,9), RSI(14), ATR(14), ADX(14), Bollinger Bands(20,2.0), and a higher-timeframe EMA(50) on H1 — and then on every closed bar of the chosen timeframe (M5 by default, M15 supported) it asks each one to cast a vote.

Four votes are tallied. Vote 1 is the EMA stack: bullish if EMA(20) sits above EMA(50) on the closed bar, bearish if the order is inverted. Vote 2 is the MACD histogram sign (main line minus signal line) — positive for bulls, negative for bears. Vote 3 is an RSI pullback: for a long, the bar-1 RSI has to sit inside the InpRSIBuyLow/InpRSIBuyHigh band (35–72 by default) AND either have risen from bar-2 or already be above 50; the mirror handles shorts. Vote 4 is a body filter — the closed bar's body has to exceed InpBodyAtrMin (0.35) times the ATR(14), and the close must be on the correct side of the open. The EA logs a long when at least InpMinVotes (3) of the 4 votes agree on the bull side and outvote the bear count, and a short on the mirrored condition. Confidence is reported as votes × 25 (so a 4-of-4 reads 100, a 3-of-4 reads 75).

The first guard the EA applies after the vote is the regime classifier. ADX(14) and a 100-bar ATR-percentile calculation drive a seven-state enum: STRONG_TREND (ADX ≥ 35 plus percentile ≥ 0.65), WEAK_TREND (ADX ≥ InpADXMinTrend=20 and percentile ≥ 0.45), BREAKOUT (Bollinger-band-width-to-ATR ratio > 4.5 with high percentile), COMPRESS (percentile ≤ 0.20), EXPAND (percentile ≥ 0.80), CHOPPY (ADX < 12), and RANGE as a fallback. Two of those — CHOPPY and RANGE — return false from RegimeAllowsEntry(), which means the EA sits on its hands during the very conditions where momentum-confluence signals tend to whipsaw most. A regime flip into CHOPPY while a position is open also forces an immediate market exit from ManageExits().

The next two confirmations sit inside ConfirmEntry(). First, the HTF EMA(50) on the H1 chart has to agree with the trade direction — long requires price above the H1 EMA, short requires price below. That single line kills a meaningful slice of counter-trend signals on M5 that the lower-timeframe stack would otherwise have green-lit. Second, an optional ATR-percentile gate (InpATRPctileMin) lets the trader block entries when current ATR(14) sits in the bottom tail of its 100-bar distribution — useful for killing signals during the late-Asian doldrums. A session filter (InpSessionStart, InpSessionEnd) and a minimum R:R check (InpRRMin=1.5) round out the confirm layer.

The exit stack is where the EA earns its keep. Stop and target are both ATR multiples — InpATRSlMult=2.0 and InpATRTpMult=2.0 — which means a 1:1 base R:R that the R:R filter will reject if ATR has expanded enough that the broker-stops level pushes the SL too close. With break-even on (InpUseBreakEven=true, the default), the stop moves to entry plus 1 point once profit reaches 1R, eliminating the risk-of-ruin case where a winning setup rounds-trips into a loss. ATR trailing at InpATRTrailMult=2.6 with a 0.25 step (ATR_TRAIL_STEP_PCT) then ratchets the stop forward as price moves, locking in increments of trailing distance × 0.25. Partial TP is wired in but disabled by default (InpUsePartialTP=false) — the default posture is "let winners run" and rely on the trailing stop to take the rest. Two additional exits are wired into ManageExits(): a time stop at InpMaxBarsInTrade=48 bars on the chosen timeframe, and an opposite-signal exit that closes the position only when the fresh MomentumSignal call returns a counter-direction with confidence ≥ 75. A position can therefore stay open for a long time when the higher-timeframe trend keeps agreeing, but a 4-vote opposite flip is enough to bail out.

The risk envelope is conservative for a 4-vote momentum system but aggressive in absolute terms. InpRiskPercent=2.0% of effective capital is the per-trade risk; the daily loss ceiling is 15% of effective capital, the weekly ceiling 25%. Effective capital is account equity unless InpCapitalCapAmount > 0, in which case the EA treats the cap as the working capital (a useful feature for prop-firm accounts and staged rollouts). InpCapitalCapFloor=50 blocks new entries when effective capital dips below $50. Lot sizing is computed from the actual SL distance, tick value, and tick size — not from a fixed lot — so a 2x-ATR SL on a quiet day produces a larger lot than the same SL on a high-ATR day. MarginOK demands 20% more free margin than OrderCalcMargin reports needed. The whole position is held in a per-magic single slot (InpMaxConcurrent=1, InpMaxSymbol=1) and a 2-bar cooldown (InpCooldownAfterLoss) fires after the consecutive-loss counter, which UpdateLossTracking() rebuilds from the deal stream every tick by counting DEAL_ENTRY_OUT records for this magic.

For backtesting, expect the EA to look best on XAUUSD M5 over periods where gold trended in clean swings and to underperform during the August-through-October compression that gold typically posts. The ADX ≥ 20 filter plus the H1 EMA(50) agreement will both cut a chunk of the headline trade count — typical runs land well under 100 trades per year on a single symbol — but the survivors tend to carry the bulk of the equity curve. Test with the default vote threshold of 3, but try lifting it to 4 to see the impact on drawdown; the 1:1 SL/TP baseline combined with the trailing stop is what gives the equity curve its shape, not the per-trade win rate.

The InpDryRun flag is a one-click switch that prints the full intent — direction, lots, prices, SL, TP, and the g_lastNoTradeReason string — to the log without sending orders, which is the right way to verify the EA's behavior in a Strategy-Tester visual-mode pass before going live.

Strategy Deep Dive

Pipsgrowth EX10001 runs a per-tick loop in OnTick() that calls CopyAllIndicators() across EMA(20), EMA(50), MACD, RSI(14), ATR(14), ADX(14), Bollinger Bands, and a separate EMA(50) on the H1 chart, then runs ManageExits() to service break-even, trailing, partial TP, time-stop, regime-flip, and opposite-signal exits. On a new bar (IsNewBar()=true), NoTradeBlocked() checks the kill switch, spread cap, capital cap floor, position count caps, terminal/EA trade-allowed flags, daily/weekly realized loss (15%/25% of effective capital), and a cooldown after consecutive losses. ClassifyRegime() then maps ADX(14) and an ATR(100) percentile distribution to one of seven regime states; CHOPPY and RANGE return false from RegimeAllowsEntry(). MomentumSignal() tallies the four votes (EMA stack, MACD histogram sign, RSI pullback inside 35–72 / 28–65, body>0.35×ATR) and demands at least 3-of-4 agreement. ConfirmEntry() then layers in the H1 EMA agreement, the optional ATR-percentile floor, the session window, and the 1.5 R:R minimum before CalcLotByRisk() sizes the lot from the actual SL distance and SendOrder() places the trade with a 20-point deviation and a 1-retry on requote/price-change/connection/timeout. The whole order flow lives under a single-position-per-symbol cap (InpMaxConcurrent=1, InpMaxSymbol=1).

Entry Signal

Pipsgrowth EX10001 enters on a 4-vote momentum confluence on the closed bar, requiring at least 3 of 4 votes to agree (InpMinVotes=3): EMA(20)>EMA(50) stack, MACD histogram sign, RSI(14) pullback in the 35–72 buy band (or mirror sell band), and a bar body larger than 0.35×ATR(14). ConfirmEntry() then gates the signal through the H1 EMA(50) higher-timeframe trend filter, an optional ATR-percentile minimum, the configured session window, and a minimum 1.5 R:R check. The regime classifier blocks entries when ADX(14) classifies the market as CHOPPY or RANGE.

Exit Signal

Pipsgrowth EX10001 runs ManageExits() on every tick. It forces a market close when the regime flips to CHOPPY, when a position ages past 48 bars on the signal timeframe (InpMaxBarsInTrade), and when a fresh MomentumSignal returns the opposite direction with confidence ≥ 75 (votes × 25). For actively-managed winners, the stop is moved to entry+1 point at 1R profit (break-even), then ratcheted by an ATR(2.6×) trailing stop with 0.25-step increments. With InpUsePartialTP off (default), the trade runs the trailing stop to its conclusion; with it on, 50% is closed at 1.5R and the stop is re-marked.

Stop Loss

Per-trade stop is InpATRSlMult (default 2.0) × ATR(14), floored to the broker's SYMBOL_TRADE_STOPS_LEVEL. The stop is then moved to entry+1 point once profit reaches 1R (InpUseBreakEven=true default) and ratcheted higher by an ATR-trailing stop at 2.6×ATR with 0.25-step increments. Global hard stops are 15% daily and 25% weekly realized loss of effective capital, and the position is closed immediately if the regime flips to CHOPPY.

Take Profit

Take-profit is InpATRTpMult (default 2.0) × ATR(14) — a 1:1 base R:R. ConfirmEntry() rejects the order if the resulting distance falls below the configured InpRRMin=1.5 R:R after rounding to the stops level. With InpUsePartialTP off (the default), the trailing stop is the de-facto exit; with it on, 50% of the position is closed at 1.5R profit and the remainder runs the trailing stop to its conclusion.

Best For

Pipsgrowth EX10001 is configured for a $100 minimum deposit on XAUUSD M5 (M15 supported) at HIGH risk, with 2% per-trade risk and 15%/25% daily/weekly realized loss caps. It is intended for traders who can keep a low-spread gold feed live 24/7 (or at least through the configured InpSessionStart/InpSessionEnd window — defaults to all-session) and who want a vote-based momentum signal that explicitly avoids CHOPPY and RANGE regimes. The single-position cap and per-magic cooldown make it suitable for staged prop-firm rollouts (set InpCapitalCapAmount to the funded allocation); the InpDryRun flag is the right way to validate behavior in the Strategy Tester before live use.

Strategy Logic

Pipsgrowth EX10001 Momentum-Scalper — Strategy Logic Analysis (from .mq5 source)

Family: Momentum-Scalper Magic: 22210001 Version: 2.00

BRIEF: 4-vote momentum confluence on CLOSED bar: (1) EMA20>EMA50 stack side, (2) MACD histogram sign agrees, (3) RSI pullback (BUY: 40<RSI<70 prev dipped toward 40; SELL mirror), (4) body > 0.30*ATR (momentum bar). Long if >=3 of 4 votes agree. 12 layers: REGIME, SIGNAL, ENTRY, CONFIRM, NO-TRADE, CAPITAL CAP, RISK, SIZING, MANAGE, EXIT, SCALING, OnTester. Consolidated from 22 identical GoldScalpingEA variants (Expert_500–Expert_542, same logic, different magics)

INDICATOR STACK:

  • Standard MT5 indicators

KEY FUNCTIONS:

  • DayStart()
  • WeekStart()
  • EffectiveCapital()
  • TodayRealizedPnL()
  • WeeklyRealizedPnL()
  • CountMyPositions()
  • CountMySymbolPositions()
  • NormalizePrice()
  • NormalizeVolume()
  • StopsLevelPrice()
  • CurrentSpreadPoints()
  • IsNewBar()
  • ...and 17 more

INTERNAL CONSTANTS (1 total):

  • MAX_RETRIES = 1 // ============================== GLOBALS ================================

INPUT PARAMETERS (29 total across 6 groups):

  • [=== Identity ===] InpMagic = 22210001 // Magic number
  • [=== Identity ===] InpTradeComment = "Psgrowth.com Expert_10001" // Trade comment
  • [=== Identity ===] InpTimeframe = 5 // Timeframe (1=M1,2=M5,3=M15,4=M30,5=H1,6=H4,7=D1) // Signal timeframe
  • [=== Identity ===] InpDryRun = false // Dry-run (no live orders)
  • [=== Risk & Sizing ===] InpRiskPercent = 2.0 // Risk per trade, % of effective_capital
  • [=== Risk & Sizing ===] InpDailyLossLimitPct = 15.0 // Daily loss limit, % of effective_capital
  • [=== Risk & Sizing ===] InpWeeklyLossLimitPct = 25.0 // Weekly loss limit, % of effective_capital
  • [=== Risk & Sizing ===] InpMaxConcurrent = 1 // Max concurrent positions (this EA)
  • [=== Risk & Sizing ===] InpMaxSymbol = 1 // Max positions on this symbol (this EA)
  • [=== Risk & Sizing ===] InpCooldownAfterLoss = 2 // Cooldown bars after consecutive losses
  • [=== Capital Allocation Cap ===] InpCapitalCapAmount = 0.0 // Cap amount, equity $
  • [=== Capital Allocation Cap ===] InpCapitalCapFloor = 50.0 // Floor; block entries below
  • [=== Signal ===] InpMinVotes = 3 // Min momentum votes (of 4) to trigger
  • [=== Signal ===] InpADXMinTrend = 20.0 // ADX min for trend regimes
  • [=== Signal ===] InpRRMin = 1.5 // Min reward:risk ratio
  • [=== Exit / Manage ===] InpMaxBarsInTrade = 48 // Max bars in trade (time exit)
  • [=== Exit / Manage ===] InpKillSwitch = false // Kill switch (block all)
  • [=== Tunable Strategy ===] InpATRSlMult = 2.0 // ATR Stop-Loss multiplier
  • [=== Tunable Strategy ===] InpATRTpMult = 2.0 // ATR Take-Profit multiplier
  • [=== Tunable Strategy ===] InpATRTrailMult = 2.6 // ATR Trailing multiplier
  • [=== Tunable Strategy ===] InpBodyAtrMin = 0.35 // Min body/ATR ratio for momentum bar
  • [=== Tunable Strategy ===] InpSessionStart = 0 // Session start hour (0=24h)
  • [=== Tunable Strategy ===] InpSessionEnd = 24 // Session end hour (24=24h)
  • [=== Tunable Strategy ===] InpSpreadMax = 100 // Max spread points
  • [=== Tunable Strategy ===] InpRSIBuyLow = 35.0 // RSI buy zone low
  • [=== Tunable Strategy ===] InpRSIBuyHigh = 72.0 // RSI buy zone high
  • [=== Tunable Strategy ===] InpUsePartialTP = false // Use partial take-profit (false=let winners run)
  • [=== Tunable Strategy ===] InpUseBreakEven = true // Use break-even stop
  • [=== Tunable Strategy ===] InpATRPctileMin = 0.0 // Min ATR percentile for entries (0=off)
Pseudocode
// Pipsgrowth EX10001 Momentum-Scalper — Execution Flow (from source analysis)
// Family: Momentum-Scalper
// 4-vote momentum confluence on CLOSED bar: (1) EMA20>EMA50 stack side, (2) MACD histogram sign agrees, (3) RSI pullback (BUY: 40<RSI<70 prev dipped toward 40; SELL mirror), (4) body > 0.30*ATR (momentum bar). Long if >=3 of 4 votes agree. 12 layers: REGIME, SIGNAL, ENTRY, CONFIRM, NO-TRADE, CAPITAL CAP, RISK, SIZING, MANAGE, EXIT, SCALING, OnTester. Consolidated from 22 identical GoldScalpingEA variants (Expert_500–Expert_542, same logic, different magics)

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:
M5M15

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
InpMagic22210001Magic number
InpTradeComment"Psgrowth.com Expert_10001"Trade comment
InpTimeframe5Timeframe (1=M1,2=M5,3=M15,4=M30,5=H1,6=H4,7=D1) // Signal timeframe
InpDryRunfalseDry-run (no live orders)
InpRiskPercent2.0Risk per trade, % of effective_capital
InpDailyLossLimitPct15.0Daily loss limit, % of effective_capital
InpWeeklyLossLimitPct25.0Weekly loss limit, % of effective_capital
InpMaxConcurrent1Max concurrent positions (this EA)
InpMaxSymbol1Max positions on this symbol (this EA)
InpCooldownAfterLoss2Cooldown bars after consecutive losses
InpCapitalCapAmount0.0Cap amount, equity $
InpCapitalCapFloor50.0Floor; block entries below
InpMinVotes3Min momentum votes (of 4) to trigger
InpADXMinTrend20.0ADX min for trend regimes
InpRRMin1.5Min reward:risk ratio
InpMaxBarsInTrade48Max bars in trade (time exit)
InpKillSwitchfalseKill switch (block all)
InpATRSlMult2.0ATR Stop-Loss multiplier
InpATRTpMult2.0ATR Take-Profit multiplier
InpATRTrailMult2.6ATR Trailing multiplier
InpBodyAtrMin0.35Min body/ATR ratio for momentum bar
InpSessionStart0Session start hour (0=24h)
InpSessionEnd24Session end hour (24=24h)
InpSpreadMax100Max spread points
InpRSIBuyLow35.0RSI buy zone low
InpRSIBuyHigh72.0RSI buy zone high
InpUsePartialTPfalseUse partial take-profit (false=let winners run)
InpUseBreakEventrueUse break-even stop
InpATRPctileMin0.0Min ATR percentile for entries (0=off)
Source Code (.mq5)Open Source
Pipsgrowth_com_EX10001.mq5
#property copyright "Pipsgrowth.com"
#property link      "https://pipsgrowth.com"
#property version   "2.00"
#property strict
#property description "Pipsgrowth.com EX10001 GoldScalpingEA — 4-vote momentum confluence scalper, full 12-layer stack."

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

CTrade          Trade;
CPositionInfo   PosInfo;
CSymbolInfo     SymInfo;

//============================== INPUTS =================================
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;
   }
}
input group "=== Identity ==="
input long           InpMagic            = 22210001;        // Magic number
input string         InpTradeComment     = "Psgrowth.com Expert_10001";// Trade comment
input int InpTimeframe = 5; // Timeframe (1=M1,2=M5,3=M15,4=M30,5=H1,6=H4,7=D1)      // Signal timeframe
input bool           InpDryRun           = false;            // Dry-run (no live orders)

input group "=== Risk & Sizing ==="
input double         InpRiskPercent      = 2.0;             // Risk per trade, % of effective_capital
input double         InpDailyLossLimitPct= 15.0;             // Daily loss limit, % of effective_capital
input double         InpWeeklyLossLimitPct=25.0;             // Weekly loss limit, % of effective_capital
input int            InpMaxConcurrent     = 1;              // Max concurrent positions (this EA)
input int            InpMaxSymbol         = 1;              // Max positions on this symbol (this EA)
input int            InpCooldownAfterLoss = 2;              // Cooldown bars after consecutive losses

Full source code available on download

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

Tags:ex10001momentum-scalperpipsgrowthfreemt5xauusd

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