MQL4参考 程序端全局变量 GlobalVariableSet

GlobalVariableSet

Sets a new value for a global variable. If the variable does not exist, the system creates a new global variable.

datetime  GlobalVariableSet(
   string  name,      // Global variable name
   double  value      // Value to set
   );

Parameters

name

[in]  Global variable name.

value

[in]  The new numerical value.

Return Value

If successful, the function returns the last modification time, otherwise 0. For more details about the error, call GetLastError().

Note

A global variable name should not exceed 63 characters. Characters not belonging to the current code page are not allowed (characters that cannot be converted from Unicode to ANSI are replaced with '?'). If programs are to be distributed among users with different code pages, we strongly recommend using Latin characters in global variable names.

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