New article MQL5 Programming Basics: Global Variables of the Terminal has been published:
This article highlights object-oriented capabilities of the MQL5 language for creating objects facilitating work with global variables of the terminal. As a practical example I consider a case when global variables are used as control points for implementation of program stages.
In the MQL4/5 environment there is an interesting instrument - global variables of the client terminal. It allows to create a shared data storage ares for all programs of the terminal. Moreover, the lifetime of this area does not stop with the terminal closure. This article suggests using the Object Oriented Programming tools to get a clear idea what global variables of the terminal are.
Further in the article, global variables of the client terminal will be called "global variables" unless otherwise specified.
From a programmer's point of view, a global variable is a named memory area available for all working programs of a trading terminal. Novice programmers should note that if there are several terminals working simultaneously, each of them will have its own independent memory space for global variables. They are not going to overlap.
The language developers specify in the Documentation that there are 11 functions used for working with global variables.
Theory can be found in the "GlobalVariables" section of the MQL4 textbook.
A pattern of tracking stages of module work with global variables is presented on Fig. 8.
Fig. 8. Pattern of the processing flag sequence
Author: Dennis Kirichenko