Download MetaTrader 5

Call GlobalVariableSet from OnDeinit inside

To add comments, please log in or register
Pablo Rego
1771
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.

Alain Verleyen
Moderator
33479
Alain Verleyen  
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.
Pablo Rego
1771
Pablo Rego  
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.
whroeder1
16076
whroeder1  
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
To add comments, please log in or register