A division by zero error appeared in one indicator - page 11

 
Alexey Kozitsyn:

Duck this. If you want the time accurate to the hour, you can do a simple thing: trim the minutes.

The algorithm is as follows:

1. You put the time in the structure;

2. Zero in on the minutes;

3. Convert the structure back to the time;

You get the time from 23:38 to 23:00. Well, if the error is repeated.

I need time accurate to the minute, I gave an example above that on the hour TF the bar opened at 14:00, but in fact the first bar on the minute TF appeared at 14:05.

I know about your suggested method, thanks for your willingness to help!

I have not seen the error so far today. It must have been a bug in MT5.

 
Aleksey Vyazmikin:

I need time accurate to the minute, I gave an example above that on the hour TF the bar opening was at 14:00, but in fact the first bar on the minute TF appeared at 14:05.

I know about your suggested method, thanks for your willingness to help!

I have not seen the error so far today. It must have been a bug that crept into the MT5.

No problem. After you get the time - request the minute time at 14:00. Keep watching what it returns. If it returns the same time, all is normal. If there is no such time on minutes... then there are two options (you have to check): either the bar returns at 13:59, or at 14:05.

What the developers have done is good.

 
Alexey Kozitsyn:

No problem. After you get the time - request the minute time at 2pm. Then see what is returned. If it returns the same time, all is normal. If there's no such time in minutes... then there are two options (you have to check): either the bar returns at 13:59, or at 14:05.

What the developers have corrected is good.

Yes, that's right, that's exactly the kind of check implemented in the code.

I would do it generally through iBarShift, but at that time there was no common standard and different functions returned different values, while now it may even work faster.