[SERVICE DESK] Error in getting the time of the senior TF in the timer! - page 14

 
I've run it a few times now, though. Funny, but it doesn't always work. Sometimes the connection doesn't get established in time.
I've got a good connection of my own. Maybe that's the reason.
 
But that's not what I noticed with this test. Even when running now with pass counting, I get 10 passes through OnCalculate, even today. It turns out that the best option for you seems to be to make a small delay when the indicator starts.
 
Konstantin Nikitin:
But I noticed something different with this test. Even when running now with pass counting, I get 10 passes through OnCalculate. It turns out that the best option for you seems to be small delay at start of indicator.

There is no need for a crutch solution, I repeat. The current behaviour doesn't suit me, the advice given by the developers themselves doesn't work. Letting things like this go on their own will not do any good. A problem has been detected, it needs to be solved by the developers.

 
Alexey Kozitsyn:

There is no need for a crutch solution, I repeat. The current behaviour doesn't suit me, the advice given by the developers themselves doesn't work. Letting things like this go on their own will not do any good. A problem is discovered, it needs to be solved by the developers.

I have described what I saw. You have to think how to fix it. I mean, it's no good at all to get first pass tracking, etc...

 
Konstantin Nikitin:

I have described what I have seen. I have to think how to deal with it. That is, it is not good in any way get first pass tracking, etc..

I think there needs to be a mechanism tested in such "thin" places, working correctly with error numbers (by knocking on each request), or some kind of additional check in the history access functions (namely built-in, so as not to search for such problems for hours). And this mechanism should be described in detail in documentation. Then there won't be any questions to the developers. But how it is now? In the documentation nothing on access to data from older TFs, so the developers themselves do not know how to get the data. There are only some links to forum of the bearded years where they have the same reasoning.

 
If you know the difference with the server in hours. You can use a comparison of the current local clock to the opening time of the last hour bar. TimeCurrent is not suitable because the time may not be updated.
Something like this
     MqlDateTime mqlDateTime;
     TimeToStruct( (TimeLocal()-60*3), mqlDateTime );
     mqlDateTime.min = 0;
     mqlDateTime.sec = 0;
     
     if( IsConnected() )
          Comment( TimeToString( iTime(Symbol(), PERIOD_H1, 0) ), "\n", TimeToString( StructToTime(mqlDateTime) ) );
 
Alexey Kozitsyn:

You didn't answer your question about the terminal version, by the way.

terminal 1121 and 1090

Alexey Kozitsyn:

Communication with the server is established. When requesting senior TF data, if data is not ready - error or return 0. If data is ready - return ONLY actual data. That's all. If data is not ready for a long time - let it return error or 0.

There is no error here. There is a connection and history data.
The data that is already in the terminal is displayed immediately.
New data comes with a delay, because it is necessary to send a request to the broker and load it if something is missing.

As soon as new data appears, a tick is immediately generated (even now, when the market is closed).
You just need to check for update-appearance of a new bar and change your variables yourself.

ps. there is no flag for data relevance in mt4.

 
Taras Slobodyanik:

terminal 1121 and 1090

There is no error here. There is a connection and history data are present.
The data that are already in the terminal are displayed immediately.
New data arrives with a delay because a request has to be sent to the broker and uploaded if something is missing.

As soon as new data appears, a tick is immediately generated (even now, when the market is closed).
You just need to check for update-appearance of a new bar and change your variables yourself.

ps. there is no data update flag in mt4.

As I said, will have to try again on the updated terminal.

I categorically disagree with the behaviour that cannot be controlled. The function returns incorrect data without error - this is wrong. You will yourself later encounter such a situation and wonder what the problem is.

Say, at first the function returned an error. They are released. During the next query, the function did not return the error and returned some "incorrect" data. Is it all right?

 

What do you mean by incorrect data?

When they are not there, or there is no connection, or whatever, then yes, there is an error.
And there is nothing to count.

When all the data is correct - everything is normal and everything runs.

Your indicator does not track the data update.
New bars come from the broker and you don't check them.
I added a couple of lines to show that when you check it, everything is correct.

It is a working situation to check a new bar.

 
Taras Slobodyanik:

What do you mean by incorrect data?

And look at my very first post. Do you see error 4066 there? Then error 0 and return incorrect data. Why doesn't the function ( SeriesInfoInteger() in this case) check for relevance before sending the data? Why doesn't it set the error flag? You see, I'd rather wait a bit longer for internal checks to pass than look for errors later.

But after that I've been given a lot of advice, with which I still haven't got any result. And it turned out it wasn't even about the timer.

Reason: