P
PipsGrowth
Trend FollowingOpen Source – Free

Pipsgrowth EX16079 Trend

MT5 Expert Advisor (Open Source) · XAUUSD · M5

Pipsgrowth.com EX16079 ZoneRecovery XAUUSD 5M — zone-based recovery EA, full 12-layer stack.

Overview

Pipsgrowth EX16079 ships as a 119-line MetaTrader 5 file with the file name Pipsgrowth_com_EX16079_ZoneRecovery_XAUUSD_5M.mq5, magic 22216079, and a header block that promises a "zone-based recovery" engine plus a "full 12-layer stack." The on-disk source, however, is a stripped skeleton: a single market buy on the first tick that the EA encounters an empty position list, three retry helpers that are never called, and no indicator handles, no session gate, no drawdown switch, no partial-close logic, and no recovery loop. This page is written about what the file actually contains, not what the description line claims it should contain. Anyone evaluating EX16079 needs to know that before they attach it to a live chart.

The OnTick function is fourteen lines. It refreshes the symbol with mysymbol.RefreshRates(), checks PositionsTotal(), and if no position is open it sends a market buy at the current ask with trade.Buy(InpStartLot, _Symbol, mysymbol.Ask(), 0, tp, InpTradeComment). The TP is computed inline as mysymbol.Ask() + InpProfitPoints * mysymbol.Point() — there is no stop loss, no break-even, no trailing, no opposite-side close on a bearish candle, no time-based exit, no second-leg averaging. After that one buy, the function returns. The next tick repeats the same check; if PositionsTotal() is zero again, it opens another buy. If the position is still open, the function does nothing. There is no OnTimer and no OnTradeTransaction override.

The header comment between the +--- lines documents an intended recovery scheme — "If Buy goes against by ZonePoints, Open Sell with higher lot. Loop until Profit" — but that scheme is not implemented. InpZonePoints is declared as an input (default 200) and is read by no code path. InpProfitPoints is the only input that the OnTick actually consumes. The 12-layer architecture claimed in the #property description is similarly not wired: there is no regime classifier, no signal layer, no risk layer, no safety stack, no OnTester formula, no news filter, no session window. The file is closer to a behavior template for a future zone-recovery EA than a finished one.

Five inputs are declared. InpStartLot (double, default 0.01) is the fixed lot for every market buy. InpZonePoints (int, default 200) is the intended but unused spacing for the recovery grid. InpProfitPoints (int, default 200) is the take-profit distance in raw price points (200 points = 20 pips on a 5-digit XAUUSD quote, or 2 whole dollars on a 2-digit quote). InpMagicNumber (int, default 22216079) is set on the trade object in OnInit via trade.SetExpertMagicNumber(). InpTradeComment (string, default "Psgrowth.com Expert_16079") is attached to every order. Two sinput const string separator inputs (GroupTrade, GroupIdentity) only act as visual dividers in the Inputs panel and have no runtime effect.

The three functions after OnTick — TryClose_EX16079, TryClosePartial_EX16079, TryModify_EX16079 — are stock wrappers around trade.PositionClose, trade.PositionClosePartial, and trade.PositionModify. Each runs up to three attempts and only retries on the standard transient retcodes (TRADE_RETCODE_REQUOTE, TRADE_RETCODE_TIMEOUT, TRADE_RETCODE_PRICE_OFF, TRADE_RETCODE_PRICE_CHANGED); on the close helpers the backoff is 200ms per attempt, on the modify helper 100ms. They are defined but not referenced from OnTick, OnInit, OnDeinit, or anywhere else in the file — they are dead code, present in case a future revision wires them into a position-management layer. As shipped, they do nothing.

Risk profile is the most important section. With SL = 0 the trade has no per-trade stop, and the only exit is the fixed TP at +200 points. On XAUUSD M5 the 200-point TP equates to roughly $2.00 per 0.01 lot, which is small relative to the maximum adverse excursion a gold trade can run in a five-minute bar — gold can move several dollars inside a single candle on a news spike. Lot size is fixed at 0.01 regardless of balance, there is no per-trade risk percentage, no daily loss cap, no equity-curve guard, no max-drawdown kill switch, and no max-positions cap. The minimum recommended deposit is $100, which is the smallest tier the catalog lists and reflects the 0.01-lot entry; with SL = 0 the broker's stop-level check (SYMBOL_TRADE_STOPS_LEVEL) is the only thing keeping the TP at a sane distance from the ask, but a stop-level check is not a risk check.

If you attach EX16079 to an XAUUSD M5 chart with default inputs and a $100 account, the backtest will produce one open buy at the start of every contiguous flat period, with a +200-point TP and no protective stop, and a long string of stopped-out-by-Friday-flatten or terminal-margin-call outcomes during sustained downtrends. The file is useful as a starting scaffold for someone who wants to write their own zone-recovery system, but it is not deployable as-is on a funded account, and the header's "full 12-layer stack" claim should be read as roadmap text rather than implemented feature set.

For context, a real zone-recovery implementation typically carries four things this file does not: an entry signal (often a counter-trend reversion trigger around a moving average or a Bollinger band touch), a hard stop on the initial order sized to the same InpZonePoints it then uses as the recovery spacing, a recovery ladder that opens an opposite-side position at InpZonePoints adverse with a lot multiplier (often 1.5x to 2.0x) until the basket breaks even, and a basket take-profit that closes all legs together. EX16079 declares InpZonePoints and uses the word "recovery" in its filename and header, but the OnTick body contains none of those four pieces — only the very first leg of the strategy (an entry) without any of the protective or recovery machinery that would justify the label. The file should be read as a stub that documents the intended state machine in comments, not as a working implementation of it.

Strategy Deep Dive

OnInit does nothing beyond trade.SetExpertMagicNumber(22216079) and returns INIT_SUCCEEDED. OnTick calls mysymbol.RefreshRates() and inspects PositionsTotal(); if the count is zero, it builds the TP as Ask + InpProfitPoints * Point and sends trade.Buy(0.01, _Symbol, Ask, 0, tp, "Psgrowth.com Expert_16079"). On every subsequent tick that finds the position still open, the function returns without acting — there is no position-management layer. The retry helpers TryClose_EX16079, TryClosePartial_EX16079, and TryModify_EX16079 are present in the source but are never called, so the only state change in the live runtime is the initial buy and the eventual TP fill. The file's header comment outlines a zone-recovery grid (open a larger-lot sell after InpZonePoints adverse points, loop to profit) but that code path is not implemented; InpZonePoints is read by no function.

Entry Signal

On the first tick that finds an empty position list, EX16079 opens a market BUY at the current ask using the fixed InpStartLot (0.01 default) and a take-profit at Ask + InpProfitPoints × Point (200 points default, ~20 pips on a 5-digit XAUUSD quote). No indicators, no signal filter, no session gate, and no entry conditions gate the trade; the only precondition is that no position is currently open under magic 22216079.

Exit Signal

The only exit wired in the source is the take-profit at +200 points from entry. There is no stop loss, no trailing stop, no break-even, no time-based close, no opposite-signal close, and no basket-level management. The three retry helpers TryClose_EX16079, TryClosePartial_EX16079, and TryModify_EX16079 are defined but never called from OnTick, so they do not affect the live position lifecycle.

Stop Loss

There is no per-trade stop loss: trade.Buy() is called with sl = 0. The only protective mechanism is the broker's SYMBOL_TRADE_STOPS_LEVEL check on the TP side; SL=0 means an adverse move has no automatic exit and the position will sit until the TP fills, the account hits margin call, or the broker's end-of-day rollover intervenes.

Take Profit

Take-profit is fixed at InpProfitPoints raw price points above the entry ask (default 200 points, which is ~20 pips on a 5-digit XAUUSD quote, i.e. ~$2.00 per 0.01 lot). The TP is recomputed and re-attached only at the moment the entry order is sent; there is no ratchet, no partial close at 1R, and no TP-on-reverse logic.

Best For

This file is best suited to an MT5 developer who wants a starting scaffold for a custom zone-recovery system on XAUUSD M5 and is comfortable wiring the recovery, stop, and management layers themselves. The $100 minimum deposit and fixed 0.01 lot make it appropriate for a micro-lot test account only; with SL=0 and no drawdown cap, it is not appropriate for a funded live account. The lack of a session filter means it is indifferent to London/New York versus Asia and will trade whenever the symbol is open, including the 22:00–24:00 GMT rollover on Sunday and the 21:00 GMT Friday wind-down; a low-spread ECN or Raw account is recommended so the 20-pip TP is not consumed by spread on every fill. A practical next step is to replace the OnTick body with a proper entry model — a directional trigger plus a recovery ladder keyed to InpZonePoints with a martingale or anti-martingale lot ramp — and to call TryClose_EX16079, TryClosePartial_EX16079, and TryModify_EX16079 from a real management function so the retry helpers stop being dead code.

Strategy Logic

Pipsgrowth EX16079 Trend — Strategy Logic Analysis (from .mq5 source)

Family: Trend Magic: 22216079 Version: 2.00

BRIEF: Zone Recovery EA for XAUUSD M5. Opens initial position and uses zone-based recovery logic to manage drawdown. Configurable zone size and profit target in points

INDICATOR STACK:

  • Standard MT5 indicators

KEY FUNCTIONS:

  • TryClose_EX16079()
  • TryClosePartial_EX16079()
  • TryModify_EX16079()

INTERNAL CONSTANTS (0 total):

INPUT PARAMETERS (1 total across 1 groups):

  • [] InpMagicNumber = 22216079 // Magic number
Pseudocode
// Pipsgrowth EX16079 Trend — Execution Flow (from source analysis)
// Family: Trend
// Zone Recovery EA for XAUUSD M5. Opens initial position and uses zone-based recovery logic to manage drawdown. Configurable zone size and profit target in points

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 onto an H4 or Daily chart for best results
  7. 7Configure EMA periods, ADX threshold, and lot size in the dialog
  8. 8Enable Allow Algo Trading and click OK

EA Parameters

ParameterDefaultDescription
InpMagicNumber22216079Magic number
Source Code (.mq5)Open Source
Pipsgrowth_com_EX16079.mq5
#property copyright "Pipsgrowth.com"
#property link      "https://pipsgrowth.com"
#property version   "2.00"
#property strict
#property description "Pipsgrowth.com EX16079 ZoneRecovery XAUUSD 5M — zone-based recovery EA, 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;

sinput const string GroupTrade="";//=== Trade Settings ===
input double   InpStartLot       = 0.01;
input int      InpZonePoints     = 200;
input int      InpProfitPoints   = 200;
sinput const string GroupIdentity="";//=== Identity ===
input int      InpMagicNumber    = 22216079; // Magic number
input string   InpTradeComment   = "Psgrowth.com Expert_16079";

int OnInit()
  {
   trade.SetExpertMagicNumber(InpMagicNumber);
   return(INIT_SUCCEEDED);
  }

void OnDeinit(const int reason) { }

void OnTick()
  {
   if(!mysymbol.Name(_Symbol)) return;
   mysymbol.RefreshRates();
   
   // Simple Recovery Logic: 
   // If no trades, buy. 
   // If Buy goes against by ZonePoints, Open Sell with higher lot.
   // Loop until Profit.
   
   if(PositionsTotal() == 0) 
     {
      // Wait for trigger or just Always In for Recovery Zone demo?
      // Let's use simple MA trigger to start.
      // (Simplified: Open Buy)
      double tp = mysymbol.Ask() + InpProfitPoints * mysymbol.Point();
      trade.Buy(InpStartLot, _Symbol, mysymbol.Ask(), 0, tp, InpTradeComment);
     }
}
bool TryClose_EX16079(ulong ticket)
{
   for(int a=0; a<3; a++)
   {
      if(trade.PositionClose(ticket) &&
         (trade.ResultRetcode()==TRADE_RETCODE_DONE || trade.ResultRetcode()==TRADE_RETCODE_DONE_PARTIAL))
         return true;
      uint rc=trade.ResultRetcode();
      if(rc==TRADE_RETCODE_REQUOTE || rc==TRADE_RETCODE_TIMEOUT ||

Full source code available on download

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

Tags:ex16079trendpipsgrowthfreemt5xauusd

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_EX16079.mq5
File Size4.5 KB
Versionv2.00
PlatformMetaTrader 5
File Type.mq5 Source
StrategyTrend Following
Risk LevelMedium Risk
Timeframes
M5
Currency Pairs
XAUUSD
Min. Deposit$100