confusion about the behaviour of the variables - page 7

 

remade the Expert Advisor for the weekend test without start()

1. go to chart

2. change parameters

3. the log shows that the string (blue) receives erroneous values from an external variable, unlike int (green)

extern string ValueString = "DDD";
extern int    ValueInt    = 10;  
     
string tempString="val";
int    tempInt   =0;

bool   firsttime=true;
       
int init() {  
   if(firsttime) {     // значение присваевается тольо ОДИН раз   
      Print("иницилизация глобальных переменных");
      Print("tempString = ",tempString);
      Print("tempInt    = ",tempInt);
      
      Print("однократное присваение внешних значений глобальным переменным");
      tempString=ValueString; 
      tempInt   =ValueInt; 
      firsttime =false; 
      Print("ValueString: ",ValueString," < >","  tempString: ",  tempString);
      Print("ValueInt:     ",ValueInt,  " < >","  tempInt:      ",tempInt);
   } else {
      Print("меняем входные параметры");
      Print("ValueString: ",ValueString," < >","  tempString: ",  tempString);
      Print("ValueInt:     ",ValueInt,  " < >","  tempInt:      ",tempInt);
   }                          
}

int start() {}





Files:
testinit.mq4  1 kb
 
wlad:

remade the Expert Advisor for the weekend test without start()

1. go to chart

2. change parameters

3. the log shows that the string (blue) receives erroneous values from an external variable, unlike int (green)





And there is indeed a bug....Variables set on the external level are not initiated when the EA is restarted, but take some crap from previous restarts...Thanks to Wlad for his patience)))))
 

And there's a theme here too... a simple indicator in which there is

#property indicator_color1 Red
и

SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,3,Aqua);

The colour remains Red with its thickness... Until you forcibly delete the indicator and restart it, i.e. simple recompilation doesn't help. It turns out the parameters are pulled from some trunks.... Bullshit, of course, but wlad got to it))))

 
Apparently it's related, I've noticed for a long time, sometimes you change the EA code, compile it, but the previous code works, until you reload the terminal. Even restarting the Expert Advisor does not help. But this is not always the case, so I take it easy. Well, it is there... Doesn't seem to bother me too much.
 

Yeah,

it would be nice if the developers could fix it

or is it pointless to write here and go straight to the help desk?

Where can I go by the way?

 
Sepulca:
Э... congratulate me, I'm kind of a grandfather, not really, but the kids admit it......)))

Congratulations! How old is Grandpa?
 

Please advise

How do I contact the caliper?

can't find it anywhere

 
wlad:

Please advise

How do I contact the caliper?

can't find it anywhere

You can't do it directly from the fourth forum. You can from the fifth forum. See the "Service Desk" link in your mql5.com profile (on the left, in the column with the list of profile services).
 
MetaDriver:
You can't do it directly from the fourth forum. You can from the fifth forum. See the "Service Desk" link in your mql5.com profile (on the left, in the column with the list of profile services).
Thank you, I will check it out.
 
wlad:

remade the Expert Advisor for the weekend test without start()

1. go to chart

2. change parameters

3. the log shows that the string (blue) receives erroneous values from an external variable, unlike int (green)



It is not reproducible inthe new compiler. No one will ever change the old one.

extern string ValueString = "DDD";
extern int    ValueInt    = 10;  
     
string tempString="val";
int    tempInt   =0;

bool   firsttime=true;
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   if(firsttime) 
     {     // значение присваевается тольо ОДИН раз   
      Print("иницилизация глобальных переменных");
      Print("tempString = ",tempString);
      Print("tempInt    = ",tempInt);

      Print("однократное присваение внешних значений глобальным переменным");
      tempString=ValueString;
      tempInt   =ValueInt;
      firsttime =false;
      Print("ValueString: ",ValueString," < >","  tempString: ",tempString);
      Print("ValueInt:     ",ValueInt," < >","  tempInt:      ",tempInt);
        } else {
      Print("меняем входные параметры");
      Print("ValueString: ",ValueString," < >","  tempString: ",tempString);
      Print("ValueInt:     ",ValueInt," < >","  tempInt:      ",tempInt);
     }
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---

  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---

  }
//+------------------------------------------------------------------+