MetaTrader 4 Help
MetaTrader 4 HelpToolsGlobal Variables

Global Variables

Several experts can be launched in the client terminal at the same time. Sometimes, there is a need them to interchange with information. To provide possibility of prompt transfer of moderate amounts of information among experts, as well as organize conflict-free simultaneous working of several experts, there are global variables in the terminal. Unlike variables claimed at a global level in the expert source code and available only within the corresponding module, global variables exsist independently on experts. Their values are saved between terminal launches, unlike those of variables claimed at a global level (they are set at every expert launch and lost at expert remove). Global variables are available within four weeks since their last call from experts or manual modifying.

There is a special window in terminal that manages global variables. It can be opened by execution of the "Tools – Global Variables" menu command or by pressing of F3. All global variables, their values and times of their last calls are listed in a table in this window. Using buttons located in the right part of the window, one can add a new global variable or delete an existing one. To change the name or value of a global variable, one has to double-click with the left mouse button on the corresponding cell of the table. The last call time will be changed automatically for this variable.