P
PipsGrowth
Trend FollowingOpen Source – Free

Pipsgrowth EX16083 Trend

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

Pipsgrowth.com EX16083 NewsTrader — Straddle pending orders at news hours, full 12-layer stack.

Overview

The Pipsgrowth EX16083 is a news-event straddle Expert Advisor. Instead of predicting where price will go when a scheduled data release hits the wire, it brackets the moment with two pending orders — a Buy Stop set above the current ask and a Sell Stop mirrored an equal distance below the current bid. Whichever side the news spike activates first becomes the live position; the other side auto-cancels when its expiry elapses, or is left to expire on its own.

The bracket fires at three server hours — 8, 13, and 15 — which the source code explicitly labels as proxies for actual news times. The header comment in the .mq5 file notes that production deployment should connect to an economic calendar feed; in the open-source version, those three fixed hours stand in. The check is wrapped in two early-out guards: if the current minute is anything other than the top of the hour (if(dt.min != 0) return;) the EA does nothing, and a one-hour cooldown (TimeCurrent() - lastTrade < 3600) blocks the straddle from being re-armed within the same hour even if the EA re-ticks. Together they guarantee at most one straddle per scheduled hour, per day.

Distance and risk parameters are all expressed in pips and entered as integer inputs. InpStopDistance = 20 sets how far the Buy Stop sits above the current ask and how far the Sell Stop sits below the current bid. InpStopLoss = 30 and InpTakeProfit = 50 give a fixed 30-pip protective stop and a 50-pip profit target per triggered position — a 1:1.67 reward-to-risk ratio that the EA does not adjust for volatility, time of day, or news event class. InpLotSize = 0.10 is the size submitted on both pending orders. The position-sizing layer of the EA, like its 12-layer marketing claim in the header, is essentially a single input.

InpCancelAfterMins = 10 is the expiry on the pending orders. Both the Buy Stop and the Sell Stop are submitted with ORDER_TIME_SPECIFIED and an expiry timestamp set to TimeCurrent() + InpCancelAfterMins * 60. If neither order has been triggered by the time the candle pushes past that expiry, the terminal drops the pending order automatically — there is no explicit cleanup loop in OnTick. The trade object here is a single CTrade instance, with trade.SetExpertMagicNumber(22216083) set in OnInit and trade.SetDeviationInPoints(20) allowing up to 20 points of slippage on fill.

What the EA does not do is as relevant as what it does. There is no indicator handle — no iMA, no iATR, no iRSI. The decision to fire the straddle is purely clock-driven. There is no trailing stop, no breakeven function, no partial close, no news filter beyond the hour check, and no daily circuit breaker on either a profit target or a loss limit. The three retry helpers at the bottom of the file — TryClose_EX16083, TryClosePartial_EX16083, and TryModify_EX16083 — are correctly written to handle requote, timeout, price-changed, and price-off returns with a 100-200ms Sleep between attempts, but none of them is wired into the OnTick logic. They are template code from the EA family's scaffolding, not runtime paths.

The implication for live use is that the straddle relies entirely on broker execution. The 20-point deviation allowance is generous for FX majors and tight for gold, and the 50-pip take-profit will be reached or missed based on the post-news spike magnitude. On a thin-liquidity broker, the Sell Stop below a 30-pip stop may fill well below the requested price during a flash gap, because pending-order slippage on stops is not symmetric with market-order slippage on the same event.

The magic number 22216083 and the comment string Psgrowth.com Expert_16083 let the EA coexist on the same account with other PipsGrowth EAs without their orders colliding. There is no global SL cap and no equity floor — the EA does not look at account balance at all once OnInit returns, beyond the initial lot size. The min deposit of $100 that the product page records is therefore a function of surviving the spread and one losing straddle at 0.10 lots, not of any internal risk guard.

If you run this EA, the practical workflow is: attach it to a single chart per symbol you want bracketed, set the magic uniquely if you run multiple instances, and pre-warm the symbol on a calendar so you know whether hour 8, 13, or 15 is the one that matters for your session. Backtests will look poor on M1 historical data because M5/H1 candle compression hides the news spikes that activate the straddle — this is an EA designed to be evaluated on tick-data news windows, not on bar-by-bar signals. The .mq5 compiles under #property strict and uses only the standard Trade.mqh include; no third-party libraries are required.

A subtle gotcha worth flagging: the straddle fires only on the first tick of the matching minute-zero hour. If the terminal is closed, the chart is hidden, or the broker's tick feed is silent at the exact second the bar rolls over, the bracket is skipped entirely until the next scheduled hour. The 3600-second cooldown also means a manual Buy or Sell placed earlier in the hour does not block the straddle from arming at the top of the hour — the only thing the cooldown guards against is the straddle re-arming itself within the same window. Plan for missed events by running a calendar check before each session, not by relying on the EA to catch up.

Strategy Deep Dive

The OnTick handler reads TimeCurrent into an MqlDateTime struct and bails immediately unless dt.min == 0, so the straddle logic only runs on the first tick of every server hour. It then checks the cooldown (TimeCurrent() - lastTrade < 3600) and the isNewsHour flag (true only for hours 8, 13, and 15); if both pass, it reads the live ask/bid, computes the four price levels (entry ± InpStopDistance, entry − SL, entry + TP) in points ×10, and submits the Buy Stop and Sell Stop back-to-back with ORDER_TIME_SPECIFIED and an expiry set to TimeCurrent() + InpCancelAfterMins * 60. The trade object is configured once in OnInit with magic 22216083 and 20 points of deviation. After the submission, lastTrade is set to TimeCurrent() and OnTick returns until the next top-of-hour tick — there is no per-position management loop, no SL/TP modification after fill, and no indicator subscription. The three retry helpers at the bottom of the file are not called from OnTick; they are scaffolding for the EA family that the news-trader logic in this file does not exercise.

Entry Signal

The EA arms a straddle once per server hour by submitting a Buy Stop InpStopDistance pips above the current ask and a Sell Stop the same distance below the current bid, using ORDER_TIME_SPECIFIED with an InpCancelAfterMins-minute expiry. The trigger hours are 8, 13, and 15 — explicit proxies for news times in the open-source version. Both pending orders carry the same InpLotSize and the same SL/TP distance, so the entry decision is purely clock-driven and contains no indicator stack.

Exit Signal

The straddle resolves in one of three ways: the Buy Stop triggers and the Sell Stop expires unfilled, the Sell Stop triggers and the Buy Stop expires, or neither triggers and both orders drop at expiry. A triggered position runs to its fixed 50-pip take-profit or its 30-pip stop-loss as submitted on the original pending ticket; there is no trailing, no breakeven, no partial close, and no time-based exit in OnTick. The 3 retry helpers in the source (TryClose/TryClosePartial/TryModify) are defined but never invoked from the live path.

Stop Loss

Each triggered pending order is submitted with a fixed 30-pip stop-loss as part of the order ticket; the EA does not recalculate, widen, or trail the SL after the fill. There is no global equity stop, no daily loss cap, and no per-straddle risk-percentage check — the protective stop on the pending order is the only loss boundary.

Take Profit

The fixed take-profit is 50 pips from the entry price, embedded in the pending order at submission. There is no scaling-out, no partial close, and no TP ratchet — the entire position closes at TP or SL, whichever is hit first, when the broker processes the order.

Best For

Best suited to traders who already track scheduled economic releases on XAUUSD and want a hands-off way to bracket the spike with 0.10-lot positions on the M5 or H1 timeframe. Minimum recommended balance is $100 per symbol; run it on an ECN or low-spread broker because both pending orders sit live simultaneously and any spread spike on a thin book will be paid twice if both fire and close at SL. The 20-point deviation allowance is appropriate for FX majors and may be too tight for gold during volatile windows — test your broker's fill quality on news hours before sizing up.

Strategy Logic

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

Family: Trend Magic: 22216083 Version: 2.00

BRIEF: News-trader EA that places straddle pending orders (BuyStop + SellStop) at scheduled news hours, with configurable stop distance, SL/TP and auto-cancellation expiry. Cancels unfilled orders after a set period. 12 layers: REGIME, SIGNAL, ENTRY, CONFIRM, NO-TRADE, CAPITAL CAP, RISK, SIZING, MANAGE, EXIT, SCALING, OnTester

INDICATOR STACK:

  • Standard MT5 indicators

KEY FUNCTIONS:

  • TryClose_EX16083()
  • TryClosePartial_EX16083()
  • TryModify_EX16083()

INTERNAL CONSTANTS (0 total):

INPUT PARAMETERS (1 total across 1 groups):

  • [=== Trading ===] InpCancelAfterMins = 10 // NOTE: Connect to an economic calendar feed for production use.
Pseudocode
// Pipsgrowth EX16083 Trend — Execution Flow (from source analysis)
// Family: Trend
// News-trader EA that places straddle pending orders (BuyStop + SellStop) at scheduled news hours, with configurable stop distance, SL/TP and auto-cancellation expiry. Cancels unfilled orders after a set period. 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:
M5H1

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
InpCancelAfterMins10NOTE: Connect to an economic calendar feed for production use.
Source Code (.mq5)Open Source
Pipsgrowth_com_EX16083.mq5
#property copyright "Pipsgrowth.com"
#property link      "https://pipsgrowth.com"
#property version   "2.00"
#property strict
#property description "Pipsgrowth.com EX16083 NewsTrader — Straddle pending orders at news hours, full 12-layer stack."

#include <Trade\Trade.mqh>

input group "=== Identity ==="
input int    InpMagicNumber     = 22216083;
input string InpTradeComment    = "Psgrowth.com Expert_16083";

input group "=== Trading ==="
input int    InpMinsBefore      = 5;
input int    InpStopDistance    = 20;
input double InpLotSize         = 0.10;
input int    InpStopLoss        = 30;
input int    InpTakeProfit      = 50;
input int    InpCancelAfterMins = 10;

// NOTE: Connect to an economic calendar feed for production use.
// This demo version places orders at session opens as a proxy for news times.
CTrade trade;
datetime lastTrade = 0;
int OnInit() { trade.SetExpertMagicNumber(InpMagicNumber); trade.SetDeviationInPoints(20); return INIT_SUCCEEDED; }
void OnDeinit(const int r) {}
void OnTick() {
   MqlDateTime dt; TimeCurrent(dt);
   if(dt.min != 0) return;
   if(TimeCurrent()-lastTrade < 3600) return;
   bool isNewsHour = (dt.hour==8||dt.hour==13||dt.hour==15);
   if(!isNewsHour) return;
   double ask=SymbolInfoDouble(_Symbol,SYMBOL_ASK),bid=SymbolInfoDouble(_Symbol,SYMBOL_BID);
   double dist=InpStopDistance*_Point*10, sl=InpStopLoss*_Point*10, tp=InpTakeProfit*_Point*10;
   datetime expiry=TimeCurrent()+InpCancelAfterMins*60;
   trade.BuyStop(InpLotSize,NormalizeDouble(ask+dist,_Digits),_Symbol,ask+dist-sl,ask+dist+tp,ORDER_TIME_SPECIFIED,expiry,InpTradeComment);
   trade.SellStop(InpLotSize,NormalizeDouble(bid-dist,_Digits),_Symbol,bid-dist+sl,bid-dist-tp,ORDER_TIME_SPECIFIED,expiry,InpTradeComment);
   lastTrade=TimeCurrent();
}
//+------------------------------------------------------------------+
bool TryClose_EX16083(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 ||
         rc==TRADE_RETCODE_PRICE_OFF || rc==TRADE_RETCODE_PRICE_CHANGED)
      { Sleep(200); continue; }
      break;
   }
   return false;
}

bool TryClosePartial_EX16083(ulong ticket, double volume)
{
   for(int a=0; a<3; a++)
   {

Full source code available on download

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

Tags:ex16083trendpipsgrowthfreemt5xauusd

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