MT4 Plugin
How to work with MT4 plugin
Upload the plugin to the server in the Plugins folder for the main trading server:
In the settings specify the deploy parameters:
CLIENT_CRT
string
full name of the file with the client certificate, for TLS connection
CLIENT_KEY
string
full name of the file with the client key, for TLS connection
ROOT_CA
string
full name of the file with the root certificate, for TLS connection
NATS_URLS
string
NATS address
NATS_USER
string
user name for NATS connection
NATS_PASSWORD
string
user's password for NATS connection
NATS_SERVICE_SUBJECT
string
the name that will be used for message queue in NATS (for example: if NATS_SERVICE_SUBJECT ="MT4Plugin", writing to the queue: MT4Plugin.MT4-DEAL.MT4_Test )
SERVER_CODE
string
server codename that is used to queue messages in NATS (for example: MT4_Test: MT4Plugin.MT4-DEAL.MT4_Test queue) and to reconcile entries using the DEALS-HISTORY module
GROUP_LIST
string
a list of group names separated by commas by which transactions are filtered (example: “demo\group1,demo\group2“ will publish to the queue transactions of only those accounts that start on demo\group1 or on demo\group1 transactions from groups demo\group1\anynames and demo\group2\anynames)

Run the plugin, the following entries will be visible in the MT4 server logs:

If the plugin can not connect to the NATS queue, you will see the following error in logs:

To receive a message in the NATS JetStream queue, you need to add a new topic for processing:
If all steps are successfully completed in the NATS queue, after opening or closing transactions, messages will appear from the plugin:

Automatic addition to NATS_SERVICE_SUBJECT of information about the symbol group according to the described mapping
Plugin configuration has a field INSTRUMENTS_MAP, which should have a full path to a file with mapping information between securities group of trading instruments and postfix in NATS subject that should be added and the end.
Format the mapping file is the following:
where:
default - is the default postfix name that will be added if the security group of the trading symbol is not found in the mapping file
securities - is a list of key-value records. Where the key is a name postfix in NATS subject and the value is a comma-separated string with names of securities group that should be mapped to the postfix name.
if the
defaultis an empty string or not defined in the mapping file the postfix will not be added to NATS subjectif the plugin is not able to open the specified mapping file or it is empty, the postfix will not be added to NATS subject.


Last updated