Robot catalog

How to modify a global variable?

Monday, 3 July 2017 08:58

Global variables are needed if you run several advisors in MetaTrader 4 platform at the same time, and you need to build a particular exchange of information between them.

The global variable of the MetaTrader 4 is a variable whose value is available from all applications running on the client terminal. Its value will be stored on the hard disk of the computer even after the client terminal is closed. The declared global variable exists in the client terminal within four weeks from the last access. If none of the programs access the global variable during the specified period, it will be deleted by the client terminal.

You can configure the global variable in the global variables control window. It is a relatively simple process: go to the "Tools" menu and select the "Global Variables" option or press F3. A table appears where all global variables will be listed. The table contains information about the name of the variable, its value, the date, and time of the last change.

To add a new variable, double-click on the desired cell in the upper right part of the window. You can delete a variable in the same way.