MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal

Automated Trading Language Documentation

ImpAOImpAO Try product
ImpAO
Author: paladin800
SeNSetiVe Indicator
SeNSetiVe
Author: GODZILLA
Screenshot
شبندر, H4
Demo
Subscribe to signal
Stability
16.15%, 326.92 USD
Limitations and Verifications in Expert Advisors Limitations and Verifications in Expert Advisors

Global Variables

Global variables are created by placing their declarations outside function descriptions. Global variables are defined at the same level as functions, i.e., they are not local in any block.

Example:

int GlobalFlag=10;   // Global variable
int OnStart()
  {
   ...
  }

The scope of global variables is the entire program. Global variables are accessible from all functions defined in the program. They are initialized to zero unless another initial value is explicitly defined. A global variable can be initialized only by a constant or constant expression that corresponds to its type.

Global Variables are initialized only once right after the program is loaded into the client terminal memory.

Note: Variables declared at global level must not be mixed up with the client terminal global variables that can be accessed using the GlobalVariable...() functions.

See also

Data Types, Encapsulation and Extensibility of Types,Initialization of Variables, Visibility Scope and Lifetime of Variables, Creating and Deleting Objects


Updated: 2010.06.15