P
PipsGrowth
ScalpingOpen Source – Free

Pipsgrowth EX10008 Momentum-Scalper

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

Pipsgrowth.com EX10008 XAUUSD Scalper — multi-state regime-dispatched momentum scalper, full 12-layer stack.

Overview

Pipsgrowth EX10008 Momentum-Scalper is a regime-dispatched XAUUSD scalper that classifies each closed bar into one of five market states — TREND_UP, TREND_DOWN, RANGE, VOLATILE, or QUIET — and then routes to a different signal logic depending on which state it finds. The classification is computed inside ClassifyMarketState() from a fast EMA(9), a slow EMA(21), the current ATR(14), and the Bollinger Band middle line: when the ATR-to-midline ratio is below 0.1 the bar is QUIET (no trading at all), when it is above 0.5 the bar is VOLATILE (a hard regime that requires triple-confirmation), and when |FastEMA − SlowEMA| exceeds half of ATR the state is one of the two trend states. Everything else is RANGE. This dispatching is the architectural centre of the EA: rather than applying a single signal formula to every bar, the code switches on g_marketState and uses a tailored entry condition for each branch.

In the TREND_UP branch the EA looks for a fast EMA crossing above the slow EMA on the closed bar, or alternatively an oversold RSI(7) reading (below 25) combined with a close above the slow EMA. The mirror condition fires in TREND_DOWN: fast EMA crossing below slow, or RSI(7) above 75 with a close below the slow EMA. The RANGE branch is a mean-reversion read: a touch of the lower Bollinger Band (with a 0.1% tolerance) combined with either an oversold RSI or a bullish RSI divergence fires a buy, and the upper-band touch fires a sell. VOLATILE is the strictest branch — it requires a three-factor AND: the appropriate EMA cross, the matching RSI extreme, and the matching Bollinger touch. QUIET is silent; the default case returns no signal. The confidence score attached to each signal is also state-specific: trend signals use min(100, |EMA-fast − EMA-slow| / ATR × 50 + 25), range signals use (25 − RSI) × 3 + 40, and the volatile branch sets a flat 90.

Before any state-dispatched signal reaches the entry path it must clear two global filters. IsVolumeSpike() requires the previous bar's tick volume to exceed 1.5× the average of the prior five bars. HasSufficientMomentum() requires the absolute FastEMA delta between the last two closed bars to be at least 50 points. Both toggles can be switched off via the InpUseVolumeFilter and InpUseMomentumFilter inputs, but they default to true because they are the principal protection against false breakouts in fast gold moves.

A second, redundant confirmation sits between the signal and the order: RegimeOK() reads ADX(14) and rejects entries when the main ADX line is below 18. It also reads the last 52 ATR values to compute an ATR-percentile against its own moving average, and rejects trades when the percentile is below 15 (dead tape) or above 95 (news spike). A third sub-check reads the last 10 Bollinger-width readings and rejects when the band is in a tight squeeze below 10% of its own moving average. The optional InpHTFConfirm input then layers an M15 EMA(50) / EMA(200) agreement check on top — when the M15 fast EMA is below the slow EMA, no buy fires, and vice versa. This HTF layer is the most consequential single input in the EA: it does not change what is computed, it only gates whether the result is allowed to send an order.

Position sizing is risk-percentage based on InpRiskPercent (default 0.7% of effective capital) with a InpFixedLot fallback of 0.01 lots when risk calculation is invalid. CalcLotForATRStop() uses lossPerLot = (ATR × 1.5 / tickSize) × tickValue and divides the risk money by that. The SL is placed at entry − ATR × 1.5 (or mirror for short) and the TP at entry + ATR × 2.0 — a 1.5:2.0 ratio, i.e. an R-multiple of 1.33 against the stop. The stop distance is also floored at the symbol's SYMBOL_TRADE_STOPS_LEVEL so the broker never rejects the order for stop-distance violation. When InpCapitalCapAmount > 0 the EA treats that figure as the effective capital ceiling, plus today's realized PnL, which means a profitable day expands the sizing base on every subsequent trade until the session resets.

Trade management runs on every tick in ManageTrades(). When profit reaches one R the stop is moved to entry + 15 points (or mirror) — a break-even lock with a small offset to absorb spread. At the same R threshold, half of the position is closed if the remaining volume is at least 1.5× the broker's minimum lot, and the comment is tagged with [P] to prevent a second partial. From the same R, an ATR(14) trail follows price at a distance of one ATR; the stop is ratcheted forward only, never backward. There is no ratchet at fractional R levels — the three behaviours (BE, partial, trail) all switch on at exactly 1.0 R, which is the deliberate simplification that makes the management state easy to inspect in a backtest. A separate time-exit closes any trade that has been open for 240 bars (20 hours of M5), and RegimeOK failing on the ADX leg causes an immediate regime-change exit.

The no-trade gate combines daily and weekly realized PnL against InpDailyLossLimitPercent (5%) and InpWeeklyLossLimitPercent (10%) of effective capital, computed from the deal history stream. A capital-floor check blocks entries when the effective capital falls below InpCapitalCapFloor (50 USD by default). A cooldown activates after three consecutive losing closes — UpdateConsecutiveAfterClose() reads the last hour of deal history, increments a counter on each negative close, and blocks new entries for the next three closed bars (15 minutes on M5). A spread filter rejects entries when the symbol spread exceeds 50 points or, if SYMBOL_TRADE_STOPS_LEVEL is wider, four times that level. A secondary filter requires the ATR in points to be at least 3.5× the spread, killing low-volatility high-spread regimes that look entry-attractive but actually pay out nothing after costs. The session window is hardcoded to server hours 8 through 20, and weekend protection closes the book on Friday after 22:00 and refuses to open on Saturday or Sunday. IsNewsTime() adds a Friday-only NFP blackout between hours 12 and 16 for the first seven days of the month, blocking entries without forcing a position close.

InpDryRun defaults to true — the EA prints the full signal context, regime state, and order parameters in the log but does not send anything. The user must explicitly set it to false to take the EA live, and the on-screen tag [DRY-RUN] makes the state obvious in the Experts log. InpKillSwitch is a separate input that, when true, calls CloseAllOurPositions() on the next tick and stops opening anything. The pyramid code is present and functional but disabled by default: InpEnablePyramid = false. When enabled, it adds to the most profitable open position only, only if that position has moved at least 1.5× ATR in profit, and only up to a hard cap of 3 levels; a new pyramid entry also has to clear RegimeOK and the order margin check before it sends. The filling mode is auto-picked from the symbol's SYMBOL_FILLING_MODE mask in the order FOK > IOC > RETURN. Send retries use 40 points of deviation, with a single refresh-rates retry on REQUOTE, PRICE_OFF, or TIMEOUT; close and partial-close operations use 200 ms backoff for up to three attempts on the same retcodes plus PRICE_CHANGED; modifies use 100 ms backoff for the same set. The OnTester fitness function is (net × profitFactor) / (1 + balance-DD-%), gated by a minimum of 30 trades — anything below 30 trades returns 0 so the strategy tester can prune statistically meaningless passes.

What this EA will look like in a backtest: an XAUUSD M5 chart with a 9/21 EMA stack, Bollinger Bands at 20/2.0, an M15 trend-confirm overlay, and a relatively low trade frequency because the regime classifier and triple-confirmation rules filter most bars out. The trade count per week is small, the win rate is moderate, and most of the equity curve comes from the asymmetry of the partial-TP-at-1R exit combined with the ATR trail. The most common failure mode is the EA being glued to the QUIET or RANGE state during a transition into a trend, which is why the HTF confirm toggle is the right place to start tuning: turning it off raises trade count at the cost of lower-quality signals, and turning it on with a stricter threshold (e.g. M30 instead of M15) trades count for stability.

Strategy Deep Dive

Each closed bar runs through ClassifyMarketState() which uses EMA(9)/EMA(21) separation versus ATR and the ATR-to-Bollinger-midline ratio to assign one of five states (TREND_UP, TREND_DOWN, RANGE, VOLATILE, QUIET). EvaluateSignal() then dispatches a state-specific entry formula: trend branches look for EMA crosses or RSI(7) extremes with close-vs-slow-EMA confirmation; RANGE looks for Bollinger touches paired with RSI extremes or divergences; VOLATILE requires a triple AND of cross + extreme + touch. Two pre-filters run before any signal can fire — IsVolumeSpike() at 1.5× the prior five-bar volume average, and HasSufficientMomentum() requiring a 50-point FastEMA delta — and RegimeOK() then gates on ADX(14) ≥ 18, an ATR-percentile band of 15–95, and a Bollinger width above 10% of its own moving average. The optional InpHTFConfirm adds an M15 EMA(50) vs EMA(200) agreement check that does not change the signal, only whether it is allowed to send. Sizing is risk-percent based via CalcLotForATRStop(), with the SL floored at the symbol's SYMBOL_TRADE_STOPS_LEVEL and the TP placed at 1.5:2.0 of the stop distance. ManageTrades() runs on every tick and stacks three exits at the 1.0 R level — a 50% partial close, a break-even stop at entry + 15 points, and an ATR(14) trail — plus an opposite-signal close, an ADX-regime-change close, and a 240-bar time exit. The no-trade gate layers capital-floor, daily-loss (5%), weekly-loss (10%), cooldown-after-three-losses (3 bars), spread cap (50 points or 4× stops level), ATR/spread ratio ≥ 3.5, session 8–20 server time, weekend protection, and a Friday-only NFP blackout. OnTester returns (net × PF) / (1 + DD%), gated by a 30-trade minimum.

Entry Signal

Entries are dispatched by a five-state regime classifier (ClassifyMarketState()) that reads EMA(9)/EMA(21) separation vs ATR and the ATR-to-Bollinger-midline ratio. In TREND_UP the EA buys on a fast EMA cross above slow or on RSI(7) below 25 with a close above the slow EMA; in TREND_DOWN the mirror fires on a fast EMA cross below slow or RSI(7) above 75 with a close below slow. RANGE entries require a Bollinger Band touch plus an oversold/overbought RSI or an RSI divergence; VOLATILE entries require a triple AND of EMA cross, RSI extreme, and band touch; QUIET emits no signals. Two global pre-filters — IsVolumeSpike() at 1.5× the prior 5-bar average and HasSufficientMomentum() requiring a 50-point FastEMA delta — must clear before any state signal reaches the order path, and RegimeOK() then gates on ADX ≥ 18 plus an ATR-percentile band of 15–95 plus a non-squeezed Bollinger width.

Exit Signal

Exits run on every tick inside ManageTrades(). An opposite-direction signal from the state dispatcher closes the position immediately (tag "opp-signal"); a regime failure on the ADX leg closes with tag "regime-change-ADX"; and a hard time exit fires at 240 bars (20 hours on M5) with tag "max-bars-reached". From the 1.0 R threshold a partial close of 50% of the position fires (tagged [P] to prevent a second partial) and a break-even stop is set at entry + 15 points with a mirror rule for shorts; from the same threshold an ATR(14) trail begins following price at one ATR distance and only ratchets forward.

Stop Loss

Per-trade stop is placed at entry − ATR(14) × 1.5 (or mirror for shorts) inside CalcLotForATRStop(), with a floor at the symbol's SYMBOL_TRADE_STOPS_LEVEL so the broker never rejects the order for stop-distance violation. Position sizing is risk-percent based: 0.7% of effective capital is the maximum loss per trade, with InpFixedLot = 0.01 as the fallback when risk calc is invalid. After 1.0 R of profit, ManageTrades() ratchets the stop to entry + 15 points and then trails at one ATR(14).

Take Profit

Per-trade TP is set at entry + ATR(14) × 2.0 (or mirror for shorts), giving a 1.5:2.0 stop-to-target ratio and an R-multiple of 1.33 against the stop distance. At the 1.0 R threshold ManageTrades() closes 50% of the position (only when the remaining volume is at least 1.5× the broker's minimum lot) and lets the remainder run under the ATR trail rather than a fixed second target. There is no second TP level — the trade ends via the trail, an opposite signal, the time exit at 240 bars, or a regime change.

Best For

Best on a single XAUUSD chart on M5 (also works on M1 and M15 per the file header) with an ECN or RAW-spread account — the EA's 50-point spread cap and 3.5× ATR/spread ratio filter punish wide-spread broker setups. Minimum recommended balance: $100 (the EA's own input floor for the capital cap), but a $500+ account gives the daily 5% / weekly 10% loss limits enough room to survive a normal losing streak. Trade during the server-hour window of 8 to 20, which corresponds to London and the New York morning for most MT5 brokers — the Friday 22:00 cutoff, the Saturday/Sunday block, and the NFP-day-≤7 12:00–16:00 blackout must be respected. Avoid the QUIET regime (visible as ATR/bbMid < 0.1%) by skipping thin Asian-session hours. The InpDryRun input is true by default and must be explicitly set to false before any live order can fire.

Strategy Logic

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

Family: Momentum-Scalper Magic: 22210008 Version: 2.00

BRIEF: Multi-state XAUUSD scalper. Classifies bar (FastEMA/ SlowEMA separation vs ATR, ATR-vs-mid %) into TREND_UP/DOWN, RANGE, VOLATILE, QUIET, then dispatches: Trending = EMA cross OR RSI extreme + close>SlowEMA; Ranging = BB touch + RSI extreme/divergence; Volatile = 3-factor AND. Volume-spike + EMA-momentum filters on every signal. Closed-bar only. 12 layers: REGIME, SIGNAL, ENTRY, CONFIRM, NO-TRADE, CAPITAL CAP, RISK, SIZING, MANAGE, EXIT, SCALING, OnTester

INDICATOR STACK:

  • Standard MT5 indicators

KEY FUNCTIONS:

  • ComputeEffectiveCapital()
  • UpdateRealizedPnL()
  • IsNewsTime()
  • RegimeOK()
  • EvaluateSignal()
  • IsVolumeSpike()
  • HasSufficientMomentum()
  • CheckDivergence()
  • ConfirmOK()
  • CountOurPositions()
  • CountOurPositionsByType()
  • CalcLotForATRStop()
  • ...and 12 more

INTERNAL CONSTANTS (42 total):

  • DEF_FAST_EMA_PERIOD = 9 // Fast EMA period (source thesis)
  • DEF_SLOW_EMA_PERIOD = 21 // Slow EMA period (source thesis)
  • DEF_RSI_PERIOD = 7 // RSI period (source thesis, fast)
  • DEF_RSI_OVERSOLD = 25.0 // RSI oversold (source thesis)
  • DEF_RSI_OVERBOUGHT = 75.0 // RSI overbought (source thesis)
  • DEF_BB_PERIOD = 20 // BB period (source thesis)
  • DEF_BB_DEVIATION = 2.0 // BB deviation (source thesis)
  • DEF_ATR_PERIOD = 14 // ATR period (source thesis)
  • DEF_ATR_SL_MULT = 1.5 // ATR SL multiplier (source thesis)
  • DEF_ATR_TP_MULT = 2.0 // ATR TP multiplier (source thesis)
  • DEF_VOL_SPIKE_MULT = 1.5 // Volume spike multiplier (source thesis)
  • DEF_VOL_LOOKBACK = 5 // Volume average lookback bars (source thesis)
  • DEF_MOMENTUM_BARS = 2 // Momentum lookback bars (FastEMA delta)
  • DEF_MIN_MOMENTUM_POINTS = 50 // Min momentum (FastEMA delta in points)
  • DEF_DIVERGENCE_LOOKBACK = 5 // RSI divergence swing lookback
  • ...and 27 more

INPUT PARAMETERS (17 total across 7 groups):

  • [=== Identity ===] InpMagic = 22210008 // Magic number
  • [=== Identity ===] InpTradeComment = "Psgrowth.com Expert_10008" // Trade comment
  • [=== Identity ===] InpDryRun = true // Dry-run (no live sends)
  • [=== Identity ===] InpKillSwitch = false // Kill switch (closes-all on tick)
  • [=== Risk & Sizing ===] InpRiskPercent = 0.7 // Risk per trade (% of effective capital)
  • [=== Risk & Sizing ===] InpFixedLot = 0.01 // Fixed lot fallback (used when Risk%<=0)
  • [=== Risk & Sizing ===] InpDailyLossLimitPercent = 5.0 // Daily loss limit (% of effective capital)
  • [=== Risk & Sizing ===] InpWeeklyLossLimitPercent = 10.0 // Weekly loss limit (% of effective capital)
  • [=== Risk & Sizing ===] InpMaxConcurrent = 2 // Max concurrent positions (this EA+symbol)
  • [=== Capital Allocation Cap ===] InpCapitalCapAmount = 0.0 // Capital cap amount ($ REAL MONEY equity)
  • [=== Capital Allocation Cap ===] InpCapitalCapFloor = 50.0 // Floor below which new entries are blocked ($)
  • [=== Signal (state-dispatched EMA/RSI/BB) ===] InpUseVolumeFilter = true // Volume-spike filter (source thesis)
  • [=== Signal (state-dispatched EMA/RSI/BB) ===] InpUseMomentumFilter = true // EMA momentum filter (source thesis)
  • [=== Regime / Confirm ===] InpMinADX = 18.0 // Minimum ADX main (state-dispatch threshold)
  • [=== Regime / Confirm ===] InpHTFConfirm = true // Confirm with HTF EMA(50>200) trend agreement
  • [=== Exit / Manage ===] InpATRMultiplier = 1.5 // ATR SL multiplier (rDist scaling)
  • [=== Scaling (Pyramid) ===] InpEnablePyramid = false // Enable pyramiding (default OFF)
Pseudocode
// Pipsgrowth EX10008 Momentum-Scalper — Execution Flow (from source analysis)
// Family: Momentum-Scalper
// Multi-state XAUUSD scalper. Classifies bar (FastEMA/ SlowEMA separation vs ATR, ATR-vs-mid %) into TREND_UP/DOWN, RANGE, VOLATILE, QUIET, then dispatches: Trending = EMA cross OR RSI extreme + close>SlowEMA; Ranging = BB touch + RSI extreme/divergence; Volatile = 3-factor AND. Volume-spike + EMA-momentum filters on every signal. Closed-bar only. 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:
M5M1M15

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
InpMagic22210008Magic number
InpTradeComment"Psgrowth.com Expert_10008"Trade comment
InpDryRuntrueDry-run (no live sends)
InpKillSwitchfalseKill switch (closes-all on tick)
InpRiskPercent0.7Risk per trade (% of effective capital)
InpFixedLot0.01Fixed lot fallback (used when Risk%<=0)
InpDailyLossLimitPercent5.0Daily loss limit (% of effective capital)
InpWeeklyLossLimitPercent10.0Weekly loss limit (% of effective capital)
InpMaxConcurrent2Max concurrent positions (this EA+symbol)
InpCapitalCapAmount0.0Capital cap amount ($ REAL MONEY equity)
InpCapitalCapFloor50.0Floor below which new entries are blocked ($)
InpUseVolumeFiltertrueVolume-spike filter (source thesis)
InpUseMomentumFiltertrueEMA momentum filter (source thesis)
InpMinADX18.0Minimum ADX main (state-dispatch threshold)
InpHTFConfirmtrueConfirm with HTF EMA(50>200) trend agreement
InpATRMultiplier1.5ATR SL multiplier (rDist scaling)
InpEnablePyramidfalseEnable pyramiding (default OFF)
Source Code (.mq5)Open Source
Pipsgrowth_com_EX10008.mq5
#property copyright "Pipsgrowth.com"
#property link      "https://pipsgrowth.com"
#property version   "2.00"
#property strict
#property description "Pipsgrowth.com EX10008 XAUUSD Scalper — multi-state regime-dispatched momentum scalper, full 12-layer stack."

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

//--- Non-operator tunables (kept as #define to keep input count <= 22) ---//
#define DEF_FAST_EMA_PERIOD       9          // Fast EMA period (source thesis)
#define DEF_SLOW_EMA_PERIOD       21         // Slow EMA period (source thesis)
#define DEF_RSI_PERIOD            7          // RSI period (source thesis, fast)
#define DEF_RSI_OVERSOLD          25.0       // RSI oversold (source thesis)
#define DEF_RSI_OVERBOUGHT        75.0       // RSI overbought (source thesis)
#define DEF_BB_PERIOD             20         // BB period (source thesis)
#define DEF_BB_DEVIATION          2.0        // BB deviation (source thesis)
#define DEF_ATR_PERIOD            14         // ATR period (source thesis)
#define DEF_ATR_SL_MULT           1.5        // ATR SL multiplier (source thesis)
#define DEF_ATR_TP_MULT           2.0        // ATR TP multiplier (source thesis)
#define DEF_VOL_SPIKE_MULT        1.5        // Volume spike multiplier (source thesis)
#define DEF_VOL_LOOKBACK          5          // Volume average lookback bars (source thesis)
#define DEF_MOMENTUM_BARS         2          // Momentum lookback bars (FastEMA delta)
#define DEF_MIN_MOMENTUM_POINTS   50        // Min momentum (FastEMA delta in points)
#define DEF_DIVERGENCE_LOOKBACK   5          // RSI divergence swing lookback
#define DEF_BBW_PCT_LO            10         // BB-width percentile min
#define DEF_ATR_PCT_LOOKBACK      50         // ATR-percentile lookback
#define DEF_ATR_PCT_LO            15         // ATR percentile min
#define DEF_ATR_PCT_HI            95         // ATR percentile max
#define DEF_HTF_TF                PERIOD_M15 // HTF trend timeframe
#define DEF_HTF_FAST_PERIOD       50         // HTF fast EMA
#define DEF_HTF_SLOW_PERIOD       200        // HTF slow EMA
#define DEF_SESSION_START         8          // London/NY session start (server hour)
#define DEF_SESSION_END           20         // Session end hour (source thesis)
#define DEF_NEWS_NFP_DAY_MAX      7          // NFP Friday day-of-month max
#define DEF_NEWS_NFP_HOUR_START   12         // NFP Friday blackout start
#define DEF_NEWS_NFP_HOUR_END     16         // NFP Friday blackout end
#define DEF_MAX_BARS_IN_TRADE     240        // Max bars in trade (time exit)
#define DEF_BE_TRIGGER_R          1.0        // Break-even trigger (R multiples)
#define DEF_BE_OFFSET_POINTS      15         // BE lock offset (points)
#define DEF_PARTIAL_FRAC          0.5        // Partial TP fraction
#define DEF_PARTIAL_R             1.0        // Partial TP trigger (R multiples)
#define DEF_TRAIL_START_R         1.0        // Trail activation (R multiples)
#define DEF_TRAIL_ATR_MULT        1.0        // ATR trail multiplier
#define DEF_COOLDOWN_BARS         3          // Bars cooldown after losses
#define DEF_COOLDOWN_LOSSES       3          // Consecutive losses to trigger cooldown
#define DEF_MAX_PYRAMID           3          // Max pyramid levels (hard cap)
#define DEF_PYRAMID_SPACING_ATR   1.5        // Pyramid spacing (ATR multiples)
#define DEF_MAX_SPREAD_POINTS     50         // Max spread (points, source thesis)
#define DEF_MIN_ATR_SPREAD_RATIO  3.5        // ATR(points)/Spread >= k
#define DEF_DEVIATION_POINTS      40         // Order send deviation (points)
#define DEF_MAX_SYMBOL_EXPOSURE   2          // Max positions per symbol (this EA, source max=2)

//--- Market state classification -----------------------------------//
enum ENUM_REGIME_STATE
{
   STATE_TREND_UP   = 1,
   STATE_TREND_DOWN = -1,

Full source code available on download

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

Tags:ex10008momentum-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_EX10008.mq5
File Size42.5 KB
Versionv2.00
PlatformMetaTrader 5
File Type.mq5 Source
StrategyScalping
Risk LevelHigh Risk
Timeframes
M5M1M15
Currency Pairs
XAUUSD
Min. Deposit$100