What RefreshRates() updates

 
I wanted to know exactly what data and timeseries RefreshRates() updates and when it is true?
 
Such a secret function that the developers don't even know about it.)))
 

I just don't have the patience to answer such questions.

RefreshRates

Осуществляет обновление данных в предопределенных переменных и массивах-таймсериях.


And what are predefined variables and time series arrays can be found in the documentation.

Предопределенные переменные - Справочник MQL4
Предопределенные переменные - Справочник MQL4
  • docs.mql4.com
Предопределенные переменные - Справочник MQL4
 
Alexey Viktorov:

I just don't have the patience to answer such questions.


And you can read about predefined variables and time series arrays in the documentation.

I.e. the data of the iClose() function are not affected by RefreshRates() in any way. Then how can we make theiClose() function output updated information?

 
Mikhail Nazarenko:

So the data in iClose() is not affected by RefreshRates(). Then how can I make theiClose() function output updated information?

Which bar isiClose()?

 
Alexey Viktorov:

iClose() which bar?

Zero. Arbitrary timeframe.

 
Mikhail Nazarenko:

Zero. An arbitrary timeframe.

Honestly, I'm surprised... and that's putting it mildly. I thought iClose() gets values from broker's server, but no... RefreshRates(); updates values obtained by iClose()

/********************Script program start function*******************/
void OnStart()
 {
  for(int i = 0; i < 10; i++)
   {
    Print(Bid, " *** ", iClose(_Symbol, PERIOD_CURRENT, 0));
    Sleep(1000);
    RefreshRates();// Без RefreshRates(); значения iClose(_Symbol, PERIOD_CURRENT, 0) не меняются…
                   // То, что без RefreshRates(); не меняются значения Bid, это понятно и нормально…
   }
 }/******************************************************************/

Here is the result of the script execution

2021.02.15 11:39:35.559 00 EURUSD,M5: 1.21375 *** 1.21375
2021.02.15 11:39:34.559 00 EURUSD,M5: 1.21375 *** 1.21375
2021.02.15 11:39:33.559 00 EURUSD,M5: 1.21375 *** 1.21375
2021.02.15 11:39:32.559 00 EURUSD,M5: 1.21375 *** 1.21375
2021.02.15 11:39:31.559 00 EURUSD,M5: 1.2138 *** 1.2138
2021.02.15 11:39:30.559 00 EURUSD,M5: 1.21378 *** 1.21378
2021.02.15 11:39:29.559 00 EURUSD,M5: 1.21379 *** 1.21379
2021.02.15 11:39:28.559 00 EURUSD,M5: 1.21378 *** 1.21378
2021.02.15 11:39:27.559 00 EURUSD,M5: 1.21379 *** 1.21379
2021.02.15 11:39:26.559 00 EURUSD,M5: 1.21379 *** 1.21379

Well, ok... I'll just keep in mind this feature and insert RefreshRates() if necessary;


ps; And iClose(_Symbol, PERIOD_CURRENT, 0) changes in MT5.

 
Alexey Viktorov:

Frankly speaking, I'm surprised... and that's putting it mildly. I thought iClose() gets values from broker's server, but no... RefreshRates(); updates values received by iClose()

Here is the result of the script execution

Well, OK... Personally I will just keep in mind this feature and insert RefreshRates() when necessary;

If I change timeframe to another one than the current one, the data will stop being refreshed in time even with RefreshRates(). So, iClose and other fundamental functions in MT4 produce an irrelevant nonsense. I'm sure that 80% of the infos do not take into account these unique features of MT4. How to live?)))

 
Alexey Viktorov:

Frankly speaking, I'm surprised... and that's putting it mildly. I thought iClose() gets values from broker's server, but no... RefreshRates(); updates values received by iClose()

Here is the result of the script execution

Well, ok... I'll just keep in mind this feature and insert RefreshRates() if necessary;


ps; And iClose(_Symbol, PERIOD_CURRENT, 0) changes in MT5.

Always the iXXXXXX values in quadruple have turned out correctly. You don't check the result of the function. Four also requires it (as strange as it may seem to some adherents of absolute simplicity)
 
What's the solution? More crutches? Like, keep a tick history and recalculate all the timeframes in EAs on their own. This is beyond good and evil.))
 
Mikhail Nazarenko:
What's the solution? More crutches? Like, keep a tick history and recalculate all the timeframes in EAs on their own. This is beyond good and evil))).
No, it's not. What does it say in the function help about the return value?
Reason: