New article Integrating MQL-based Expert Advisors and databases (SQL Server, .NET and C#) has been published:
The article describes how to add the ability to work with Microsoft SQL Server database server to MQL5-based Expert Advisors. Import of functions from a DLL is used. The DLL is created using the Microsoft .NET platform and the C# language. The methods used in the article are also suitable for experts written in MQL4, with minor adjustments.
Questions related to integrating the work with databased into Expert
Advisors written in MQL5 often appear on the forums. Interest in this
topic is not surprising. Databases are very good as a means of saving
data. Unlike the terminal logs, the data do not disappear from the
databases. They are easy to sort and filter, choosing only the required
ones. A database can be used to pass the necessary information to an
expert — for example, certain commands. And most importantly — the
obtained data can be analyzed from different perspectives and processed
statistically. For example, writing a one-line query is enough to find
out the average and total profit for a specified time for each currency
pair. And now imagine how long it takes to manually calculate this for
the account history in the trading terminal.
Unfortunately, MetaTrader does not provide built-in tools for
interacting with database servers. The problem can only be solved by
importing functions from DLL files. The task is not simple, but
Start the expert, changing the connection string values to your
database server access parameters. If everything is done correctly, the
expert will output the following to the log:
Connecting to the database, executing SQL commands, writing and reading data — everything is executed successfully.
Author: Сергей Ткаченко