- Payouts from Master account to anybody else
- Payouts from Investor to Master
- Attaching and Detaching Sub-Accounts
- Deposits and Withdrawals
- Allocation Methods
- Comments after plugin done its duties
The plugin is an effective extension of the MetaTrader4 server. It allows one trading account, called master account, to distribute the margin requirements between multiple sub-accounts.
Take a quick look to overview kindly hosted by YouTube:
You are free to download files from our private nuget feed at https://nuget.cplugin.com/feeds/apps/CPlugin.MT4Plugin.MAM/versions.
Just unpack it using any popular tool, like 7Zip. All you need is DLL file.
Presented files are fully functional. But without valid license it have limitations of 100 request being preceded, then plugin switches to silent mode. Restart MT4 to reset counter.
Contact us to extend trial limitation or purchase unlimited license.
It requires Visual C++ Redistributable Packages for Visual Studio 2013 (https://www.microsoft.com/en-US/download/details.aspx?id=40784) to be installed on the server where MT4 is.
The default configuration is set to use the equity based allocation method, with any remaining volume split evenly across sub-accounts, starting with the account with the highest equity.
1. Copy the plugin dynamic-link-library file to plugins location (MetaTrader4Server\plugins);
2. Restart the MetaTrader4 server / service;
3. Open plugin’s configuration from MetaTrader4 Administrator
The same you will notice in your INI settings files:
Enable=1 ForbidInvestorTrading=0 Allocation Mode=Equity Master1=1000;InvestGrpA Master2=2000;InvestGrpB
A single instance of the plugin supports the operation of up to 64 master accounts.
To add a new master account, simply add a parameter to the plugin configuration in the Administrator or Manager Terminal.
Enable = 0 | 1- The global flag, which enable or disable the plugin.
ForbidInvestorTrading = 0 | 1- forbid investors do trade. In case of this feature must be enabled, take care about execution, it must be set to value of Manual (Group settings → Securities → Execution)
Allocation Mode = Equity- The Equity Allocation method is used to split the master’s trade volume across sub-accounts based on their equity share of the account it belongs to.
Master<1..64> = <Master Account>;<Sub-Accounts’ Group>
Master Account- Login, which should not be in any of the specified next groups
Sub-Accounts’ Group -which should be the same deposit currency as the Master Account;
Payouts from Master account to anybody else #
1. In settings you can set up to 4 (four) sessions and put day of week, since what day till what day sessions is on going.
For example, today is: 17.06.2018
Payment Week1=1-6 → will have period since 18.06.2018 00:00:00 till 23.06.2018 00:00:00 Payment Week2=1-6 → will have period since 18.06.2018 00:00:00 till 30.06.2018 00:00:00 Payment Week3=1-6 → will have period since 18.06.2018 00:00:00 till 07.07.2018 00:00:00 Payment Month=1-6 → will have period since с 18.06.2018 00:00:00 till 14.07.2018 00:00:00
2. Each master can have its own period, to the end we can set names of periods (names must be the same as in example):
Master1=2000;demoforex;Week1 Master2=2001;demoUSD;Week2 Master3=2002;demoforex;Week3 Master4=2003;demoUSD;Month
3. After start, plugin will calculate some parameters for internal use. Those are time periods in unix-time and adjust config settings to make it like this:
Payment Week1=1-6;1529884800-1530316800 Payment Week2=1-6;1529884800-1530921600 Payment Week3=1-6;1529884800-1531526400 Payment Month=1-6;1529884800-1531526400
Records like 1529884800-1530316800 should not be adjusted manually, because plugin decides actual periods when MT4 restarts.
4) Whenever you want to reset/update day of weeks for periods, you shall remove record 1529884800-1530316800, so to make it have a form like in step 2 above.
5) If you don't want to use periods for payouts and want to pay out after each closed position, then leave settings like it was before:
Master1=2000;demoforex Master2=2001;demoUSD Master3=2002;demoforex Master4=2003;demoUSD
In order to setup payout preferences, please open the user configuration dialog in Administrator or Manager Terminal. #
The following tags should be added manually to every master account configuration in the comment field:
`PA` - the account which will receive payouts;
`P%` - the payout amount expressed in percentage of master’s profitability.
There is a payout on PA account after the closing of each profitable trade with comment: 'payout 20% from #123456'
and the following will be logged to the server journal:
'6001': withdraw #2472325 from master and deposit #2472326 to '1005' [ profit: 5.50 - 20 % from closed #2472324]
Payouts from Investor to Master #
Investor also have an option to share income with its Master. To enable this you shall add a formula to investor's account comment field as of:
value is the payout amount expressed in percentage of investor's profitability.
Closed trades with positive financial result only will make such payouts.
Attaching and Detaching Sub-Accounts #
To add or attach a new sub-account to an existing master account need to move the account to the master attach group and press the Update
The following will be logged to the server journal, in case of success:
'6001': start attaching '6105' to group ZTrader2Att '6001': master balance updated #182490 [deposited 5000.00 USD] '6001': investor account '6105' attached
Attaching sub-accounts directly impacts the master account equity by adding the sub-account equity amount.
To remove or detach a sub-account from a master account need to move the account to the master detach group and press the Update button;
As a result of the detaching operation, if successful, the following actions will be performed and will be logged to the server journal:
'6001': start detaching '6104' to grouop ZTrader2Det... '6104': closed order #2472330 vol: 0.1 at 1.11645 '6001': partially closed order #2472329 closing vol: 0.1 initial vol: 0.5 at 1.11645 '6001': opened new order #2472332 vol: 0.4 at 1.11662 '6001': master balance updated #2472333 [withdraw -500.00 USD] '6001': investor account '6104' detached
All the positions of the detached sub-account will be closed; which will lead to partial closing of master account positions;
Master account equity will drop by the amount of the sub-account balance.
To move investor from one master to another need to move account from one attached group to another. It means to reattach the investor.
The operation consists of detaching from one master and attaching to another.
If investor's order could not open or close the order (no money or other reason) investor account is detaching from his master automatically and sets the comment 'DETACHED' to the account. If need to attach the user again to the master need to remove comment and press user update.
Deposits and Withdrawals #
Every time when a deposit is performed on a sub-account, it also affects the master account by automatically updating its balance, thus directly impacting master’s margin and equity values.
As a result of the deposit or withdraw operation, if successful, the following actions will be performed and will be logged to the server journal:
'6001': master balance updated #2472336 [deposited 1000.00 USD] '10': changed balance #2472335 - 1000.00 for '6004' — 'Deposit'
with comment in balance transaction:
Inv '6004' #2472335
Withdrawals are working in a similar way.
Allocation Methods #
Master Account ‘6001’ opens a trade of 10.00 lots EURUSD at the price of 1.12004. It is setup to work in Equity allocation mode and has attached the following sub-accounts with their equity:
‘6101’ with $5000;
‘6102’ with $2500;
‘6103’ with $5000;
‘6104’ with $7500.
The following is the distribution of master order #182373 across sub-accounts:
A successful opening of the sub-accounts trades is confirmed by the server log, which contains the following output:
'6001': investor '6101' open volume percent: 25% [eq: 5000 / eq_sum: 20000] '6001': investor '6201' open volume percent: 12% [eq: 2500 / eq_sum: 20000] '6001': investor '6103' open volume percent: 25% [eq: 5000 / eq_sum: 20000] '6001': investor '6204' open volume percent: 37% [eq: 7500 / eq_sum: 20000] '6001': opened order #182416 for investor '6101' [[25 % of #182415]] '6001': opened order #182417 for investor '6102' [[12 % of #182415]] '6001': opened order #182418 for investor '6103' [[25 % of #182415]] '6001': opened order #182419 for investor '6104' [[37 % of #182415]]
Comments after plugin done its duties #
- investor after trading will have comment like: "100% '2001' #1269"
- investor, when payout done: "payout 10% to '2001'"
- master trader after investor activity: "payin 20% from '1002'"
- master, when pay to broker: "payout 20% to '1000'"