MQL4参考 程序端全局变量 GlobalVariableGet

GlobalVariableGet

Returns the value of an existing global variable of the client terminal. There are 2 variants of the function.

1. Immediately returns the value of the global variable.

double  GlobalVariableGet(
   string  name      // Global variable name
   );

 
2. Returns true or false depending on the success of the function run.  If successful, the global variable of the client terminal is placed in a variable passed by reference in the second parameter.

bool  GlobalVariableGet(
   string  name,              // Global variable name
   double& double_var         // This variable will contain the value of the global variable
   );

Parameters

name

[in]  Global variable name.

double_var

[out]  Target variable of the double type, which accepts the value stored in a the global variable of the client terminal.

Return Value

The value of the existing global variable or 0 in case of an error. For more details about the error, call GetLastError().

Note

Global variables exist in the client terminal during 4 weeks since their last use, then they are automatically deleted.