This tool is for extending standard MetaQuotes Report server features. It saves additional data from MT4 server to MySQL database to let other services consume all required data from one place, from MySQL to minimize load to MT4 server by requesting data for some kind of calculations that could be made using relational database environment.
This tool contains two pieces: windows service and MT4 plugin.
It saves:
- Symbols (
mt4_symbols
table) - Symbol groups (
mt4_symbol_groups
) - Groups (
mt4_group
) - Ticks (MT4 plugin required) (
mt4_ticks
) - Server journal (MT4 plugin required) (
mt4_logs
)
Install and run #
Application can be used in two ways: as windows service and normally, in console mode.
http://nuget.cplugin.com/feeds/apps/CPlugin.ExReplica.SyncService/versions
For testing purposes it is more convenient to run in console and check that everything works well. After that it is better to install application as windows service to let it run automatically when server starts, with no need to log on and run it manually every time.
Run in console #
To run in console (if you don’t want to install a service) you can run .exe file passing argument -con
to it.
To exit, use Q key on your keyboard.
Run as windows service #
First of all, you will need to install Microsoft .NET Framework 4.5.1 to your server.
Download package and unpack to any folder.
Also, you have to put mtmanapi.dll
and mtmanapi64.dll
to this folder. We cannot distribute these files. You might find them under your MT4 Administrator /API/ sufolder.
To install as a service you might use sc
windows utility. For example, run this command from console:
sc create "CPlugin.ExReplica.DbWriter" binPath=C:\CPlugin.ExReplica\CPlugin.ExReplica.DBWriter.exe start=auto
sc failure "CPlugin.ExReplica.DbWriter" actions=restart/60000/restart/60000/restart/60000 reset=INFINITE
Settings #
All settings are inside CPlugin.ExReplica.DBWriter.exe.config
XML file.
Most important section is configuration → connectionStrings → mysqlConnection
, here you will have to put your MySQL server address and credentials.
Other settings are inside configuration → userSettings → CPlugin.ExReplica.DBWriter.Properties.Settings
.
mt4_server
- your MT4 server addressmt4_login
- login of account that has access to symbols, groups, journal and prices using Manager api. It must be a manager.mt4_password
- its passwordproceed_mt4r
- flag to define, do you want to proceed files created by plugin, or not. true/false.mt4r_path
- path to these files
To save ticks and journal messages from MT4 to MySQL you will have to install special plugin to your MT4 server.
MT4 plugin #
Download file CPlugin.ExReplica.dll
and put under your MT4 /plugins/ directory. Restart mt4 server and check that plugin initialized successfully. You must notice something like
0 12:59:13.398 CPlugin.ExReplica LogPath = C:\MT4ReplicaFiles
0 12:59:13.398 CPlugin.ExReplica Write ticks = 1
0 12:59:13.398 CPlugin.ExReplica Write logs = 1
0 12:59:13.399 CPlugin.ExReplica initialized (ver. 1.00, May 24 2016 12:55:36)
It writes one file per minute. That files will be consumed by master tool automatically. No additional actions needed from operator. Only set proceed_mt4r flag to true and service will do rest job.
It has options:
LogPath
- path to folder where plugin will store data to be proceeded by database writer. Be sure you have enough space on it.Write ticks
- flag to make plugin write ticks, 0 - do not write, 1 - do write.Write logs
- flag to make plugin write journal messages, 0 - do not write, 1 - do write.
Demo version limitations #
MT4 plugin free demo version has limitations: it proceed first 100 journal messages and 5000 ticks. You can restart your MT4 to reset such counters, to try additional 100 and 5000 records respectively.
Windows service fully functional during 28 days after you first time run it.