[SERVICE DESK] Error in getting the time of the senior TF in the timer! - page 8
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
3. interesting point of analysis, what returns CopyClose(), I checked it myself, if there is no .hst file for the requested TF, CopyClose() never returns more than 2048 - i.e. this is the maximum value that can be downloaded?
No. 2048 is the portion of the data which is downloaded from the server when there is no file on the client.
No. 2048 is a chunk of data that is downloaded from the server when there is no data on the client.
Hm, I've been doing MQLs for a long time, but it's still unexpected for me
OK, here's an example from the help:https://www.mql5.com/ru/docs/series/timeseries_access
it says that:
The next important check is to check the type of program from which the function is called. Recall that sending a time series update request with the same period as the indicator calling the update is highly undesirable. The undesirability of requesting data of the same symbol-period, as the indicator has, because the historical data update is done in the same thread, in which the indicator works. Therefore, there is a high probability of a clash. To check it, we use theMQL5InfoInteger()function withMQL5_PROGRAM_TYPE modifier.
i.e. examplehttps://www.mql5.com/ru/code/449
it's not suitable for loading history data in MT4 indicator, and how can I download the whole history by the indicator, if there is no prepared .hst file, i.e. the indicator initializes history loading by its own symbol
how can I know that here I "downloaded" the entire history equal to iBars(Symbol(),PERIOD_CURRENT);
iBars() will also return an incorrect value? - there is no history yet, so there is no iBars()
it seems that in MT5 the history is downloaded without problems, you just need to wait and check the status of historical data, but in MT4?
PS: in kodobase yesterday I was looking for a correctly working multicurrency indicators for MT4, but the codes are not subject to imitation, in many examples of kodobase, in general there is no history paging in the indicator
In quadruplets, the 'home key was pressed'. There is no other way. If you've been studying the topic for a while, you should remember the phrase "brick on the keyboard"
https://www.mql5.com/ru/code/9968
https://www.mql5.com/ru/code/9153
https://www.mql5.com/ru/code/9888
You can check out my free downloader.
You can see my free downloader.
How do you suggest I look at your code? I know how to download history, but I don't know how to check the download indicator.
In quadruple "press the home key". There is no other way. If you've been studying the subject for a long time, you should remember the phrase "brick on the keyboard"
https://www.mql5.com/ru/code/9968
https://www.mql5.com/ru/code/9153
https://www.mql5.com/ru/code/9888
When I started to use MQL for the past few years I didn't learn MQL at all, since this year I`m really surprised that the developers made the compatibility between MT5 and MT4 as much as possible and improved the performance of MQL4 - even though we were told before that MT4 as a project will not be developed anymore, there are only bugs to be fixed
and here was a hope that I did not find information about automatic loading of history in the MT4 indicator
Basically, if you want to guaranteed download the whole history in MT4 and without additional checks, then it's easier to use dfix code - write the bar datetime t=0 in .hst file;
So how do you suggest I look at your code?
I thought you just needed the history to be auto-loaded...
To my great regret, I have to return to the topic of getting senior TF data in MT4 once again. This time due to the fact that the techniques suggested here did not work.
Here is the code we use:
It implements paging of data as I was advised:
Forum on trading, automated trading systems and trading strategies testing
[SERVICESDESK] Error getting the time of the older TF in the timer!
Slava, 2018.09.27 06:20
It has been discussed many times. 12 pages on "error 4066".
And you were correctly advised to send the request in OnInit and analyse it in OnCalculate.
What do you need a millisecond timer for? You are preventing the client terminal from starting up normally. It's not the wind messages that interfere with your timer, it's your timer that interferes with everyone. Once again: THE INDICATORS IN THE CLIENT'S MT4 TERMINAL WORK IN INTERFACE POTENTIAL.
The implementation is exactly like this: the first data request takes place in OnInit(). Then, we wait for connection with trade server to be established, then in OnCalculate()! we get data of high TF. We get the result at the first launch today:
As we can see from the log we got wrong values of time of hour and time of day.
Yes, the developers(@Slava) may notice that I haven't applied all advice I was given. That is, I still run fast timer in OnInit(), although I was originally advised to run slow timer. However, in this case, it's done on purpose. If the fast timer is started in the interface thread and can slow down data retrieval from other indicators - this is a big trouble. The documentation doesn't contain any warnings about it, you can put a program with a fast timer that can become a kind of a "virus" and cause "breakdowns" of other programs.
In view of the above, I believe that either we should introduce restrictions on the millisecond timer or specify in the documentation to EventSetMillisecondTimer() that the function cannot be started in OnInit() to allow the terminal to rise normally at startup.
Now for the fun part. The code is without any timers:
And you still can't get the result you want. The developers(@Slava), please comment. It is impossible to get correct data when loading the terminal from several higher TFs. Obligatory condition is that the terminal must be off more than one hour after shutdown (because we get data of the bar of an hour). And, of course, startup on TF less than one hour.
The timer turned out to be not involved.