This tool uses ManagerAPI to get trade activity from source MT4 server and send it to other MT4 servers.
1. Put all files into separate folder
2. Obtain mtmanapi.dll files and put to the application's folder
3. Obtain M4ServerAPI.dll file and put to the application's folder
4. Run the program to let it generate empty settings file
When you first time run the application it will generate sample settings file.
Its name will be CPlugin.CopyTrade.ManAPITool.NET.xml and it is self explanatory XML file. We have included example of settings file CPlugin.CopyTrade.ManAPITool.NET.xml.example for your convenience.
Source MT4 server #
In <source> node you put source MT4 server address and credentials for manager account.
Destination MT4 servers #
<copy> nodes can describe destination accounts that could be even on different servers.
where parameter describes expression using FLEE (https://flee.codeplex.com) notation to check that trade meet requirements. You can use trade variable to check its volume, symbol, etc.
where="trade.Login = 1000 and trade.Volume > 100" - to check if login is 1000 and volume is greater that 1 lot (100 in MT4 api).
where="trade.Login in (1000;1001;1002) and trade.Symbol = EURUSD" - to check if login on of 1000/1001/1002 and order symbol is EURUSD.
`;` - local windows OS settings → your region settings → list separator.
Copying settings #
guid - unique GUID that must be put once and never changed, because program store its cache and after close need this guid to understand which server have which trades opened.
address, port, login -
coef - coefficient of volume to be copied, for example 1 means 100%, -1.5 means 150% in opposite side.
open_slippage, close_slippage - passably slippage on trade open/close respectively.
copy_sl, copy_tp - do copy SL/TP levels?
copy_comment - true/false to enable copying trade comment from source trade to copied one.
set_comment - if
copy_comment is set to false you can put here any string to be as a comment for copied order.
Symbol names mapping #
<copy> can have multiple
<map> nodes. It describe mapping between different symbol names.
from fields contains regular expression of source server symbol name that has to be mapper into
to map from regular symbols to symbol with dot you should write:
<map from="(\w+)" to="$1." />
Here we've used `$1` substitution and `.` as suffix.
<map from="(...)(...)p" to="$1$2c" />
to map from all symbols ending with `p` contains 6 characters before to the same same with `c` character at the end. For example, EURUSDp will be mapped to EURUSDc.
Process of using this tool is simple, just run he application and notice its journal on screen an/or file. Depend of your settings for NLog which you can adjust through NLog.config file.
To exit - push `Q` key on your keyboard.
Even after you close and start it again it maintain open trades list in its file cache storage.bin file.
Do not remove storage.bin file with no real reasons. Program might loose binding between internal orders database and real MT4 orders.
<?xml version="1.0" encoding="utf-8"?> <settings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <source address="127.0.0.1" port="443" login="1" password="password123" /> <copy where="trade.Login = 1000"> <to address="127.0.0.1" port="443" login="1002" password="Trader" coef="-0.5" open_slippage="2" close_slippage="10" copy_sl="false" copy_tp="false" copy_comment="false" set_comment="[copied]" guid="050b29c5-0d55-4dbd-bb78-a4dfd24858ed"> <map from="(...)(...)p" to="$1$2c" /> </to> <to address="127.0.0.1" port="443" login="1002" password="Trader" coef="-0.5" open_slippage="2" close_slippage="10" copy_sl="false" copy_tp="false" copy_comment="true" set_comment="[copied]" guid="050b29c5-0d55-4dbd-bb78-a4dfd24858ed"> </to> </copy> </settings>