Download MetaTrader 5

Discussion of article "MQL5 Programming Basics: Global Variables of the Terminal"

To add comments, please log in or register
MetaQuotes Software Corp.
Moderator
194386
MetaQuotes Software Corp.  

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.


1. Global Variables, Functions

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

Fig. 8. Pattern of the processing flag sequence

Author: Dennis Kirichenko

Dale Forsyth
84
Dale Forsyth  

@Dennis Kirichenko


Hi Dennis,

I have read this article in an attempt to gain a better understanding of global variables of the platform and their functionality. How is creating or changing a global variable going to impact upon the trading environment?

Are you able to explain what the numerical value of the global variables represent?

For quite sometime I have been researching and trying to understand the global variables of the terminal, though as yet I have not understood their usage and effect of them. If possible could you please give me a simple example of how creation of a global variable can have a positive result on the balance of my trading account?

Thank you.

Regards,

Dale.

To add comments, please log in or register