HOW TO CONTROL OUR TRADE COPIERS PROGRAMMATICALLY
How to control our trade copiers programmatically
Before using below guideline, please ensure your trade copiers are updated after Aug 15, 2026.
1. Pause and Resume Trade Copiers
Our MT4/MT5 copier EAs support pausing and resuming through an MT4/MT5 global variable. You can use this feature to control a copier from your own EA or indicator.
Configure the following settings in the copier EA:
- Enable Hold-Up Feature? — Set this to true to enable the feature. The default is false.
- Global Variable Name — Enter the name of the global variable you want to use.
In your own EA or indicator, set that global variable to:
- 1 to pause the copier EA.
- 0 to resume the copier EA.
The copier EA continuously monitors the global variable and pauses or resumes accordingly.
2. Retrieve Account Balances and Position Information
There are two ways to retrieve account balances and position information from the target trading platform.
Choose Method A if you want to read the data from an MT4/MT5 EA or indicator. Choose Method B if you want to read it from a separate application.
Method A: Read Log Files from an MT4/MT5 EA or Indicator
In the copier EA, configure the following settings:
- Set 'Output position info?' to true.
- Leave 'Output position info in seconds' at its default value.
The copier EA retrieves the latest account balance and position information from its bridge app. It then writes the data to the following folder:
MT5: [MT5 data folder]/MQL5/Files/TradingConnectivity/Logs/
MT4: [MT4 data folder]/MQL4/Files/TradingConnectivity/Logs/
The Files folder is within the MT4/MT5 file sandbox, so your EA or indicator can read these files directly without an external DLL.
Log filenames use the following format:
[mt4/mt5]to[target platform]_[YYYYMMDD].log
For example:
mt5totradelocker_20260817.log
New log entries are appended to the current day's file by broker server time. Keep the output interval at 15 seconds or longer to prevent daily log files from becoming too large. By setting 'Purge old log messages?' variable to true, the log file can be set to automatically removes messages older than 15 minutes to keep its size manageable.
Example position update:
[2026.08.16 12:36:22] Account 1533685 position update: {"account":"1533685","balance":9740.78,"positions":[{"id":"216172782116546753","symbol":"BTCUSD","volume":0.01,"side":"buy","stopLoss":0,"takeProfit":0},{"id":"216172782116546754","symbol":"BTCUSD","volume":0.01,"side":"buy","stopLoss":0,"takeProfit":0}]}
To process an entry, extract the JSON object after 'position update:' and parse it with your JSON parser.
If the balance is unavailable, the output contains:
"balance":null
The standard MatchTrader copier uses a different position JSON format and does not include the account balance in position updates.
To retrieve the balance, also enable 'Output balance info?' in the copier EA. Balance updates use the same output interval, with the balance request scheduled 15 seconds after the position request. Enable these settings to inspect the actual JSON output for your account.
Example MatchTrader position update for 'Trading Edge backend' variable is enabled.
[2026.11.05 12:18:06] Account 2030298 position update: {"positions":[{"id":"W129093050267474","symbol":"AUDCAD","alias":"AUDCAD","volume":0.01,"side":"BUY","openTime":"2026-11-05T12:17:22.053Z","openPrice":0.97877,"stopLoss":0.90867,"takeProfit":null,"trailingDistance":null,"swap":0.00,"profit":0.05,"netProfit":0.00,"currentPrice":0.97884,"commission":-0.05,"margin":7.01}]}
Example MatchTrader balance update for 'Trading Edge backend' variable is enabled.
[2026.11.05 12:18:20] Account 2030298 balance update: {"balance":4987.88,"equity":4987.86,"freeMargin":4980.82,"marginLevel":71153.06,"credit":0.00,"currency":"USD","currencyPrecision":2,"margin":7.01,"profit":0.03,"netProfit":-0.02,"profitUpdateTimestamp":1793881100641,"marginCalculationType":"UNREALIZED_LOSS_ONLY"}
Balance and equity are different values. Equity reflects unrealized gains and losses and can fluctuate while positions are open. Balance reflects realized account activity, such as closed trades.
Supported Copiers and Log Filenames
In the filenames below, [date] uses the YYYYMMDD format.
- MT4/MT5 to cTrader non-API
mt4toctrader_[date].log
mt5toctrader_[date].log
- MT4/MT5 to DxTrade non-API
mt4todxtrade_[date].log
mt5todxtrade_[date].log
- MT4/MT5 to MatchTrader
mt4tomatchtrader_[date].log
mt5tomatchtrader_[date].log
- MT4/MT5 to MatchTrader II*
mt4tomatchtraderii_[date].log
mt5tomatchtraderii_[date].log
- MT4/MT5 to The5ers
mt4tothe5ers_[date].log
mt5tothe5ers_[date].log
- MT4/MT5 to ThinkMarkets
mt4tothniktrader_[date].log
mt5tothinktrader_[date].log
- MT4/MT5 to TradeLocker non-API
mt4totradelocker_[date].log
mt5totradelocker_[date].log
- MT4/MT5 to Tradovate
mt4totradovate_[date].log
mt5totradovate_[date].log
* MT4/MT5 to MatchTrader II is a special version of the MatchTrader copier. It uses the common JSON format shown in the first position update example, rather than the format used by the standard MatchTrader copier.
Method B: Read a Snapshot File from Your Own Application
Use this method to retrieve account balances and position information from an application outside MT4/MT5.
Add the following two lines to the bridge app's config.ini file:
outputPosition=on
outputInterval=3
The default output interval is 3 seconds.
Save config.ini and restart the bridge app. Once all accounts are logged in, the app creates a snapshot file named positions.txt in its output subfolder.
The snapshot is refreshed at the configured interval while the bridge app is running and the accounts remain connected.
Example file contents:
updated:2026-08-16T18:53:15Z,1786906395
{"accounts":[{"account":"1071576","balance":5004.38,"positions":[]},{"account":"9121099","balance":103676.39,"positions":[{"id":"661852265","symbol":"BTCUSD","volume":0.01,"side":"buy","stopLoss":60033.45,"takeProfit":68033.45},{"id":"661862884","symbol":"BTCUSD","volume":0.02,"side":"buy","stopLoss":60114.9,"takeProfit":69114.9},{"id":"661862888","symbol":"BTCUSD","volume":0.01,"side":"sell","stopLoss":0,"takeProfit":0}]}]}
The first line records the snapshot's update time, based on your computer's clock, in UTC and as a Unix timestamp.
The JSON object contains the full list of accounts, including each account's balance and positions. An empty positions array means the account has no open positions.
Supported Bridge Apps
- cTrader
- DxTrade
- MatchTrader II
- The5ers
- ThinkTrader
- TradeLocker
- Tradovate