Download MetaTrader 5

Call GlobalVariableSet from OnDeinit inside

To add comments, please log in or register
Track Market top sellers!
Pablo Rego
1653
Pablo Rego 2016.10.27 18:57 

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
30742
Alain Verleyen 2016.10.27 21:09  
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
1653
Pablo Rego 2016.10.27 21:54  
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
14517
whroeder1 2016.10.27 22:10  
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