Pipsgrowth EX12058 MultiIndicatorConfluence
MT5 Expert Advisor (Open Source) · XAUUSD, EURUSD, USDJPY, GBPUSD · M1
File-based bridge EA for MT5 <-> Python communication. Receives trade commands via text file, executes Buy/Sell orders with configurable SL/TP, symbol suffix support, and logging. Designed for Exness MT5 with suffix symbols. 12 layers: REGIME, SIGNAL, ENTRY, CONFIRM, NO-TRADE, CAPITAL CAP, RISK, SIZING, MANAGE, EXIT, SCALING, OnTester.
Overview
Pipsgrowth EX12058 ForexSmartBotBridge is not a strategy Expert Advisor in the conventional sense. It is a thin MT5-resident command executor: a permanent listener that sits on the chart, opens a known text file on every tick and timer beat, parses a line of pseudo-MQL4 syntax written there by an external process, and translates that line into a real broker order. The header comment makes the design intent explicit ("File-based bridge EA for MT5 <-> Python communication"), and the 13-function surface area is built entirely around that single workflow. There are no indicator handles, no on-bar calculations, no signal scoring, no regime classifier, and no OnTester block — the strategy logic lives outside the EA, in whatever Python (or other) process is writing the command file, and the EA's job is just to make the broker execute it cleanly.
The listening side is double-redundant. OnTick() throttles a CheckForCommands() call to once every 500 milliseconds via GetTickCount(); OnTimer() — set up in OnInit() with EventSetTimer(1) — does the same with a 1-second gate. Whichever fires first opens the file ForexSmartBot_Command.txt from the MT5 sandboxed MQL5/Files directory using FILE_READ|FILE_TXT|FILE_ANSI, reads the lines, executes each one, then FileDelete()s the file so the next call sees a clean slate. If no line was read on the first pass, the code rewinds to offset 0 and tries once more. This pair of redundant triggers is what makes the bridge feel like a socket to a Python client even though it is literally just disk I/O.
ExecuteCommand() is a hand-rolled mini-dispatch table. The dispatcher keys off StringFind() probes for the substrings "OrderSend", "CloseAll", "GetBalance", "GetPositions", and "GetPrice". OrderSend is the only path that opens a position: it expects a payload of the form OrderSend(SYMBOL,BUY/SELL,QUANTITY,SL=value,TP=value), splits on the left paren to peel the function name off, then StringSplit()s the parameter list on commas. SL and TP are optional and the parser walks the parameter array from index 3 looking for the key=value tokens. If the caller did not supply an SL, the bridge synthesizes one at 2% beyond the entry — price * 0.98 for a buy, price * 1.02 for a sell. If no TP was supplied it synthesizes one at 3% in the favourable direction (price * 1.03 for a buy, price * 0.97 for a sell). All three numbers are NormalizeDouble()'d to the symbol's digit count before being passed to CTrade.
The order execution path goes through a CTrade instance configured at OnInit(): SetExpertMagicNumber(22212058) is fixed (and is the only way the bridge's orders are distinguishable from manual trades on the account), SetDeviationInPoints(30) sets a 30-point slippage tolerance against the IOC filling mode selected via SetTypeFilling(ORDER_FILLING_IOC). The IOC mode is the important choice: in a file-bridge scenario the price in the command is a snapshot from when Python wrote the file, and FOK or IOC is the safer fill mode for stale prices because it does not queue. SubmitOrder() is a parallel programmatic entry point that re-clamps volume to symbolInfo.LotsMin()/LotsMax() and MathFloor(volume/lot_step)*lot_step — a safety net for when the external caller sends an invalid lot size — but the Python-driven path does not use it; the file-bridge path relies on the order being correct upstream.
The SL/TP defaults deserve attention because they are not pips-based — they are price-percent-based. A 2% SL on XAUUSD at $2,000 is $40, on a 5-digit broker that is 400 points. The 3% TP is $60, 600 points. On a 5-digit FX pair at 1.1000, the SL lands at 1.0780 (220 pips) and the TP at 1.1330 (330 pips). This is meaningful: it means a single Python command intended for a gold chart will produce a wildly different dollar risk on a EURUSD chart, and a single command intended for FX will produce a tiny absolute stop on gold. Anyone wiring the bridge to multiple symbols must translate the SL/TP numerics per symbol, not send a raw price.
The non-trading commands are the second half of the contract. GetBalance() writes the AccountInfoDouble(ACCOUNT_BALANCE) value to ForexSmartBot_Balance.txt using FILE_WRITE|FILE_TXT. GetPositions() serializes the live position book as a JSON-ish array (the code uses string concatenation rather than CJSONEncoder, so the output is a string built char-by-char with all positions comma-separated inside a [ ] envelope, each with ticket/symbol/type/side/volume/entry_price/current_price/sl/tp/profit/timestamp fields). GetPrice() writes symbolInfo.Bid() to ForexSmartBot_Price.txt. CloseAll(SYMBOL) walks PositionsTotal() in reverse and routes each ticket through TryClose_EX12058() with the magic filter, optionally sending the literal string "ALL" to flatten everything on the account regardless of symbol.
The closing and modification paths use the same retry wrapper convention as the rest of the EX12 family. TryClose_EX12058(ulong ticket) loops up to 3 times, calls trade.PositionClose(ticket), checks for TRADE_RETCODE_DONE or TRADE_RETCODE_DONE_PARTIAL, and on a transient REQUOTE/TIMEOUT/PRICE_OFF/PRICE_CHANGED retcode it Sleep(200) and retries. TryClosePartial_EX12058 is identical against trade.PositionClosePartial(). TryModify_EX12058 loops 3 times against trade.PositionModify(ticket, sl, tp) with a shorter 100ms Sleep and a smaller retcode set (REQUOTE, TIMEOUT only). These wrappers are used by the bridge's own CloseAll path and also exist for any future caller that wants to wire a modify or partial-close command into the same protocol.
Inputs are minimal because the logic is external. The Connection group has ServerHost="127.0.0.1", ServerPort=5555, and EnableLogging=true — note that the host and port are only echoed in the OnTimer() heartbeat Print() and are not used to open a real socket. The code is explicitly a file-based bridge, not a ZeroMQ bridge, despite the SimulateZeroMQResponse() helper that returns canned JSON for ping/price/balance/equity/symbol_info/historical_data/order/close_all/positions — that function is a stub for a future socket-based variant. The Identity group has MagicNumber=22212058, InpTradeComment="Psgrowth.com Expert_12058", SymbolSuffix="m" (Exness convention), and DefaultSymbols="XAUUSDm,EURUSDm,USDJPYm,GBPUSDm" as the default watch list. The suffix is concatenated onto any symbol the Python caller passes without one, which is what makes the bridge work on Exness's m-suffixed symbol naming.
The order in which Python should drive this EA is straightforward: drop the EA on any chart (the EA does not care about timeframe or symbol — it operates against the symbols passed in the commands), write OrderSend(...) lines into ForexSmartBot_Command.txt, optionally poll ForexSmartBot_Balance.txt, ForexSmartBot_Positions.txt, and ForexSmartBot_Price.txt for state. Because the bridge FileDelete()s the command file after every successful read, a single command per file is the safe pattern — write a line, let the EA consume it, then write the next one. The bridge will sit there idle when the file is missing, so it has no idle CPU cost beyond the GetTickCount() math on each tick.
This is a different category of EA from a trading system. Run a backtest of EX12058 in the MT5 strategy tester and the result will be a flat equity curve with no trades — the tester does not write command files for the EA to consume. The right way to validate it is to run a Python loop in demo, watch the logs, and confirm that the orders it sends match what the bridge executed on the account. The bridge is honest about that: its header makes no claim of strategy logic, and the body of the code is a single-purpose dispatch table.
Strategy Deep Dive
EX12058 is a chart-resident MT5 listener for an external Python strategy engine. OnTick() and a 1-second OnTimer() both gate CheckForCommands() — the tick path with a 500 ms GetTickCount() throttle, the timer path with a 1-second gate — and whichever fires first opens ForexSmartBot_Command.txt from MQL5/Files, walks the lines, dispatches each to ExecuteCommand()'s substring-keyed switch (OrderSend, CloseAll, GetBalance, GetPositions, GetPrice), and FileDelete()s the file. The OrderSend branch is the only path that opens a position: it splits the payload on commas, optionally parses SL= and TP= tokens, fabricates 2% SL / 3% TP defaults if those are absent, NormalizeDouble's everything to the symbol's digits, and hands a CTrade.Buy or CTrade.Sell to a CTrade instance configured at OnInit() with magic 22212058, 30-point deviation, and ORDER_FILLING_IOC. Positions live and die by broker-side hits on those static brackets, or by a Python-driven CloseAll that routes through the TryClose_EX12058 3-attempt 200ms-Sleep wrapper. There are no indicators, no signal generation, no scaling, no trailing, no break-even, no session filter, no pause guard, and no daily close — the bridge is a single-purpose executor and the strategy lives in whatever process writes the command file.
Entries are not generated internally — EX12058 is a file-based bridge. The EA watches the chart for the file ForexSmartBot_Command.txt to appear in the MQL5/Files sandbox, then parses any OrderSend(SYMBOL,BUY/SELL,QUANTITY,SL=value,TP=value) line written there by an external Python process, resolves the symbol (with auto-appended 'm' suffix for Exness), reads the live Ask or Bid via CSymbolInfo, and submits a market order through CTrade with the supplied lot size and brackets (or 2%/3% defaults if SL/TP are absent). The check fires every 500 ms on tick and every 1 s via OnTimer, and the command file is FileDelete()'d after consumption so a single command per file is the safe pattern.
Exits happen two ways. A Python-side CloseAll(SYMBOL) command — or the literal CloseAll(ALL) — iterates PositionsTotal() in reverse and routes every ticket through the TryClose_EX12058 wrapper (3 attempts, 200 ms Sleep on REQUOTE/TIMEOUT/PRICE_OFF/PRICE_CHANGED). Otherwise exits happen passively when price hits the SL or TP that was attached at entry — those are price-percent defaults (2% SL, 3% TP from entry) when the Python caller does not supply explicit levels, and they stay on the order ticket as normal broker-side brackets with no in-EA trailing or break-even logic.
The bridge does not enforce a stop on the EA side; every position it opens carries the SL that was either parsed from the OrderSend command or synthesized as a price-percent default (2% adverse move from entry: price * 0.98 for a buy, price * 1.02 for a sell, NormalizeDouble'd to the symbol's digits). For a 5-digit XAUUSD chart at $2,000 entry that 2% lands at $1,960 — 400 points — which is dramatically wider than the typical pips-based grid stops in the rest of the EX12 family.
TP is parsed from the OrderSend payload when supplied, otherwise synthesized as 3% in the favourable direction (price * 1.03 for a buy, price * 0.97 for a sell, NormalizeDouble'd to the symbol's digits). There is no EA-side partial-close or trailing-take-profit — the TP sits on the order ticket as a static broker-side target until either the price prints the level or a Python CloseAll command overrides it. The 2% SL / 3% TP pair means a default 1.5R risk-reward ratio at entry, again framed in price-percent rather than pips.
This EA is built for traders who run a Python strategy engine (or any external process) and want a clean, broker-agnostic MT5 execution leg: drop EX12058 on any chart, set ServerHost/ServerPort/EnableLogging in the Connection group and SymbolSuffix (default "m" for Exness) in the Identity group, and let the Python loop write OrderSend/CloseAll/GetBalance/GetPositions/GetPrice lines into the MQL5/Files sandbox. Minimum recommended balance is $100 and the lot clamp in SubmitOrder() means micro lots are honoured on every symbol. Pair it with an Exness MT5 account (the default symbols list — XAUUSDm, EURUSDm, USDJPYm, GBPUSDm — is preconfigured) and a Python scheduler that paces one command per file write, since the bridge FileDelete()s the command file after every successful read.
Strategy Logic
Pipsgrowth EX12058 MultiIndicatorConfluence — Strategy Logic Analysis (from .mq5 source)
Family: MultiIndicatorConfluence
Magic: 22212058
Version: 2.00
BRIEF:
File-based bridge EA for MT5 <-> Python communication. Receives trade commands via text file, executes Buy/Sell orders with configurable SL/TP, symbol suffix support, and logging. Designed for Exness MT5 with suffix symbols. 12 layers: REGIME, SIGNAL, ENTRY, CONFIRM, NO-TRADE, CAPITAL CAP, RISK, SIZING, MANAGE, EXIT, SCALING, OnTester
INDICATOR STACK:
- Standard
MT5indicators
KEY FUNCTIONS:
CheckForCommands()ExecuteCommand()OnTimer()GetCurrentPrice()GetAccountBalance()GetAccountEquity()GetSymbolInfo()GetHistoricalData()CloseAllPositions()GetOpenPositions()SimulateZeroMQResponse()TryClose_EX12058()- ...and 2 more
INTERNAL CONSTANTS (0 total):
INPUT PARAMETERS (3 total across 1 groups):
- [=== Identity ===]
InpTradeComment= "Psgrowth.com Expert_12058" // Trade comment - [=== Identity ===]
SymbolSuffix= "m" // Exness uses 'm' suffix (e.g., XAUUSDm, EURUSDm) - [=== Identity ===]
DefaultSymbols= "XAUUSDm,EURUSDm,USDJPYm,GBPUSDm" // Exness symbols
// Pipsgrowth EX12058 MultiIndicatorConfluence — Execution Flow (from source analysis)
// Family: MultiIndicatorConfluence
// File-based bridge EA for MT5 <-> Python communication. Receives trade commands via text file, executes Buy/Sell orders with configurable SL/TP, symbol suffix support, and logging. Designed for Exness MT5 with suffix symbols. 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
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 a chart matching the recommended timeframe
- 7Configure parameters according to the table on this page
- 8Enable Allow Algo Trading and click OK
EA Parameters
| Parameter | Default | Description |
|---|---|---|
| InpTradeComment | "Psgrowth.com Expert_12058" | Trade comment |
| SymbolSuffix | "m" | Exness uses 'm' suffix (e.g., XAUUSDm, EURUSDm) |
| DefaultSymbols | "XAUUSDm,EURUSDm,USDJPYm,GBPUSDm" | Exness symbols |
#property copyright "Pipsgrowth.com"
#property link "https://pipsgrowth.com"
#property version "2.00"
#property strict
#include <Trade\Trade.mqh>
#include <Trade\PositionInfo.mqh>
#include <Trade\AccountInfo.mqh>
#include <Trade\SymbolInfo.mqh>
// External parameters - Exness MT5 Configuration
input group "=== Connection ==="
input string ServerHost = "127.0.0.1";
input int ServerPort = 5555;
input bool EnableLogging = true;
input group "=== Identity ==="
input int MagicNumber = 22212058;
input string InpTradeComment = "Psgrowth.com Expert_12058"; // Trade comment
input string SymbolSuffix = "m"; // Exness uses 'm' suffix (e.g., XAUUSDm, EURUSDm)
input string DefaultSymbols = "XAUUSDm,EURUSDm,USDJPYm,GBPUSDm"; // Exness symbols
// Global variables
string g_log_prefix = "[ForexSmartBotBridge] ";
CTrade trade;
CPositionInfo positionInfo;
CAccountInfo accountInfo;
CSymbolInfo symbolInfo;
string g_symbol_suffix = ""; // Will be set from input
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
// Initialize symbol suffix
g_symbol_suffix = SymbolSuffix;
if (EnableLogging)
{
Print(g_log_prefix + "ForexSmartBotBridge EA loaded successfully");
Print(g_log_prefix + "Symbol Suffix: " + g_symbol_suffix);
Print(g_log_prefix + "Default Symbols: " + DefaultSymbols);
Print(g_log_prefix + "Account: " + IntegerToString(AccountInfoInteger(ACCOUNT_LOGIN)));
Print(g_log_prefix + "Server: " + AccountInfoString(ACCOUNT_SERVER));
}
// Set up trade object
trade.SetExpertMagicNumber(MagicNumber);
trade.SetDeviationInPoints(30);
trade.SetTypeFilling(ORDER_FILLING_IOC);
// Enable live trading automatically
if (!TerminalInfoInteger(TERMINAL_TRADE_ALLOWED))
{
if (EnableLogging)
Print(g_log_prefix + "Algorithmic trading not allowed - please enable in terminal settings");
}
// Set up timer for periodic data updates
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 Other strategy EAs from our library
Pipsgrowth EX01007 Adaptive
Pipsgrowth.com EX01007 Adaptive XAUUSD 5M — multi-indicator signal scorer with regime filter, full 12-layer stack, configurable timeframe, trailing/BE/profit-lock toggles, pyramid gate, spread filter, new-bar gate, filling mode detection.
Pipsgrowth EX01019 Adaptive
Pipsgrowth.com EX01019 Self-Adaptive Market EA Fixed — multi-regime adaptive EA, full 12-layer stack.
Pipsgrowth EX15029 SMC-OrderBlock
Pipsgrowth.com EX15029 SMCBreakoutEA — SMC breakout CHOCH/liquidity sweep EA, full 12-layer stack.
Community
Educational purposes only. Do NOT use with real money. Test on demo accounts only.