Pipsgrowth EX02024 Breakout
MT5 Expert Advisor (Open Source) · XAUUSD · D1
Pipsgrowth.com EX02024 Breakdown — daily breakout with pending stop orders and trailing, full 12-layer stack.
Overview
Pipsgrowth EX02024 Breakout is a daily-range breakout advisor that runs on the D1 candle and uses two pre-placed stop orders to capture whichever side breaks first. The source file, Pipsgrowth_com_EX02024.mq5, identifies the family as Breakout, magic number 22202024, version 2.00. The brief in the header reads verbatim: "Daily breakout EA that places BuyStop above the previous day's high and SellStop below the previous day's low, with trailing stop and automatic daily pending-order deletion."
The strategy has no indicator stack. There is no RSI, no ATR, no Bollinger band, no moving-average cross. The decision is purely structural: the EA reads the previous completed daily candle and acts on the high and low of that candle. This makes EX02024 different from the rest of the breakout family on PipsGrowth — the M5 GB10OOO and GaussianEMA breakouts need a body/range filter, an HTF trend gate, and a confidence score before they fire. EX02024 only needs yesterday's high and yesterday's low to fire.
The level calculation is exact. Each new day, after IsSafeToTrade_EX02024() returns true and there are no existing pending orders, the EA calls iHigh(m_symbol.Name(), PERIOD_D1, 1) and iLow(m_symbol.Name(), PERIOD_D1, 1). These return the high and low of bar #1 — the most recently closed daily candle. It then adds ExtMinDistance to the high for the BuyStop entry, and subtracts ExtMinDistance from the low for the SellStop entry. With the default InpMinDistance = 25 pips, the BuyStop sits 25 pips above yesterday's high and the SellStop sits 25 pips below yesterday's low. Those 25 pips are a noise buffer; the order will not be triggered by a wick that just barely pierces the level.
Once a stop order is triggered, the EA opens the position with the other stop order still pending. The OnTradeTransaction() handler watches for DEAL_ENTRY_IN deals. As soon as a deal of type DEAL_TYPE_BUY or DEAL_TYPE_SELL is registered for this symbol and magic, it calls DeleteAllPendingOrders() and removes the surviving stop on the opposite side. This is the standard "breakout cancel the other side" pattern — once a level breaks, the symmetric trade becomes a counter-trend bet and is killed.
The risk parameters are deliberately tight for a daily EA. InpStopLoss = 50 pips and InpTakeProfit = 50 pips are the defaults, giving a 1:1 reward-to-risk on a clean breakout. This is honest: the EA is betting on the structural follow-through of a daily range break, not on extending winners to 3R. The trailing stop is the mechanism that lets winners run. InpTrailingStop = 5 pips and InpTrailingStep = 5 pips are the defaults. The Trailing() function only modifies the position stop-loss once price has moved more than TrailingStop + TrailingStep = 10 pips beyond the open price, and only if the current stop-loss is still on the wrong side of that new trailing level. Each successful modification ratchets the stop closer to current price without ever pulling it backwards. Because the EA is on D1, this trailing only ticks once per day at most, but it does mean an open position can survive several days and trend while the stop marches up behind it.
Sizing uses MT5's CMoneyFixedMargin class with Risk = 5 percent of free margin. This is the MoneyFixedMargin money-management module from the standard library, not the more common CheckOpenLong percent-of-balance approach. Five percent of free margin per deal is aggressive — on a $1,000 account with 100:1 leverage on XAUUSD, that produces a position large enough to feel the full daily range. New users typically dial Risk down to 1–2 percent before going live, and the EA accepts any value from 0 to 100.
The hardening stack on EX02024 is unusually complete for a pending-order EA. IsSafeToTrade_EX02024() refuses to place new pendings when any of the following is true: the market is closed (Sunday before 22:00 GMT, Saturday after 22:00 GMT Friday, or a holiday), the active GMT session filter is enabled and current hour is outside London 7–16 or New York 12–21, a high-impact news event is within 30 minutes via the MQL5 economic calendar (CalendarValueHistory checking CALENDAR_IMPORTANCE_HIGH), the cap-equity floor is breached when InpCapAmount is enabled, equity has fallen below 70 percent of the initial balance, the daily trade count is at the limit, a cooldown is in effect, or realized losses today have crossed the 5 percent threshold. When the gate is closed, the EA still runs Trailing() and the pending-order deletion logic — it just refuses to place new stops.
The pending-order deletion logic is a separate, important behaviour. The OnTick() function tracks the last daily bar's open time in dt_last_delete. When a new daily candle begins, if pending orders from the previous day still exist, the EA sets bln_delete_all = true and clears them on the next tick. This is how EX02024 enforces its "one breakout per day" rule: yesterday's BuyStop and SellStop expire with yesterday's range, and today's orders use today's open.
The session filter defaults to disabled (InpUseGMTSessions = false), which means the EA places orders 24 hours a day when other gates permit. Most operators will turn the session filter on and restrict to London 7–16 GMT or New York 12–21 GMT, since the daily breakout level only resolves meaningfully during active sessions. The news filter defaults to enabled, so a non-farm-payroll or CPI release will automatically delay pending-order placement by 30 minutes before and after.
A few practical notes for first-time users. m_slippage = 10 is hard-coded in the source — it is not an input parameter. The news filter only checks high-impact events, not medium or low. The InpUseGMTSessions flag is a hard switch; if you want the EA to ignore session timing entirely, leave it false. The CMoneyFixedMargin money module calculates lot from free margin, not from balance, so during drawdown the lot size naturally shrinks and during a winning streak it grows.
Backtesting this EA in MT5's Strategy Tester on D1 XAUUSD with 1:1 SL/TP and 5 percent risk typically produces many small wins, occasional winners that ride the trend via trailing, and a stream of stopped-out losses when the breakout is a false break. The OnTester custom fitness function is profit * profitFactor / maxDD with a minimum 10-trade gate — the strategy tester will rank parameter sets that improve the ratio of net profit to maximum drawdown, not just the absolute profit. Optimizer runs should focus on InpMinDistance (which controls breakout entry aggressiveness) and the Risk parameter (which controls the equity curve's slope and depth together).
Strategy Deep Dive
On each tick, EX02024 first checks the safety gate via IsSafeToTrade_EX02024() — market hours, optional London/New York session filter, news blackout, equity floor, daily loss limit, and consecutive-loss cooldown. If the gate is closed, the EA skips new order placement but still runs Trailing() and the day-rollover pending-delete logic. When the gate is open and no pending orders exist for this magic, the EA reads iHigh(...,PERIOD_D1,1) and iLow(...,PERIOD_D1,1), adds InpMinDistance (25 pips) to the high for the BuyStop, subtracts InpMinDistance from the low for the SellStop, and submits both via PendingBuyStop() and PendingSellStop() with the fixed SL and TP. The EA also stamps dt_last_delete with the current D1 bar's open time so it knows when a new day has rolled over. When OnTradeTransaction() sees a DEAL_ENTRY_IN for this symbol and magic, it calls DeleteAllPendingOrders() to remove the surviving opposite stop. The Trailing() function only modifies the position stop once price has moved beyond TrailingStop + TrailingStep in profit and the current stop is still behind the new trailing level. Sizing uses MT5's CMoneyFixedMargin with Risk=5% of free margin per deal. The OnTester custom fitness is profit*profitFactor/maxDD with a 10-trade minimum.
Each new daily candle, the EA reads the previous completed D1 candle's high and low via iHigh/iLow(...,PERIOD_D1,1) and places a BuyStop at the high plus InpMinDistance pips (default 25) and a SellStop at the low minus InpMinDistance pips. The pending orders stay valid for the entire day until the bar breaks one level or a new D1 candle begins. On a triggered entry, the surviving opposite pending order is deleted by OnTradeTransaction().
Exit happens at the fixed take-profit (InpTakeProfit, default 50 pips), at the trailing stop once price moves more than InpTrailingStop + InpTrailingStep (5 + 5 = 10 pips) beyond the open, or at the hard stop-loss (InpStopLoss, default 50 pips). Trailing is ratchet-only — it only ever moves the stop in the direction of profit and never widens it. Pending orders that are not triggered by the time a new daily candle opens are deleted on the next tick.
Per-trade stop-loss is a fixed pips distance set by InpStopLoss (default 50 pips) from the pending-order entry price. Position sizing uses CMoneyFixedMargin with Risk=5% of free margin, so the dollar risk per trade scales with account margin rather than balance. The EA also enforces a global daily loss limit of InpDailyLossLimitPct (5%) and an equity floor of InpMinEquityPct (70% of initial balance).
Take-profit is a fixed pips distance set by InpTakeProfit (default 50 pips), placed at the same distance on the opposite side of the entry as the stop-loss. The default 50/50 split is a 1:1 risk-reward; the trailing stop is the mechanism that lets winners extend beyond 1R when the daily breakout produces a multi-day trend.
This EA is designed for XAUUSD on D1 and works best on a low-spread broker where pending stop orders fill cleanly at the level. Recommended minimum balance is $100 per the source header, but because Risk is set against free margin at 5% by default, a balance of $500–$1,000 gives the EA enough room to size properly without hitting margin pressure on a single trade. The default session filter is off, so the EA places orders 24 hours a day; turning on the London 7–16 / New York 12–21 GMT filter reduces wasted pendings during quiet Asian hours. The news filter (default on, ±30 minutes) is essential for XAUUSD given the metal's reaction to NFP, CPI, and FOMC. Best suited for traders who can hold a position across multiple days while the trailing stop ratchets behind a breakout.
Strategy Logic
Pipsgrowth EX02024 Breakout — Strategy Logic Analysis (from .mq5 source)
Family: Breakout
Magic: 22202024
Version: 2.00
BRIEF:
Daily breakout EA that places BuyStop above the previous day's high and SellStop below the previous day's low, with trailing stop and automatic daily pending-order deletion
INDICATOR STACK:
- Standard
MT5indicators
KEY FUNCTIONS:
OnTradeTransaction()RefreshRates()PendingBuyStop()PendingSellStop()PrintResultTrade()IsPendingOrdersExists()DeleteAllPendingOrders()Trailing()PrintResultModify()DetectGMTOffset_EX02024()ServerToGMT_EX02024()IsMarketOpen_EX02024()- ...and 5 more
INTERNAL CONSTANTS (0 total):
INPUT PARAMETERS (12 total across 6 groups):
- [=== Identity ===]
m_magic=22202024// Magic Number - [=== Identity ===]
InpTradeComment= "Psgrowth.com Expert_02024" // TradeComment - [=== Strategy Parameters ===]
InpStopLoss= 50 // StopLoss(in pips) - [=== Strategy Parameters ===]
InpTakeProfit= 50 // TakeProfit(in pips) - [=== Strategy Parameters ===]
InpTrailingStop= 5 // TrailingStop(in pips) - [=== Strategy Parameters ===]
InpTrailingStep= 5 // TrailingStep(in pips) - [=== Strategy Parameters ===]
InpMinDistance= 25 // Minimum distance - [=== Money Management ===] Risk = 5 // Risk in percent for a deal from a free margin
- [===
GMTSessionFilter(Hardening) ===]InpNewYorkEndGMT= 21 // --- Hardening: Capital Protection --- - [=== Capital
Protection(Hardening) ===]InpCapAmount=0.0// Capital cap amount (0=disabled) - [=== Capital
Protection(Hardening) ===]InpDailyLossLimitPct=5.0// --- Hardening: Trade Safety --- - [=== Trade
Safety(Hardening) ===]InpNewsBufferMinutes= 30 // +------------------------------------------------------------------+
// Pipsgrowth EX02024 Breakout — Execution Flow (from source analysis)
// Family: Breakout
// Daily breakout EA that places BuyStop above the previous day's high and SellStop below the previous day's low, with trailing stop and automatic daily pending-order deletion
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 onto an H1 or H4 chart
- 7Set the range detection period, breakout buffer, and lot size in the EA dialog
- 8Enable Allow Algo Trading and click OK
EA Parameters
| Parameter | Default | Description |
|---|---|---|
| m_magic | 22202024 | Magic Number |
| InpTradeComment | "Psgrowth.com Expert_02024" | Trade Comment |
| InpStopLoss | 50 | Stop Loss (in pips) |
| InpTakeProfit | 50 | Take Profit (in pips) |
| InpTrailingStop | 5 | Trailing Stop (in pips) |
| InpTrailingStep | 5 | Trailing Step (in pips) |
| InpMinDistance | 25 | Minimum distance |
| Risk | 5 | Risk in percent for a deal from a free margin |
| InpNewYorkEndGMT | 21 | --- Hardening: Capital Protection --- |
| InpCapAmount | 0.0 | Capital cap amount (0=disabled) |
| InpDailyLossLimitPct | 5.0 | --- Hardening: Trade Safety --- |
| InpNewsBufferMinutes | 30 | +------------------------------------------------------------------+ |
#property copyright "Pipsgrowth.com"
#property link "https://pipsgrowth.com"
#property version "2.00"
#property strict
#property description "Pipsgrowth.com EX02024 Breakdown — daily breakout with pending stop orders and trailing, full 12-layer stack."
//---
#include <Trade\PositionInfo.mqh>
#include <Trade\Trade.mqh>
#include <Trade\SymbolInfo.mqh>
#include <Trade\AccountInfo.mqh>
#include <Trade\OrderInfo.mqh>
#include <Expert\Money\MoneyFixedMargin.mqh>
CPositionInfo m_position; // trade position object
CTrade m_trade; // trading object
CSymbolInfo m_symbol; // symbol info object
CAccountInfo m_account; // account info wrapper
COrderInfo m_order; // pending orders object
CMoneyFixedMargin *m_money;
//--- input parameters
input group "=== Identity ==="
input ulong m_magic = 22202024; // Magic Number
input string InpTradeComment = "Psgrowth.com Expert_02024"; // Trade Comment
input group "=== Strategy Parameters ==="
input ushort InpStopLoss = 50; // Stop Loss (in pips)
input ushort InpTakeProfit = 50; // Take Profit (in pips)
input ushort InpTrailingStop = 5; // Trailing Stop (in pips)
input ushort InpTrailingStep = 5; // Trailing Step (in pips)
input ushort InpMinDistance = 25; // Minimum distance
input group "=== Money Management ==="
input double Risk = 5; // Risk in percent for a deal from a free margin
//---
ulong m_slippage=10; // slippage
double ExtStopLoss=0.0;
double ExtTakeProfit=0.0;
double ExtTrailingStop=0.0;
double ExtTrailingStep=0.0;
double ExtMinDistance=0.0;
double m_adjusted_point; // point value adjusted for 3 or 5 points
bool bln_delete_all=false;
datetime dt_last_delete=0;
//--- Hardening Globals
int g_gmtOffset = 3;
int g_tradesToday = 0;
datetime g_dayStartTime = 0;
double g_initialBalance = 0.0;
datetime g_cooldownUntil = 0;
int g_consecLosses = 0;
double g_realizedToday = 0.0;
double g_realizedWeek = 0.0;
datetime g_weekStartTime = 0;
// --- Hardening: GMT Session Filter ---
input group "=== GMT Session Filter (Hardening) ===";
input bool InpUseGMTSessions = false;
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 Breakout strategy EAs from our library
Pipsgrowth EX02026 Breakout
Pipsgrowth.com EX02026 XAUUSD_M5_Donchian_EA — Donchian breakout with RSI and speed filter, full 12-layer stack.
Pipsgrowth EX02001 Breakout
Pipsgrowth.com EX02001 HFS NS92 XAUUSD 5M — fractal Donchian breakout with RSI extreme filter, full 12-layer stack.
Pipsgrowth EX02027 Breakout
Pipsgrowth.com EX02027 EX8 Multi-Symbol VWAP+KAMA Donchian — multi-symbol scalper with ADX regime switch, full 12-layer stack.
Community
Educational purposes only. Do NOT use with real money. Test on demo accounts only.