MT5 Plugin

How to work with MT5 plugin

  1. Upload the plugin to the server in the Plugins folder for the main trading server:

  1. Add plugin in the MT5Server Administration

  1. In the settings specify the deploy parameters:

Parameter
Type
Description

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

address of NATS (URL)

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 ="MT5Plugin", writing to the queue: MT5Plugin.MT5-DEAL.MT5_Test )

SERVER_CODE

string

server codename that is used to queue messages in NATS (for example: MT5_Test: MT5Plugin.MT5-DEAL.MT5_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)

  1. Run the plugin, the following entries will be visible in the MT5 server logs:

Possible errors:

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

If error sending a message to NATS, , you will see the following error in logs:

  1. 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 both from RW-Manager and from the plugin:

The build number can be found in the properties of the dll file:

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 default is an empty string or not defined in the mapping file the postfix will not be added to NATS subject

  • if 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