Global Variables

 

Hello, I have an EA and a Indicator, running at the same time, Why do not take the Global variable the 2 value in the Expert. Both programs are under #property strict with the Expert within a loop OnTick, and the Indicator into OnCalculate.

Expert

double GV_Ind;
Print(" Global Variable GV_Ind= ",GlobalVariableGet(GV_Ind));


Indicator

double GV_Ind=1;
GlobalVariableSet(GV_Ind,2);

Thak you very much.

 
  1. When you post code please use the CODE button (Alt-S)! (For large amounts of code, attach it.) Please edit your post.
              General rules and best pratices of the Forum. - General - MQL5 programming forum
              Messages Editor

  2. Don't post code that doesn't compile. Perhaps you should read the manual.
    Your code
    Documentation
    double GV_Ind;
    GlobalVariableGet(
       GV_Ind
    )
    .
    .
    .
    .

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

 
Thank you sir!
 
But it continues without change the value in the Expert.
 

Yes, there are two GV_Ind, one the GV_Ind variable (0 value) of program and the GlobalVariableGet(GV_Ind) (2 value).

Ok, doesn't matter at all.

 
Piti12: Ok, doesn't matter at all.

You missed the point completely. You get or set a global variable and they have a name. The double GV_Ind is not a name.

Reason: