How to back test Global Variables?

 
in my indicator:
GlobalVariableSet(Symbol()+"GlobalVariableFromIndicator",Array[i]);

in my expert:
mydata=GlobalVariableGet(Symbol()+"GlobalVariableFromIndicator");

If I use the above method to get data from my indicator, will I be able to back test it? I seem to only get the current value of the Global Variable rather than the ones from the array for historical data.

Thanks,
Dan
 
Use IsTesting function and set your global variable name according with its return. For example
string glob_var_name=Symbol()+"GlobalVariableFromIndicator"+IsTesting();
Reason: