Errors, bugs, questions - page 2934

 
Vitaly Muzichenko:

So make an exit if the data is not copied

On the next tick everything will be loaded and the code will work correctly

No, in my case, the code will work horribly incorrectly, the objects in the indicator will slip from their positions to hell. I'll deal with history loading...

 
Евгений Баженов:

Hello, I'm testing my robot, after finishing testing I saw a lot of fields with requotes in the Log, what do these message stacks mean and what can I add to the code to prevent them from appearing? Thank you, Happy New Year!

I assume that the trading session in the symbol is smaller than the quoting session. Then the quotes go in the Tester, but trading on them is prohibited during such periods.

 
x572intraday:

The idiocy is thathttps://www.mql5.com/ru/docs/series/timeseries_access mentions Sleep() in the article about loading history in the code, but the help for Sleep() says: "Sleep() function cannot be called from custom indicators, because indicators are executed in the interface thread and must not slow it down". It turns out that I need to load history in an indicator.

Whose idiocy?

When requesting data from the indicator (not from the Expert Advisor), the same data is received right away without any delay. Vitaly has said it correctly.

Request the required symbol-period in OnInit to initiate the creation of the required history

 
Slava:

Whose idiocy?

When requesting data from an indicator (and not from an Expert Advisor), this data is returned as it is, without any delay. Vitaly correctly said.

Make a request for the required symbol-period in OnInit to initiate the creation of the required history

1. If I understand correctly, you suggest to make the request once at the beginning of the indicator . Here https://www.mql5.com/ru/docs/runtime/event_fire the Init event is surrounded by a lot of conditions: "This event is also generated after a change of symbol and/or chart period, after recompiling the program in MetaEditor, after a change of input parameters from an Expert Advisor or a custom indicator. The Expert Advisor is also initialized after the account is changed."But the user does not have to generate these events, he/she can sit comfortably on the only current TF and watch the indicator, so the re-initialization and reloading of history more than once will not happen. However, the lack of history does not necessarily occur at the beginning of work, the error suddenly and repeatedly appears at random times during the work (moreover, during the long-term work of the indicator it may not appear at all; often there is no error at the beginning of work). Then the missing part of the history should be downloaded not only in OnInit, but also inOnCalculate, in order to prevent the recurring error?

Or by"initiate building the right history" did you mean that it's enough to do this once inOnInit and then you won't need to do it again? But on the one hand, an error occurs even when the entire history of the instrument is loaded and all the timeframes are tuned, because the indicator is multitime and ryllime; on the other hand, under the same conditions an error may not occur.

2. What does "lack of part of history" mean? When you run the terminal for the first time after installation, it downloads the missing history - literally the one on the left, earlier in time. But it copies the CopyTime(_Symbol,tf,0,1,Arr), i.e. it copies the latest bar on the right side, not the history bar. Could the new bar somehow relate to history and its lack?

3. I admit that my vague explanations may not be enough to understand the problem; I don't want to be sent tohttps://www.mql5.com/ru/forum/133408, therefore I am ready to share the code with the comments with developers and others who would like to debug it together, because I want to make the indicator available for free via CodeBase. By the way, if that's the case, is it acceptable to release unreleased free code?

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

1. If I understand correctly, you suggest to make a request once at the beginning of the indicator's work, at OnInit. Here https://www.mql5.com/ru/docs/runtime/event_fire Init event is surrounded by a lot of accompanying conditions: "This event is also generated after a change of symbol and/or chart period, after recompiling the program in MetaEditor, after a change of input parameters from an EA or custom indicator. The Expert Advisor is also initialized after the account is changed."But the user does not have to generate these events, he/she can sit comfortably on the only current TF and watch the indicator, so the re-initialization and reloading of history more than once will not happen. However, the lack of history does not necessarily occur at the beginning of work, the error suddenly and repeatedly appears at random times during the work (moreover, during the long-term work of the indicator it may not appear at all; often there is no error at the beginning of work). Then the missing part of the history should be downloaded not only in OnInit, but also inOnCalculate, in order to prevent the recurring error?

Or by"initiate building the right history" did you mean that it's enough to do this once inOnInit and then you won't need to do it again? But on the one hand, an error occurs even when the entire history of the symbol is loaded and all of the timeframes are completed, because the indicator is multitime and rylltime; on the other hand, under the same conditions an error may not occur.

2. What does the notion of "missing a piece of history" itself mean? When you run the terminal for the first time after installation, it downloads the missing history - literally the one on the left, earlier in time. But it copies the CopyTime(_Symbol,tf,0,1,Arr), i.e. it copies the latest bar on the right side, not the history bar. Could the new bar in some way relate to the history and its lack?
In indicators, no one will guarantee you the output of the requested data if it is not ready.

The scripts and the Expert Advisors have a sufficient guarantee.

Therefore, in indicators wait for the cycle of data availability.

To increase the probability of getting the right data, make fake data requests in the indicator. This will provoke the background loading of data.
 
Renat Fatkhullin:
In indicators, no one guarantees that the requested data will be issued if it is not ready.

It seems to me, from my low bell tower, that the data requested is ready, because it is the latest bar available at the moment. How can it not be ready? If it appears on the chart, it is ready.

 
Renat Fatkhullin:
In indicators, no one will guarantee you the release of the requested data if it is not ready.

In scripts and experts there is sufficient guarantee.

So in indicators wait for cycle after cycle of data availability.

Cool... Even in the new year in the post. Happy New Year. !!!!!!!

 
x572intraday:

It seems to me, from my low bell tower, that the data requested is ready, because it is the latest bar available at the moment. How can it not be ready? If it appears on the chart, it is ready.

Read my answer carefully.
 
Renat Fatkhullin:
Read my answer carefully.

We need to define the notion of data availability. If I see a bar in the terminal, is it already available or are there other options? And yes, Renat, what about point 3 of my previous post?

 
x572intraday:

We need to define the notion of data availability. If I see a bar in the terminal, is it already available or are there other options? And yes, Renat, what about point 3 of my previous post?

If you get a function response, then the data is unavailable.

If you have evidence to the contrary, you should provide it in a fully consistent and technically reproducible way.
Reason: