Broker Migration Position Translator
Moving from one broker to another almost never means the same symbol names or the same contract sizes carry over unchanged - a suffix gets added or removed (EURUSD becomes EURUSD.a, say), and instruments like indices, metals and oil frequently have a different contract size between brokers entirely, meaning the same lot count on the new broker would represent a genuinely different amount of underlying exposure. Recreating a book of positions by hand under those conditions means redoing that arithmetic once per position and getting it right every time. This script does the arithmetic instead: given a positions snapshot CSV (symbol, type, volume, open price, stop loss, take profit, comment) and a broker migration spec CSV the user fills in from both brokers' own Market Watch -> Symbols -> Properties dialogs (old symbol, new symbol, old contract size, new contract size, new lot step, new min lot, new max lot), it writes a translated snapshot where every row's volume has been rescaled so the underlying notional exposure stays the same, then rounded to the new broker's lot step and clamped to its min/max lot. This is a read-only translation tool. It never places, closes or modifies an order on any account - it reads two CSV files and writes a third. Both contract sizes it uses are fields read from the user's own InpBrokerSpecFile, never a number written into the source; translating between two brokers' published specs is the entire point of this script, so both figures necessarily appear in the calculation as config-driven values, not as an assumption about what any particular broker uses. Notes and limitations - This script does not place, close or modify any order on any account - it is a pure file-to-file translation tool. Opening the translated positions on the new broker is a manual step the trader performs afterward. - A symbol in the positions snapshot with no matching row in the broker spec file is left untranslated and reported separately in the Experts log rather than guessed at with an assumed 1:1 contract size. - Stop loss and take profit prices are carried across unchanged as absolute prices. If the new broker quotes the instrument with a different pip/point convention (a different digits count), those prices are not rescaled for that and should be checked before use. - The notional-exposure formula assumes both brokers quote the instrument in the same base currency and unit convention; a genuine cross-currency or unit difference (uncommon, but possible for some index or commodity CFDs) is not detected or corrected for automatically - verify a translated row against the new broker's own margin calculator before trading it. - Rounding to the new lot step can shift exposure slightly away from an exact match, particularly for a coarse lot step; the translated volume is the closest step-aligned approximation, not always an exact notional match.
Script · MT5 · v1.0 · Free
About Broker Migration Position Translator
Broker Migration Position Translator is a script for MetaTrader 5. It can alert you with a pop-up, sound, email or push message. It has 4 settings, such as Positions file, Broker spec file and Output file. MQL source code included.
Files in the download: BrokerMigrationTranslator.ex5, BrokerMigrationTranslator.mq5, BrokerMigrationTranslator.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Positions file | positions_snapshot.csv | Old broker's positions, from MQL5\Files |
| Broker spec file | broker_migration_spec.csv | Old-to-new symbol/contract mapping |
| Output file | positions_translated.csv | Translated snapshot written on success |
| Round to lot step | true | Round translated volume to the new broker's lot step |
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: Volume · EURUSD · Oil · Alerts · MT5 Script · MQL5 Source Code