Time update in code - page 2

 

Well I tested this in OnTick() after the markets opened


  Print(TimeCurrent());
  Sleep(10000);
  Print(TimeCurrent());
  RefreshRates();
  Print(TimeCurrent());
and TimeCurrent() was updated before the RefreshRates() so it appears that the documentation is incorrect
 

The book is wrong. The documentation is correct RefreshRates - Timeseries and Indicators Access - MQL4 Reference

Refreshing of data in pre-defined variables and series arrays.
Predefined Variables - MQL4 Reference are _Digits, _LastError, _Period, _Point, _RandomSeed, _StopFlag, _Symbol, _UninitReason, Ask, Bars, Bid, Close[], Digits, High[], Low[], Open[], Point, Time[], Volume[]

TimeCurrent() is a function not a variable.

 
Keith Watford:

Well I tested this in OnTick() after the markets opened


  Print(TimeCurrent());
  Sleep(10000);
  Print(TimeCurrent());
  RefreshRates();
  Print(TimeCurrent());
and TimeCurrent() was updated before the RefreshRates() so it appears that the documentation is incorrect

Thank you. 

At final we have that every calling of TimeCurrent() or TimeLocal() will show fresh data. 

 

So as I see code must starts like

datetime time_curr;

void OnTick()

{

time_curr=TimeCurrent();

...
 
whroeder1:

The book is wrong. The documentation is correct


I could have written my post to be more clear.

When I said that the documentation is incorrect, I was referring to

In the OnTick() handler, this function returns the time of the received handled tick.


as my test showed that TimeCurrent() IS updated when it is called within the same handled tick

and I should also have said that my test shows that RefreshRates() has no effect on TimeCurrent()

Reason: