Join two MT4 Servers

Brief

There can be a situation where you have two MT4 servers and you want to combine them — to join one server database into another, transferring clients from one server to the other seamlessly.

This tool completely combines two MT4 server databases together: their users, orders databases, and the corresponding group and symbol settings. All you need to do is pass the two MT4 installation folder paths as command-line arguments, and the program prepares a result server with ready-to-go settings. When you run the result server you will find all users and their orders in place. It also takes care of symbol settings, which can differ. As a result, a client will be able to connect to the new server and continue trading as if nothing happened. Afterwards you will have a free MT4 server installation for new ventures.

How To

All files can be downloaded from the CPlugin.Tools.JoinMT4Servers feed.

Terms

The server that must include another server's data is named Master.

The server that is about to be joined is named Source.

The program does not change either the Master or the Source files. It merges everything into a new folder named Result. All current files remain the same.

Result = Master + Source

  • Master — always remains static (think of it as the new MT4 server). All existing data inside it is left unchanged, but it will be appended with new data from Source.
  • Source — its data is filtered, and the filtered data is appended into orders.dat, users.dat, and the relevant files in the config folder.
  • Result — the output (Master + appended Source). The /config folder is based on Master's files, with Source's data appended.

Algorithm of what the program does internally

You do not need to follow the steps below — this is just an explanation of what the program does for you. You only run the program and it does everything in one step.

For normal operation it needs these files from both the Master and Source servers:

  • users.dat
  • orders.dat
  • groups.ini
  • managers.ini
  • secgroups.ini
  • securities.ini

Groups

  1. Copy Master's groups.ini to Result.
  2. Join Source's groups.ini to Result.

The program adds a suffix to Source's group names. If there is an intersection between Source and Master group names, the program fails and asks the operator to specify another suffix (_new is used by default if nothing else is specified). At the same time, Source accounts will have the new group name.

Users

  1. Copy Master's users.dat to Result.
  2. Remember the last login to use in the next step.
  3. Join Source's users.dat to Result using the algorithm below:
    1. If Master does not have Source's login, the account is copied as is without any problems.
    2. If Master does have it, the program pre-allocates the next available login and copies there, so intersections are resolved. Clients should be notified that their login changed from 'A' to 'B'. The password remains the same.

Managers

  1. Copy Master's managers.ini to Result.
  2. Join Source's managers.ini to Result.

Source accounts will have a new login number.

Symbols

  1. Copy Master's securities.ini to Result.
  2. Join Source's securities.ini to Result. If Master already has a symbol with a name coming from Source, it is not joined.

Orders

  1. Copy Master's orders.dat to Result.
  2. Remember the last order number to use in the next step.
  3. Join Source's orders.dat to Result, starting from the ticket recorded in the previous step, to avoid intersections.

Source orders will have a new ticket number.

Usage

The tool has a built-in help system, accessible by running it with the --help parameter. It shows all available parameters.

CPlugin.JoinMT4Servers.exe
    --help                Print help
-m, --master arg          Master MT4 path, the server to which we will join the 'source' server
-s, --source arg          Source MT4 path, the server we are going to join to 'master'
-r, --result arg          Result MT4 path, the server which will contain both servers (result = master + source)
-g, --groupsuffix arg     Suffix to be added to 'source' groups (default: _new)
-f, --groupsfilter arg    MQ groups filter specifying what groups should be copied from the 'source' server (default: ,*,)
-c, --clear               Clear the 'result' directory of files