when are Global variables updated??

 

i declared something like "B1=Bid", so am wondering when the variable, B1 is updated.

Is it every time i load the EA, or every time a new tick(price) comes in.

 

Every time you save a new value to it.

 
Byakatonda Denis: i declared something like "B1=Bid", so am wondering when the variable, B1 is updated. Is it every time i load the EA, or every time a new tick(price) comes in.

Your description is rather cryptic! Are you talking about "Global Terminal Variables" or globally scoped variables?

If you are talking about globally scoped variables, remember that they will be reset when you reload the EA but not necessarily when it goes through a "deinit/init" cycle, so always make sure to re-initialise them on the first incomming tick, in order to make sure you have a stable starting point.

If you want to "persist" the data between reloads and "deinit/init" cycles, then save the data to "Global Terminal Variables" and reload from them during the first tick. Alternatively, you can also save them to a a data file, but in both cases, remember to always "Flsuh" to disk so you don't lose data in case of any "crash".

PS! After looking over your post again, please remember that the variable "B1" will NOT be update with new "Bid" price automatically if that is what you were expecting - that is not how the variables work!

I am assuming you are using MT/MQL4 and in that case the "Bid" variable is a special variable that is updated internally on every new tick and when you use the RefreshRates() function, but your "B1" variable is a normal standard variable and will only be update when you do so by assigning a new value again (just as @Marco vd Heijden pointed out).

Reason: