Discussing the article: "Structures in MQL5 and methods for printing their data"

 

Check out the new article: Structures in MQL5 and methods for printing their data.

In this article we will look at the MqlDateTime, MqlTick, MqlRates and MqlBookInfo strutures, as well as methods for printing data from them. In order to print all the fields of a structure, there is a standard ArrayPrint() function, which displays the data contained in the array with the type of the handled structure in a convenient tabular format.

The MqlParam and MqlTradeRequest structures transmit technical information for creating indicators and sending trading requests to the server. We fill in the required fields of the structures in accordance with the required result of sending data in the completed structure. In other words, these structures do not particularly need to print the data the fields of these structures were filled with by a programmer.
But the remaining structures return query results, and each field is filled in either by the terminal subsystem or by the trade server. Obtaining data from these structures, analyzing programmatically filled fields of structures, or printing them to a log for subsequent manual analysis is very convenient and necessary both for making decisions programmatically and for understanding and finding the location of a logical error.


In order to print all the fields of a structure, there is a standard ArrayPrint() function, which displays the data contained in the array with the type of the handled structure in a convenient tabular format. But sometimes we need to print data from the structure in another format, which may be more convenient than a tabular representation. For example, we may need to display all the fields of the structure in one line - with headers and corresponding data. This may be more convenient for analyzing large amounts of data. At the same time, sometimes we need to see a more detailed view - with a description of the structure fields and a different representation of the corresponding data.

Author: Artyom Trishkin