Two Account Behaviour Comparison
MQL4 cannot connect to two accounts from one running script, so a genuine live side-by-side comparison is not possible. What this script does instead is the practical version of the same question: run it once on the demo account with InpExportThisAccount on to write a CSV of that account's closed trades, copy that file into the live terminal's MQL4\Files, then run the script again on the live account pointing InpOtherAccountFile at it. The output is the same either way round - it always compares "this account" against whatever CSV is loaded. The comparison covers win rate, average win, average loss, expectancy per trade, average lot size, average holding time, average hour of day a position was opened, and the largest single win and loss. Traders often trade demo and live differently without noticing it happening - larger size, longer holds, different session hours - and eyeballing two separate histories rarely catches which specific metric actually moved. Every line is printed side by side with the relative percent difference, and a metric crossing InpDriftFlagPercent is marked so the one number that matters does not get lost among eight others that did not change. This is a comparison tool only. It never opens, closes or modifies a position on either account, and it makes no judgement about which account's numbers are "right" - it reports the difference and leaves the interpretation to the trader. Notes and limitations - Not a live two-account connection - MQL4 genuinely cannot do that from a single script. This compares "now" against a snapshot CSV from whenever the other account was last exported, so results are only as current as that file. - Market trades only (OP_BUY/OP_SELL from closed history). Pending orders and balance operations are not part of the comparison. - Average hour of day is a plain arithmetic mean of the open hour (0-23), not a circular mean, so a trader who only trades right around midnight can show a misleading middle-of-the-day average. Read it alongside the actual trade list if the number looks odd. - The exported CSV format is specific to this script; a general trade history export from another tool will not be read correctly unless its header exactly matches ticket,symbol,type,lots,open_time, close_time,net_profit.
Script · MT5 · v1.0 · Free
About Two Account Behaviour Comparison
Two Account Behaviour Comparison is a script for MetaTrader 5. It can alert you with a pop-up, sound, email or push message. It has 6 settings, such as Other account file, From date and To date. MQL source code included.
Files in the download: TwoAccountComparison.ex5, TwoAccountComparison.mq5, TwoAccountComparison.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Other account file | other_account_export.csv | Other account's export, from MQL5\Files |
| From date | 0 | From close time (1970.01.01 = no lower bound) |
| To date | 0 | To close time (1970.01.01 = up to now) |
| Export this account | false | Also write this account's own history in the same format |
| This account file | this_account_export.csv | Output filename when exporting |
| Drift flag percent | 25.0 | Flag a metric whose relative difference exceeds this percent |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Scripts.
- Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
- Open the .mq5 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the script onto a chart to run it once.
Tags: Alerts · MT5 Script · MQL5 Source Code