Errors, bugs, questions - page 3029

 
Igor Makanu:

this should not work correctly in indicators:

if I'm not mistaken, in the help there is a breakdown of the script for paging data for all TFs and there should be a warning that historical data cannot be requested from the indicator in this way, because the indicator works asynchronously

and it is recommended to use BarsCalculated() once after you bind the handle


UPD: script for history paging and explanation why it doesn't work in indicators:https://www.mql5.com/ru/docs/series/timeseries_access

In this article it is written only that it is undesirable to request data from timeseries (or request SeriesInfoInteger in a loop) in an indica


"Recall that sending a request to update a timeseries with the same period asthe 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 performed in the same thread, in which the indicator works. Therefore, there is a high probability of a wedge."


If we simply request SeriesInfoInteger and, in case of false, exit OnCalculate, how can the wedge occur?

 

Question for everyone:

the help at https://www.mql5.com/ru/docs/series/timeseries_access says:

"When calling functions, which copy any data from timeseries, you should keep in mind that the start parameter (number of bar, from which to start copying price data) must always be within the available terminal history. If we have only 100 bars, there is no sense trying to copy 300 bars, starting from the bar with index 500. This request will be considered as invalid and will not be processed, i.e. no history will be loaded from the trade server.

That CopyTime will give out -1, it's clear, but - will it initiate the process itself to build a time series / paging from the server bars up to 800th (500 + 300) or not?

Please advise.

Документация по MQL5: Доступ к таймсериям и индикаторам / Организация доступа к данным
Документация по MQL5: Доступ к таймсериям и индикаторам / Организация доступа к данным
  • www.mql5.com
Организация доступа к данным - Доступ к таймсериям и индикаторам - Справочник MQL5 - Справочник по языку алгоритмического/автоматического трейдинга для MetaTrader 5
 
mktr8591:


1. This article only says that it is undesirable to request data from timeseries (or to request SeriesInfoInteger in a loop) in indica


"Recall that sending a request to update a timeseries with the same period asthe indicator causing the update is highly undesirable. The undesirability of the request using the same symbol-period as the indicator has is due to the fact that the historical data update is performed in the same thread, in which the indicator works. Therefore, there is a high probability of a wedge."


2. If you simply request the SeriesInfoInteger and leave the OnCalculate in case of false, how will the wedge occur?

1. Yes, because you can't slow down the indicator's thread, because requesting the synchronization status will cause the history to be swapped out, and you can't wait.

2. Right. If the data is not ready, it will simply exit the oncalc and the synchronization terminal will start, but the indicator's flow will not be inhibited. The next oncalc will be executed completely and without brakes only when the data is ready and the requested indicator is completely counted. The print added above shows that the requested indicator is not always ready, but we can allow to make a new bar only once, not on every tick for the fastest calculation of all indicators.

 
Andrey Dik:

Thank you.

Also, see my question:https://www.mql5.com/ru/forum/1111/page3028#comment_22557528

Ошибки, баги, вопросы
Ошибки, баги, вопросы
  • 2021.05.28
  • www.mql5.com
Общее обсуждение: Ошибки, баги, вопросы
 

Andrey Dik:

see the code above,

fix your code, add a printout

  if(SeriesInfoInteger(Symbol(), OldTF, SERIES_SYNCHRONIZED))
   {
    if(iBars(Symbol(), OldTF) != BarsCalculated(Handle))
     {
      Print("Баров ", iBars(Symbol(), OldTF));
      Print("посчитано", BarsCalculated(Handle));
      return 0;
     }
   }
  else
   {
    Print("Период ", OldTF, " не синхронизирован.");
    return 0;
   }

and when you see your cockroaches, roll up your monitor and shove it... you know where.

 
mktr8591:

Thank you.

also, see my question:https://www.mql5.com/ru/forum/1111/page3028#comment_22557528

I'm not 100% sure about this (need to check), once you make sure the date requested is fresher than the very first in the history on the server, you can request the data, the history will be swapped.

 
Andrey Dik:

I'm not 100% sure about this (need to check), by making sure the date requested is fresher than the very first in the history on the server, the data can be requested, the history will be swapped.

Thanks,

I was asking about my other post, link again : https://www.mql5.com/ru/forum/1111/page3028#comment_22557528

Ошибки, баги, вопросы
Ошибки, баги, вопросы
  • 2021.05.28
  • www.mql5.com
Общее обсуждение: Ошибки, баги, вопросы
 
Alexey Viktorov:

Fix your code, add a printout

and when you see your cockroaches, roll up your monitor and shove it... you know where.

You're proving my point, comrade.

 
mktr8591:

Thank you,

I was asking about my other post, link again : https://www.mql5.com/ru/forum/1111/page3028#comment_22557528

I don't quite understand your code. What should happen after "return 0;" on the next call to OnCalculate?

We return 0, thereby stating that we have not yet calculated anything and the prev kalk will not be incremented by 1 on the next bar.

i.e. we will be on the bar where we started requesting data from the olderf until we return(rates_total)

 
Andrey Dik:

you're proving my point, comrade.

1. Thank you all - I've become a little more knowledgeable in indicators ))))

2) Andrew, if someone doesn't understand your ideas (including me), it means only one thing - you don't draw the picture correctly! More precisely - you draw it in such a way, that many people don't understand it ...

Reason: