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

 
Alexey Kozitsyn:

What closing time? I need an opening time...

You have the last bar open time check going everywhere, that's what you get. Immediately after opening the terminal, the bar has not yet been formed in OnInit.

 
Konstantin Nikitin:

You have the last bar open time check everywhere, that's what you get. Immediately after opening the terminal, the bar has not yet formed in OnInit.

...No comment, I'm done talking to you.

 
Alexey Kozitsyn:

Question! Why does it output the previous data after the connection to the server has already been established, there was a data pre-query in OnInit(), a check for data loading in each of the CheckCurren...() functions. How many bloody checks we have to do to make it work properly...

There are a lot of symbols and periods, if the terminal has been offline for a long time, it needs to load a lot of data.
In order not to wait for this loading which depends on the speed of the internet and the broker's server, the terminal gives you the previous data at once.
The ones that are already available.

So it's not a "crutch solution", it's a necessary check for loading the last candle.

ps. how do you further check the appearance of a new bar?

 
Taras Slobodyanik:

There are many symbols and periods, if the terminal has been offline for a long time, a lot of data needs to be downloaded.
To avoid waiting for this download, which depends on the speed of the internet and the broker's server, the terminal gives the previous data at once.
The ones that are already available.

Therefore it is not a "crutch solution", but a necessary check for loading the last candle.

Do you feel the logic problem? If the history is not loaded yet, and let me output "something" and wait until the data is updated. And it doesn't matter if the data is correct or not...

Plus, even if the terminal is offline for 5-10 minutes - same nonsense. Even if there are only 3 characters in the data window - the same nonsense. All the checks have been followed - same nonsense.

You understand that developer's advice about correct loading does NOT WORK. Doesn't it mean anything to you?

 
Update 1126 has now arrived on MQDemo... Will check more on this version on Monday.
 
Alexey Kozitsyn:

Do you sense a logic problem? If the history hasn't been uploaded yet, and let me give out "something" and wait until the data is updated. And it doesn't matter if the data is correct or not...

This logic is only at the first run-open symbol.
The terminal does not know if there are more candlesticks, it gives out what it has.

Then the last candle appears.

 
Taras Slobodyanik:

This logic only works the first time you run-open a symbol.
The terminal doesn't know if there will be any more candles, it gives you what it has.

Then the last candle appears.

I have updated my post.

Tell me, do you want to spend hours of work every time to figure out such nuances, or do you want to read the documentation once and understand everything? Do you want to suffer with "preloads" or just get an error when the data has not yet been updated?

 
Taras Slobodyanik:

By the way, what version of the terminal do you have?

 
Taras Slobodyanik:

ps. how do you further verify the appearance of a new bar?

//+------------------------------------------------------------------+
//| Проверяем образование нового часа                                |
//+------------------------------------------------------------------+
bool CheckNewHour()     
        {
         //--- Сбрасываем код последней ошибки
         ResetLastError();
         //--- Получаем время открытия текущего часа
         const datetime hOpenTime = iTime( _Symbol, PERIOD_H1, 0 );
         //--- Проверяем корректность полученного времени
         if( hOpenTime == 0 || GetLastError() != 0 )            // Если возникла ошибка или время не получено
                 return( false );                                                                               // Возвращаем ложь
         //--- Сравниваем полученное время с сохраненным
         if( hOpenTime == _hourOpenTime )                                       // Если время совпадает
                 return( false );                                                                               // Возвращаем ложь
         //--- Запоминаем время нового часа
         _hourOpenTime = hOpenTime;
         //--- Возвращаем истину
         return( true );
        }
 

I don't see a problem, there is a new candle - recalculate the last candle of the indicator/advisor.
There is more than one new candle - do a complete recalculation of the indicator/advisor.
This is the same - a new candle appears.

One more thing - the required periods should be constantly "pulled" to update them.
If there is nobody working on the symbol-period (quotes are not checked, the indicator is not running), then it "sleeps" because it is considered unneeded.