Call GlobalVariableSet from OnDeinit inside

 

I am trying to save the last backtime time in a global variable from MT5, but for some reason the global variable is not created. Still when I create the variable before backtest (outside from EA), the value is not updated. What should I have missed?

I used

 

void OnDeinit(const int reason){
   GlobalVariableSet("Last backtesting time ",TimeToString(TimeLocal()));
}


 Just a note, the same call from MT4 works perfectly.

 
Pablo Rego:

I am trying to save the last backtime time in a global variable from MT5, but for some reason the global variable is not created. Still when I create the variable before backtest (outside from EA), the value is not updated. What should I have missed?

I used

 

void OnDeinit(const int reason){
   GlobalVariableSet("Last backtesting time ",TimeToString(TimeLocal()));
}


 Just a note, the same call from MT4 works perfectly.

Global variables in MT5 backtest are "emulated", that's not the same as Global variables used on a live chart.
 
Alain Verleyen:
Global variables in MT5 backtest are "emulated", that's not the same as Global variables used on a live chart.
Hmm. Ok so. Thanks.
 
Alain Verleyen:
Global variables in MT5 backtest are "emulated", that's not the same as Global variables used on a live chart.
void OnDeinit(const int reason){
   GlobalVariableSet("Last backtesting time ",TimeToString(TimeLocal()));
}
Also you should read the documentation. What is the datatype for the second argument of Global Variables of the Terminal / GlobalVariableSet - Reference on algorithmic/automated trading language for MetaTrader 5 and what are you passing?
Documentation on MQL5: Global Variables of the Terminal / GlobalVariableSet
Documentation on MQL5: Global Variables of the Terminal / GlobalVariableSet
  • www.mql5.com
Global Variables of the Terminal / GlobalVariableSet - Reference on algorithmic/automated trading language for MetaTrader 5
Reason: