P
PipsGrowth
Trend FollowingOpen Source – Free

Pipsgrowth EX16064 Trend

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

Pipsgrowth.com EX16064 PricePusherEA — Live price streamer via WebRequest, full 12-layer stack.

Overview

Pipsgrowth EX16064 is not a trading strategy. It is a price-streaming utility that pumps live bid, ask, and mid quotes from MetaTrader 5 out to an external PHP endpoint using the WebRequest function. The chart symbol and any user-defined symbol list are polled on a fixed timer; each tick of the timer ships a JSON payload to the URL configured in the inputs, and the receiving PHP script is expected to persist or broadcast those prices to whatever downstream system needs them — a custom web dashboard, a Telegram bot, a mobile app, a remote journal, or an analytics back-end. There are no entries, no exits, no stop loss, no take profit, no indicator stack, and no risk model. Three CTrade retry helpers (TryClose_EX16064, TryClosePartial_EX16064, TryModify_EX16064) are defined in the source but are never called from OnTimer or OnInit; they are vestigial scaffolding from the template the EA was forked from, not part of the operational flow.

The polling rhythm is set by the IntervalSeconds input (default 5 seconds). OnInit calls EventSetTimer with that value, OnDeinit calls EventKillTimer to release the timer cleanly, and OnTimer is the only routine that runs after startup. Each OnTimer invocation calls BuildPayload to assemble the JSON body and then SendJSON to ship it. If the user has populated the SymbolsList input with a comma-separated list, BuildPayload splits that list, trims each token, looks up SymbolInfoDouble for SYMBOL_BID and SYMBOL_ASK, and concatenates a JSON object per symbol — { code, bid, ask, mid } — into a single array. If the list is empty, the EA falls back to chart-symbol mode and emits a single JSON object for whatever symbol the chart is currently showing. In both cases the output is normalized to a JSON array before being sent, so the receiving endpoint never has to branch between single-object and array shapes.

Symbol mapping is handled by the MapToCode function. It strips common broker-suffix decorations (a trailing dot-suffix such as .r or .m, or trailing letters pro/r/m that some brokers append to symbol names) and then applies a hard-coded code map: XAUUSD becomes GOLD, XAGUSD becomes SILVER, WTI/CL/UKOIL/USOIL collapse to OIL, NG/NATGAS to GAS, and DXY to USD. Anything else — EURUSD, GBPUSD, USDJPY, AUDUSD, and so on — passes through unchanged. The map exists so the upstream pricing service can key prices on stable, broker-independent codes rather than on whatever your MT5 broker happens to call a metal or index contract. If you need to add your own mapping, the function is the single place to extend.

The HTTP request itself is constructed in SendJSON. The URL is built by appending ?token= plus the Token input to the Endpoint string; the body is the JSON array returned by BuildPayload; the method is POST; the content type is application/json; and the timeout is 8000 ms. A non-200 response prints the HTTP code and the body so the user can see why the push failed. With LogSuccess set to true, every successful push also prints the response body — useful for debugging the PHP side but noisy in production, where the default is false.

Configuration lives entirely in the two input groups. The Identity group holds InpMagicNumber (long, default 22216064) and InpTradeComment (the comment string Psgrowth.com Expert_16064 that would be written to a trade if the EA ever opened one). The Price Push Settings group holds the Endpoint URL, the shared Token, the SymbolsList string, the IntervalSeconds int, the PushChartSymbolAlso flag, and the LogSuccess flag. There are no other inputs. There is no buffer to be wrong, no indicator period to tune, no risk percentage to debate — the EA is what its inputs say it is.

There are three operational gotchas worth knowing up front. First, WebRequest is restricted by default in MT5: the exact Endpoint URL (or its host) has to be added to Tools → Options → Expert Advisors → Allow WebRequest for the listed URL, otherwise every push will fail with a 4063-style error. Second, the Token is a shared secret — the default CHANGE_ME_TOKEN should be replaced before the EA goes live, and the matching PRICE_PUSH_TOKEN on the PHP side has to be set in the .env of the receiving application. OnInit prints a soft warning if the token is shorter than 8 characters. Third, pushing more often than roughly once per second starts to compete with the terminal's own price updates and can produce duplicate or near-duplicate rows on the receiver; the input comment explicitly advises against sub-2-second intervals, and the default of 5 is a sensible floor for most dashboards.

Typical use cases are dashboard bridges — piping the broker's spot prices into a custom website so customers see the same quotes the broker sees without scraping — price-mirroring for social-trading or signal services that need a stable feed, journaling integrations that record every tick for later analysis, and lightweight alert engines that watch prices in PHP rather than in MQL. The 12-layer architecture label in the header is descriptive boilerplate carried over from the EA template; the actual behavior is just timer-driven HTTP POST.

In backtest this EA will not open or close anything and will produce a flat equity curve — it is not a strategy. Its value is operational, not alpha-generating. Attach it to a chart on any symbol you want to feed, configure the endpoint and token, make sure the WebRequest URL is allowlisted, and you will see a fresh JSON push arrive at the receiving service every IntervalSeconds. A ForcePush() function is exposed as a public no-argument routine so a chart hotkey or another EA can trigger an immediate push outside the timer cadence if a specific event needs to be flushed right away.

Strategy Deep Dive

OnInit registers a recurring timer with EventSetTimer using the IntervalSeconds input (default 5 seconds); OnDeinit calls EventKillTimer. Each OnTimer tick calls BuildPayload, which splits the comma-separated SymbolsList (or falls back to the chart symbol if the list is empty), strips broker-suffix decorations in MapToCode, looks up SYMBOL_BID and SYMBOL_BID for each entry via SymbolInfoDouble, computes the mid price, and assembles a JSON array of {code, bid, ask, mid} objects. The chart symbol is optionally appended to the array when PushChartSymbolAlso is true and the chart symbol is not already present in the list. SendJSON then POSTs the array to the URL formed by concatenating Endpoint with ?token= plus the Token input, using a 8000 ms WebRequest timeout and application/json content type. Non-200 responses and the request body are printed so failures are visible in the Experts log. A public ForcePush() routine is exposed for out-of-band triggers, but no other functions — including the three CTrade retry helpers TryClose_EX16064, TryClosePartial_EX16064, and TryModify_EX16064 — are wired into the timer flow.

Entry Signal

No trade entries are generated. This EA is a price-streaming utility, not a strategy. OnTimer calls BuildPayload which assembles a JSON array of {code, bid, ask, mid} objects from the configured SymbolsList (or chart symbol only if the list is empty) and then SendJSON POSTs that payload to the PHP endpoint at the URL set in the Endpoint input.

Exit Signal

No trade exits are generated. There are no open positions to close because the EA never opens any. The three TryClose helpers in the source (TryClose_EX16064, TryClosePartial_EX16064, TryModify_EX16064) are unreferenced from OnTimer and are dead code carried over from the EA template the file was forked from.

Stop Loss

Not applicable. The EA does not open, modify, or close any positions, so there is no per-trade stop loss. The PHP endpoint may apply its own downstream risk rules to the streamed prices, but no stop loss is enforced inside the MQL code itself.

Take Profit

Not applicable. The EA does not open, modify, or close any positions, so there is no per-trade take profit. The Take Profit concept is meaningless in a price-pusher utility — there is no entry to attach a target to.

Best For

Best suited for developers and integrators who need a live MT5-to-PHP price bridge for a custom web dashboard, social-trading or signal feed, journaling pipeline, or downstream alert engine. The default $100 minimum deposit and MEDIUM risk label are template placeholders only — the EA does not draw on account equity or block on balance, so a small funded demo account is enough to run it as a background service. Runs on any timeframe (M5 to H1) and any symbol, including the FX majors, XAUUSD, XAGUSD, and broker-renamed metal or oil contracts which are remapped to GOLD, SILVER, OIL, GAS, or USD by MapToCode. Requires Tools → Options → Expert Advisors → Allow WebRequest to include the Endpoint host.

Strategy Logic

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

Family: Trend Magic: 22216064 Version: 2.00

BRIEF: Price pusher utility that streams live Bid/Ask/mid for one or many MT5 symbols to a PHP endpoint via WebRequest. Supports multi-symbol lists, symbol mapping (XAUUSD->GOLD etc.), and configurable push intervals. Timer-based; chart symbol optional. 12 layers: REGIME, SIGNAL, ENTRY, CONFIRM, NO-TRADE, CAPITAL CAP, RISK, SIZING, MANAGE, EXIT, SCALING, OnTester

INDICATOR STACK:

  • Standard MT5 indicators

KEY FUNCTIONS:

  • EndsWith()
  • Trim()
  • MapToCode()
  • SendJSON()
  • BuildPayload()
  • OnTimer()
  • ForcePush()
  • TryClose_EX16064()
  • TryClosePartial_EX16064()
  • TryModify_EX16064()

INTERNAL CONSTANTS (0 total):

INPUT PARAMETERS (8 total across 2 groups):

  • [=== Identity ===] InpMagicNumber = 22216064 // Magic number
  • [=== Identity ===] InpTradeComment = "Psgrowth.com Expert_16064" // Trade comment
  • [=== Price Push Settings ===] Endpoint = "http://localhost/stocks/public/api/`push_price`.php" // WITHOUT token parameter
  • [=== Price Push Settings ===] Token = "CHANGE_ME_TOKEN" // Must match PRICE_PUSH_TOKEN in .env
  • [=== Price Push Settings ===] SymbolsList = "EURUSD,GBPUSD,USDJPY,XAUUSD,XAGUSD" // Comma separated; leave blank to use only chart symbol
  • [=== Price Push Settings ===] IntervalSeconds = 5 // Push interval (avoid too small <2s)
  • [=== Price Push Settings ===] PushChartSymbolAlso = true // Include chart symbol even if list defined
  • [=== Price Push Settings ===] LogSuccess = false // Verbose success logs
Pseudocode
// Pipsgrowth EX16064 Trend — Execution Flow (from source analysis)
// Family: Trend
// Price pusher utility that streams live Bid/Ask/mid for one or many MT5 symbols to a PHP endpoint via WebRequest. Supports multi-symbol lists, symbol mapping (XAUUSD->GOLD etc.), and configurable push intervals. Timer-based; chart symbol optional. 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
InpMagicNumber22216064Magic number
InpTradeComment"Psgrowth.com Expert_16064"Trade comment
Endpoint"http://localhost/stocks/public/api/push_price.php"WITHOUT token parameter
Token"CHANGE_ME_TOKEN"Must match PRICE_PUSH_TOKEN in .env
SymbolsList"EURUSD,GBPUSD,USDJPY,XAUUSD,XAGUSD"Comma separated; leave blank to use only chart symbol
IntervalSeconds5Push interval (avoid too small <2s)
PushChartSymbolAlsotrueInclude chart symbol even if list defined
LogSuccessfalseVerbose success logs
Source Code (.mq5)Open Source
Pipsgrowth_com_EX16064.mq5
#property copyright "Pipsgrowth.com"
#property link      "https://pipsgrowth.com"
#property version   "2.00"
#property strict
#property description "Pipsgrowth.com EX16064 PricePusherEA — Live price streamer via WebRequest, full 12-layer stack."
#include <Trade\Trade.mqh>

input group "=== Identity ==="
input long   InpMagicNumber  = 22216064;           // Magic number
input string InpTradeComment = "Psgrowth.com Expert_16064"; // Trade comment

input group "=== Price Push Settings ==="
input string  Endpoint          = "http://localhost/stocks/public/api/push_price.php"; // WITHOUT token parameter
input string  Token             = "CHANGE_ME_TOKEN";  // Must match PRICE_PUSH_TOKEN in .env
input string  SymbolsList       = "EURUSD,GBPUSD,USDJPY,XAUUSD,XAGUSD"; // Comma separated; leave blank to use only chart symbol
input int     IntervalSeconds   = 5;                  // Push interval (avoid too small <2s)
input bool    PushChartSymbolAlso = true;             // Include chart symbol even if list defined
input bool    LogSuccess        = false;              // Verbose success logs

//--- helpers
bool EndsWith(const string s,const string suf){ int ls=StringLen(s), lf=StringLen(suf); return (ls>=lf && StringSubstr(s,ls-lf)==suf); }
string Trim(const string s){ string r=s; StringTrimLeft(r); StringTrimRight(r); return r; }

string MapToCode(string s){
   // Strip common suffix separators (e.g. EURUSD.r, EURUSDm)
   int p=StringFind(s,"."); if(p>0) s=StringSubstr(s,0,p);
   if(EndsWith(s,"m") || EndsWith(s,"r") || EndsWith(s,"pro")) s=StringSubstr(s,0,StringLen(s)-1);
   if(s=="XAUUSD") return "GOLD";
   if(s=="XAGUSD") return "SILVER";
   if(s=="WTI" || s=="CL" || s=="UKOIL" || s=="USOIL") return "OIL";
   if(s=="NG" || s=="NATGAS") return "GAS";
   if(s=="DXY") return "USD";
   return s; // EURUSD, GBPUSD, etc.
}

bool SendJSON(const string json){
   uchar data[]; StringToCharArray(json, data);
   uchar result[]; string headers;
   string url = Endpoint + "?token=" + Token;
   int res = WebRequest("POST", url, "application/json", 8000, data, result, headers);
   if(res!=200){ Print("[PricePusher] HTTP=",res," body=",json); return false; }
   if(LogSuccess) Print("[PricePusher] OK ", CharArrayToString(result));
   return true;
}

string BuildPayload(){
   string list = SymbolsList;
   string payload;
   string parts[]; int n=0;
   if(StringLen(Trim(list))>0){ n = StringSplit(list,',',parts); }
   bool multi = (n>0);
   // Chart-only fallback
   if(!multi){
      string sym = _Symbol;
      double bid = SymbolInfoDouble(sym, SYMBOL_BID); double ask=SymbolInfoDouble(sym,SYMBOL_ASK);
      if(bid==0 || ask==0) return "";
      double mid=(bid+ask)/2.0; string code=MapToCode(sym);
      return StringFormat("{\"code\":\"%s\",\"bid\":%.5f,\"ask\":%.5f,\"mid\":%.5f}",code,bid,ask,mid);
   }
   // Multi build

Full source code available on download

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

Tags:ex16064trendpipsgrowthfreemt5xauusd

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