Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1746

 
MakarFX #:

First, check it out.

and second, maybe the broker doesn't have that kind of volume of quotes

Nah nah, I'm copying a bit, tried periods from a day to a year. Specified parameters are at maximum (10000000).

...

When requesting data from an indicator, if the requested timeseries hasn't been built yet or should be downloaded from the server, the function will return -1 immediately, but the downloading/build process itself will be initiated.

When requesting data from the Expert Advisor or a script, theloading from the server will be initiated, if the terminal does not have these data locally, or the building of the required timeseries will begin, if the data can be built from the local history, but they are not ready yet. The function will return the amount of data that will be ready by the timeout time, but the loading of history will continue, and the next similar request will return more data.

...


That's odd. It says that the download itself will go if you copy from an unloaded history, but... Nothing happens. Error 4073 (and after reboot if repeated)
Документация по MQL5: Доступ к таймсериям и индикаторам / Организация доступа к данным
Документация по MQL5: Доступ к таймсериям и индикаторам / Организация доступа к данным
  • www.mql5.com
Организация доступа к данным - Доступ к таймсериям и индикаторам - Справочник MQL5 - Справочник по языку алгоритмического/автоматического трейдинга для MetaTrader 5
 
Ivan Butko #:

Nah, nah, I'm copying a bit, I've tried periods of a day to a year. The specified parameters are at the maximum (10000000).


Strange. They say it will load itself if I copy from unloaded history, but... nothing happens. Error 4073
Not the same in MT5 as in MT4
 
MakarFX #:
Not the same in MT5 as in MT4


Text

...

When requesting data from the indicator, if the requested timeseries haven't been built or need to be downloaded from the server, the function will return -1 immediately, but the loading/building process itself will be initiated.

When requesting data from the Expert Advisor or a script, the loading from the server will be initiated, if the terminal does not have these data locally, or the building of the required timeseries will begin, if the data can be built from the local history, but they are not ready yet. The function will return the amount of data that will be ready by the timeout time, but the loading of history will continue, and the next similar request will return more data.

...

Taken from MT4 handbook
https://docs.mql4.com/ru/series/copytime

As I understand it, even after one request, the history should be loaded
.
void OnStart()
  {
   datetime rates[1];
   int copied=CopyTime(Symbol(),PERIOD_CURRENT,16216,1,rates);
   if(copied<=0)
      Print("Ошибка копирования ценовых данных ",GetLastError());
   else Print("Скопировано ",ArraySize(rates)," баров");
  }
But, it doesn't load. Not even one bar))
CopyTime - Доступ к таймсериям и индикаторам - Справочник MQL4
CopyTime - Доступ к таймсериям и индикаторам - Справочник MQL4
  • docs.mql4.com
CopyTime - Доступ к таймсериям и индикаторам - Справочник MQL4
 
Ivan Butko #:


Text

Taken from MT4 handbook
https://docs.mql4.com/ru/series/copytime

As I understand it, even after one request, the history should be downloaded
void OnStart()
  {
   datetime rates[1];
   int copied=CopyTime(Symbol(),PERIOD_CURRENT,16216,1,rates);
   if(copied<=0)
      Print("Ошибка копирования ценовых данных ",GetLastError());
   else Print("Скопировано ",ArraySize(rates)," баров");
  }
But, it's not loading. Not even one bar))

As far as I have encountered it, MT4 loads from the archive and MT5 from the broker's server

 
MakarFX #:

As far as I have encountered it, MT4 loads from the archive, while MT5 loads from the broker's server

Please clarify what do you mean by "their archive"?

 
Ivan Butko #:

Please clarify what "their archive" means?

 
MakarFX #:

Ahhhh, I see. I see.

Eh, that documentation entry is now a real pain in the ass

will initiatea server download if the terminal does not have this data locally


 

Greetings. Could you please tell me if and how this can be done?

Is it possible to write your functions so that you can pass different number of parameters to written functions?

How, for example, in this function, you can pass 4 or 5 parameters.


 
Andrey Sokolov #:

Greetings. Could you please tell me if and how this can be done?

Is it possible to write your own functions so that you can pass different number of parameters to written functions?

How, for example, in this function, you can pass 4 or 5 parameters.


2.5 ways: 1) make parameters with default values 2) write functions with the same names but different arguments. 3) write "template functions" (using both 1 and 2)

For the user of the function, it will be similar to the fact that the function has "4 or 5" parameters and/or the parameter takes different types

 
Maxim Kuznetsov #:

2.5 ways: 1) make parameters with default values 2) write functions with the same names but different arguments. 3) write "template functions" (using both 1 and 2)

For the user of the function, it will be like the function has "4 or 5" parameters and/or the parameter takes different types

Thank you.

It turns out different functions with the same name. And youcan't make it possible to pass a different number of parameters?