P
PipsGrowth
OtherOpen Source – Free

Pipsgrowth EX15007 SMC-OrderBlock

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

Pipsgrowth.com EX15007 ICT3_SMC — ICT BOS/CHoCH + liquidity sweep + FVG + OB + killzones, full 12-layer stack.

Overview

EX15007 ICT3 is a low-friction SMC-style scalper that runs a four-detector vote and only takes a trade when the total score clears a configurable threshold. The signal block in IctSignal() walks three closed bars and a SWING_LOOKBACK=12-bar swing window, then assigns weighted points to four independent ICT conditions: 30 points for a Break Of Structure (the previous bar's close pushes through the highest high or lowest low of the swing window), 25 points for a liquidity sweep (the previous bar's wick pierces a swing extreme and the close returns inside), 20 points for a Fair Value Gap (bar[2]'s low sits above bar[3]'s high for bullish, mirror for bearish), and 25 points for an Order Block tap (bar[2] is an opposite-color candle whose body contains bar[1]'s close). Bullish and bearish scores are accumulated independently, and the higher side wins — but only if it exceeds InpMinScore (default 50). The combined ceiling is 100, so a default threshold of 50 means any two of the four detectors firing will normally take the trade, while a stricter setting around 75 forces BOS+FVG+OB to align before the EA acts.

The EA never enters on the signal alone. ComputeRegime() classifies the current bar into one of seven states — StrongTrend, WeakTrend, Range, Breakout, Compress, Expand, Choppy — using a 14-period ADX, the 100-bar ATR percentile, and the live Bollinger Band width at 20/2.0 deviations. The classifier uses two ADX breakpoints: at 1.4× the InpAdxTrendMin input (default 30.8) it splits trend strength, below InpAdxTrendMin*1.4 with ATR-pctile ≥ 80 it marks Breakout, ATR-pctile ≤ 20 marks Compress, and ADX<15 hard-fails to Choppy. The Choppy state is the only regime that NoTradeBlock() blocks outright — Range, WeakTrend, StrongTrend, Breakout, Compress, and Expand all remain tradable, which gives the EA a meaningfully wider operating envelope than EX15 cousins that gate harder on regime.

The confirm layer adds three more filters before TryEntry() will fire. ConfirmEntry() requires that bar[1]'s close agrees with the H1 EMA(50) when InpRequireHTF is on (default true), rejects longs with RSI(14) below 45 and shorts above 55 (a permissive band designed to let trend entries through), and refuses the trade if the current bar's tick volume is below 80% of the 20-bar average. The combination is the only point at which the EA will reject a valid regime+signal combination — the score is the discriminator, the regime is the gate, the confirm is the safety net.

EX15007 is a killzone-time trader. NoTradeBlock() calls ParseWindow() on the two inputs InpLondonWindow (default "08:00-10:00") and InpNewYorkWindow (default "13:30-16:00") and refuses to trade outside both windows, including the entire weekend and the Friday session after 21:00 server time. This is narrower than the EX15 family's typical 7:00-21:00 broad band and matches the real ICT killzone definitions more closely. Combined with the 30-point SYMBOL_SPREAD filter (configurable via InpMaxSpreadPoints), the session gate is what makes the EA's trade frequency match the user's expectation of "two real windows a day, not constant probing."

Risk is keyed off an effective-capital pool rather than raw equity. EffectiveCapital() returns MathMin(InpCapitalCapAmount, equity) when InpCapitalCapAmount>0, else raw equity — so a trader with a $25,000 account and a $5,000 cap trades as if the account is $5,000. CalcLot() then takes 0.5% of that effective capital as the dollar risk per trade and converts it into a lot size using the broker's tick value and tick size, floored to the symbol's lot step and capped at min/max lot. InpCapitalCapFloor=50 refuses entries when the effective capital falls below $50, InpDailyLossLimitPct=3 / InpWeeklyLossLimitPct=9 hard-stop after a daily or weekly loss bracket, and InpCooldownLossCount=3 pauses entries once the EA has seen three consecutive losses on the magic+symbol. Together these four knobs let a user size the EA to a sub-account or a $5,000 paper allocation without rewriting the lot logic.

Stop and target are ATR-anchored with a built-in risk-reward floor. slDist is ATR(14) × 1.5 (InpATR_SL_Mult), capped at MAX_SL_POINTS=5000 points to prevent runaway distances, and the take-profit is ATR × 2.5 (InpATR_TP_Mult), giving a baseline 1.67:1 RR. TryEntry() refuses to send any order with RR < MIN_RR=1.5 after ClampSlToStops() and ClampTpToStops() push the levels away from the broker's stops-level minimum. ManageExits() then runs three layered management passes every tick on every position: (1) a 50% partial close at +1R (PARTIAL_R_MULT=1.0, PARTIAL_PCT=50, only when the partial is at least 2× the symbol's minimum lot), (2) a one-shot break-even at +1R (BE_R_MULT=1.0, the stop ratchets to entry plus the broker's stops level), and (3) an ATR trailing at 1.5× ATR behind price that keeps updating as long as InpEnableTrailing is on. Two exit overrides run on every position check: a 120-bar time exit (MAX_BARS_IN_TRADE) and an opposite-signal exit that calls IctSignal() again and closes if the score flips direction.

The retry paths are wired correctly into the manage loop. TryClose_EX15007, TryClosePartial_EX15007, and TryModify_EX15007 all run a three-attempt loop with 200ms / 100ms Sleep() on REQUOTE / TIMEOUT / PRICE_OFF / PRICE_CHANGED retcodes — the same pattern the EX15 family uses, with the only difference being the helper names. The execution path in SendOrder() also has its own two-attempt retry on the same retcodes and pre-checks OrderCalcMargin + free margin before sending. Together these prevent a price-during-modify race from leaving a position unprotected during the manage pass.

There is one optional scaling layer the trader can switch on. TryPyramid() is gated by InpEnablePyramid (default false), and when on it adds positions in the same direction as the current trade after PYRAMID_ATR_MULT=1.5× ATR of price progress, up to PYRAMID_MAX_LEVELS=3 total positions, never exceeding InpMaxSymbolTrades=2. The pyramid entries reuse the same signal direction and the same 1.5 ATR SL / 2.5 ATR TP scaffold, so each pyramid leg carries the same expected RR — a position-stack rather than a martingale. In dry-run mode, every pyramid prints a [DRY-RUN] PYRAMID line without sending.

EX15007 ships in dry-run by default. InpDryRun=true (the input default) causes TryEntry() to log [DRY-RUN] BUY/SELL lines with the regime code, the score, the lots, and the SL/TP, and return without sending. This is intentional: the file is a configurable SCAFFOLD for the trader to tune, and dry-run is the safe way to validate the score threshold, the killzone window, the capital cap, and the spread filter against the user's broker and symbol before letting it place real orders. InpKillSwitch=true forces OnInit to return INIT_FAILED before any indicator handle is created, giving the user a hard panic-stop in a single input. OnTester() returns (net × profit factor) / (1 + equity-DD$) and zeros out under 30 trades, which biases the Strategy Tester toward strategies with real sample size rather than lucky short runs.

There is a real gap between what the source advertises and what is wired. The 12-layer claim in the header includes SCALING, but in default config SCALING is off — the EA trades one position at a time per symbol until InpEnablePyramid is flipped. The other 11 layers (REGIME, SIGNAL, ENTRY, CONFIRM, NO-TRADE, CAPITAL CAP, RISK, SIZING, MANAGE, EXIT, OnTester) are all live in default config. Traders who want the SCALING layer should turn InpEnablePyramid on and test it in dry-run for a full London+NewYork week before going live, since the same direction signal can stack 3 positions and the 3% daily / 9% weekly caps will scale with that exposure.

This is the right kind of EA for a trader who understands ICT order-flow language and wants a configurable scoring engine. EX15007 is not a set-and-forget grid or martingale — it is a single-position (or optional three-level pyramid) ICT execution shell that respects the killzones, scores the signal honestly, and refuses to trade when the regime is unclear. The risk is genuinely low when the inputs are left at their defaults: 0.5% of capped capital, 1.5 ATR stop, 2.5 ATR target, daily 3% loss cap, weekly 9% loss cap, three-loss cooldown. The risk grows linearly when the trader widens MinScore below 50, widens the killzones, raises InpMaxOpenTrades, or turns on the pyramid — those four knobs are the only paths to the EA taking more exposure than the default design intended.

Strategy Deep Dive

OnTick() gates everything to new closed bars, refreshes rates, recomputes effective capital, and — only on a fresh bar — calls ComputeRegime(), UpdateRealizedPnL(), UpdateConsecLosses(), and runs IctSignal() to score the four ICT conditions (BOS 30 / Sweep 25 / FVG 20 / OB 25). When the score clears InpMinScore the direction is fed to TryEntry(), which checks NoTradeBlock() (spread, Choppy regime, weekend, Friday 21:00+, killzone window, broker/symbol flags) and RiskGateOK() (kill switch, cooldown after 3 losses, daily 3% / weekly 9% loss caps, capital floor), then enforces the 1.5:1 RR floor and pushes the SL/TP through ClampSlToStops()/ClampTpToStops() before SendOrder() runs its two-attempt retry. ManageExits() runs every tick, applying the 50% partial at +1R, the one-shot break-even at +1R, the ATR trail, the 120-bar time exit, and the opposite-signal exit. TryPyramid() optionally stacks up to 3 positions in the same direction at 1.5× ATR spacing when InpEnablePyramid is on.

Entry Signal

EX15007 scores four ICT conditions on the last three closed bars and enters on the higher side when its points clear InpMinScore (default 50). IctSignal() awards 30 for a Break Of Structure past the 12-bar swing, 25 for a liquidity sweep that wicks a swing extreme and closes back, 20 for a 3-bar Fair Value Gap, and 25 for an Order Block tap where bar[2]'s body contains bar[1]'s close. The order only fires when the regime is not Choppy, the spread is below 30 points, the server clock is inside the London (08:00-10:00) or New York (13:30-16:00) killzone, the H1 EMA(50) agrees with the direction, the RSI(14) is in the 45/55 band, and the current bar's tick volume exceeds 80% of the 20-bar average.

Exit Signal

ManageExits() runs three management passes on every tick: a 50% partial close at +1R (gated to a minimum 2× lot), a one-shot break-even at +1R, and a continuous ATR(14) trail at 1.5× ATR. Two overrides always run after the manage passes: a 120-bar time exit (MAX_BARS_IN_TRADE) and an opposite-signal exit that re-runs IctSignal() and closes the position when the score flips direction. InpEnableTrailing, InpEnableBreakeven, and InpEnablePartial are all default true, so the full manage pipeline is live out of the box.

Stop Loss

SL is set at 1.5× ATR(14) below entry for longs / above for shorts, then clamped to the broker's stops level via ClampSlToStops() so the order never lands inside the minimum distance. A hard cap of 5000 points (MAX_SL_POINTS) prevents runaway distances. After entry, a one-shot break-even ratchets the stop to entry at +1R, and an ATR trail at 1.5× ATR behind price takes over for the rest of the trade.

Take Profit

TP is set at 2.5× ATR(14) from entry, giving a 1.67:1 RR baseline that TryEntry() enforces as a floor (MIN_RR=1.5). 50% of the position is closed at +1R via TryClosePartial_EX15007, leaving the remainder to run to the 2.5× ATR target with the ATR trailing stop ratcheting behind it.

Best For

Best for an XAUUSD trader who runs the EA on a $100 minimum micro account and is comfortable with the M5/M15 killzone rhythm — 2 hours of London + 2.5 hours of New York per server day. Pair with a low-spread ECN broker (the 30-point spread filter is tight enough that 25+ point retail spreads on Gold will fail the gate), set the InpTimeZone input to align the killzone windows with your broker's server clock (most GMT+2/+3 servers match the defaults, GMT servers shift +1 hour), and run dry-run for one full London+NewYork week before flipping InpDryRun to false. InpCapitalCapAmount is the right knob to use when running on a $5,000 or $10,000 sub-account while the master account holds more — the EA will size off the capped value, not the real equity, so per-trade risk stays inside the intended bracket.

Strategy Logic

Pipsgrowth EX15007 SMC-OrderBlock — Strategy Logic Analysis (from .mq5 source)

Family: SMC-OrderBlock Magic: 22215007 Version: 2.00

BRIEF: ICT3 SMC scalper — BOS/CHoCH + Liquidity Sweep + FVG + Order Block tap, Killzone-time-gated, scored 0-100. Regime via ADX + ATR-percentile + Bollinger-width. Confirm = HTF-EMA(50) + RSI band + vol-surge. Capital cap, ATR trailing, break-even, partial-close 50%, opposite-signal + time exit. Default DRY-RUN. 12 layers: REGIME, SIGNAL, ENTRY, CONFIRM, NO-TRADE, CAPITAL CAP, RISK, SIZING, MANAGE, EXIT, SCALING, OnTester

INDICATOR STACK:

  • _atr
  • _adx
  • _bb
  • _rsi
  • _emaH

KEY FUNCTIONS:

  • ParseWindow()
  • EffectiveCapital()
  • UpdateRealizedPnL()
  • SetupSymbol()
  • RiskGateOK()
  • ComputeRegime()
  • IctSignal()
  • ConfirmEntry()
  • NoTradeBlock()
  • CalcLot()
  • StopsLevelPrice()
  • NormalizePrice()
  • ...and 10 more

INTERNAL CONSTANTS (7 total):

  • ATR_SLPCTILE_LOOKBACK = 100 // bars for ATR percentile
  • SWING_LOOKBACK = 12 // swing detection lookback
  • BE_R_MULT = 1.0 // break-even after 1R
  • PARTIAL_R_MULT = 1.0 // partial close at 1R
  • PARTIAL_PCT = 50 // close 50%
  • MAX_SL_POINTS = 5000 // sanity cap on SL distance
  • MAGIC_DEFAULT = 2220698 // ===================================================================

INPUT PARAMETERS (28 total across 7 groups):

  • [=== Identity ===] InpMagic = 22215007 // Magic number (unique per EA)
  • [=== Identity ===] InpTradeComment = "Psgrowth.com Expert_15007" // Trade comment string
  • [=== Identity ===] InpTimeZone = 0 // Server-time offset hours vs broker (0=broker time)
  • [=== Identity ===] InpAllowBuy = true // Allow long trades
  • [=== Identity ===] InpAllowSell = true // Allow short trades
  • [=== Risk & Sizing ===] InpRiskPercent = 0.5 // Risk % per trade (of effective_capital)
  • [=== Risk & Sizing ===] InpFixedLot = 0.05 // Fallback fixed lot if risk calc fails
  • [=== Risk & Sizing ===] InpDailyLossLimitPct = 3.0 // Daily loss limit % (of effective_capital)
  • [=== Risk & Sizing ===] InpWeeklyLossLimitPct = 9.0 // Weekly loss limit % (of effective_capital)
  • [=== Risk & Sizing ===] InpMaxOpenTrades = 2 // Max simultaneous open positions
  • [=== Risk & Sizing ===] InpMaxSymbolTrades = 2 // Max positions per symbol
  • [=== Risk & Sizing ===] InpCooldownLossCount = 3 // Pause N entries after this many losses
  • [=== Capital Cap ===] InpCapitalCapAmount = 0.0 // Real-money cap ($)
  • [=== Capital Cap ===] InpCapitalCapFloor = 50.0 // Floor below which no entries ($)
  • [=== Signal (ICT) ===] InpMinScore = 50 // Min ICT signal score 0..100
  • [=== Signal (ICT) ===] InpATR_SL_Mult = 1.5 // ATR multiplier for SL
  • [=== Signal (ICT) ===] InpATR_TP_Mult = 2.5 // ATR multiplier for TP
  • [=== Regime / Confirm ===] InpAdxTrendMin = 22.0 // ADX threshold for trend regime
  • [=== Regime / Confirm ===] InpMaxSpreadPoints = 30.0 // Max allowed spread (points)
  • [=== Regime / Confirm ===] InpRequireHTF = true // Require HTF-EMA agreement
  • [=== Session / Exit / Manage ===] InpLondonWindow = "08:00-10:00" // London killzone (HH:MM-HH:MM)
  • [=== Session / Exit / Manage ===] InpNewYorkWindow = "13:30-16:00" // New York killzone (HH:MM-HH:MM)
  • [=== Session / Exit / Manage ===] InpEnableTrailing = true // Enable ATR trailing stop
  • [=== Session / Exit / Manage ===] InpEnableBreakeven = true // Enable one-shot break-even
  • [=== Session / Exit / Manage ===] InpEnablePartial = true // Enable 50% partial at 1R
  • [=== Scaling / Master ===] InpEnablePyramid = false // Enable pyramid scaling (default OFF)
  • [=== Scaling / Master ===] InpDryRun = true // Dry-run mode (no live orders)
  • [=== Scaling / Master ===] InpKillSwitch = false // Master kill switch
Pseudocode
// Pipsgrowth EX15007 SMC-OrderBlock — Execution Flow (from source analysis)
// Family: SMC-OrderBlock
// ICT3 SMC scalper — BOS/CHoCH + Liquidity Sweep + FVG + Order Block tap, Killzone-time-gated, scored 0-100. Regime via ADX + ATR-percentile + Bollinger-width. Confirm = HTF-EMA(50) + RSI band + vol-surge. Capital cap, ATR trailing, break-even, partial-close 50%, opposite-signal + time exit. Default DRY-RUN. 12 layers: REGIME, SIGNAL, ENTRY, CONFIRM, NO-TRADE, CAPITAL CAP, RISK, SIZING, MANAGE, EXIT, SCALING, OnTester

ON_INIT:
    Create indicator handles: _atr, _adx, _bb, _rsi, _emaH
    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 onto a chart matching the recommended timeframe
  7. 7Configure parameters according to the table on this page
  8. 8Enable Allow Algo Trading and click OK

EA Parameters

ParameterDefaultDescription
InpMagic22215007Magic number (unique per EA)
InpTradeComment"Psgrowth.com Expert_15007"Trade comment string
InpTimeZone0Server-time offset hours vs broker (0=broker time)
InpAllowBuytrueAllow long trades
InpAllowSelltrueAllow short trades
InpRiskPercent0.5Risk % per trade (of effective_capital)
InpFixedLot0.05Fallback fixed lot if risk calc fails
InpDailyLossLimitPct3.0Daily loss limit % (of effective_capital)
InpWeeklyLossLimitPct9.0Weekly loss limit % (of effective_capital)
InpMaxOpenTrades2Max simultaneous open positions
InpMaxSymbolTrades2Max positions per symbol
InpCooldownLossCount3Pause N entries after this many losses
InpCapitalCapAmount0.0Real-money cap ($)
InpCapitalCapFloor50.0Floor below which no entries ($)
InpMinScore50Min ICT signal score 0..100
InpATR_SL_Mult1.5ATR multiplier for SL
InpATR_TP_Mult2.5ATR multiplier for TP
InpAdxTrendMin22.0ADX threshold for trend regime
InpMaxSpreadPoints30.0Max allowed spread (points)
InpRequireHTFtrueRequire HTF-EMA agreement
InpLondonWindow"08:00-10:00"London killzone (HH:MM-HH:MM)
InpNewYorkWindow"13:30-16:00"New York killzone (HH:MM-HH:MM)
InpEnableTrailingtrueEnable ATR trailing stop
InpEnableBreakeventrueEnable one-shot break-even
InpEnablePartialtrueEnable 50% partial at 1R
InpEnablePyramidfalseEnable pyramid scaling (default OFF)
InpDryRuntrueDry-run mode (no live orders)
InpKillSwitchfalseMaster kill switch
Source Code (.mq5)Open Source
Pipsgrowth_com_EX15007.mq5
#property copyright "Pipsgrowth.com"
#property link      "https://pipsgrowth.com"
#property version   "2.00"
#property strict
#property description "Pipsgrowth.com EX15007 ICT3_SMC — ICT BOS/CHoCH + liquidity sweep + FVG + OB + killzones, 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>

//=========================== CONSTANTS =============================
#define ATR_PERIOD           14
#define ATR_SLPCTILE_LOOKBACK 100   // bars for ATR percentile
#define BB_PERIOD            20
#define BB_DEVIATION         2.0
#define ADX_PERIOD           14
#define RSI_PERIOD           14
#define EMA_FAST             21
#define EMA_SLOW             50
#define HTF_PERIOD           PERIOD_H1
#define HTF_EMA_PERIOD       50
#define SWING_LOOKBACK       12     // swing detection lookback
#define VOL_LOOKBACK         20
#define COOLDOWN_BARS        3
#define MAX_BARS_IN_TRADE    120
#define PYRAMID_MAX_LEVELS   3
#define PYRAMID_ATR_MULT     1.5
#define BE_R_MULT            1.0    // break-even after 1R
#define PARTIAL_R_MULT       1.0    // partial close at 1R
#define PARTIAL_PCT          50     // close 50%
#define MIN_RR               1.5
#define MAX_SL_POINTS        5000   // sanity cap on SL distance
#define ROLLING_SPREAD_BARS  50
#define NEWS_WINDOW_MINUTES  15
#define MAGIC_DEFAULT        2220698

//===================================================================
// ENUMS
//===================================================================
enum ENUM_REGIME
  {
   REGIME_StrongTrend = 0,
   REGIME_WeakTrend   = 1,
   REGIME_Range       = 2,
   REGIME_Breakout    = 3,
   REGIME_Compress    = 4,
   REGIME_Expand      = 5,
   REGIME_Choppy      = 6
  };

enum ENUM_SESSION
  {
   SESS_None     = 0,
   SESS_London   = 1,
   SESS_NewYork  = 2
  };

Full source code available on download

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

Tags:ex15007smc-orderblockpipsgrowthfreemt5xauusd

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_EX15007.mq5
File Size35.6 KB
Versionv2.00
PlatformMetaTrader 5
File Type.mq5 Source
StrategyOther
Risk LevelMedium Risk
Timeframes
M5M15
Currency Pairs
XAUUSD
Min. Deposit$100