You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Try to transfer to C - the error will find itself. And in general - with such projects it's the only way to write, if you don't want problems in the future. Unfortunately, I myself have understood it too late and now rewrite it :).
We have an indicator running on TF M15, in the code the indicator requests the time series MqlRates from TF M1.
The indicator does not start at once as M1 data is not ready and it is not possible to load it during the first run.
As a result we have a fake pass and the indicator does not access the data anymore, thinking that it is already calculated and there is no need to recalculate it.
Now I am running the indicator in two ways:
Hence the question: how to automate the correct checking and loading of the required data for another TF?
Hence the question: how to automate the checking and loading of the required data from the other TF?
In a similar situation, I control the initialization process in OnCalculate. If there is an error during initialization, then I return prev_calculated=0 and keep doing it until everything is calculated correctly.
The idea is good, although nothing can be assigned to prev_calculated, the variable is declared as const, but I understand you can have another similar variable.
There is still one question - if there is no data, what should I do?
I understand that request for data itself doesn't lead to downloading or uploading from local database, and this is exactly the problem.
The idea is good, although you can't assign anything to prev_calculated, the variable is declared as const, but I understood you, you can have another similar variable.
It's not about assignment, it's about the number returned by OnCalculated. If your data is not ready, you will return 0 from OnCalculated.
Look at the examples of BarsCalculated. That's how you should check.
One question remains - if there is no data, what should you do?
If you want, you can wait and calculate buffers by timer.
If your data is not ready, you will return 0 from OnCalculated.
If you don't have them and they won't appear, then there's not much to do.Look at the examples of BarsCalculated.
If you want, you can call waiting and calculating buffers by timer.
It does not help, only unloading the indicator and restarting it, in this case the data is already there for some reason.
Or alternatively, open a chart with the required M1 TF, then the data on the adjacent M15 chart on M1 request is ready immediately.
It doesn't help, only unloading the indicator and restarting it, in this case the data is already there for some reason.
Or alternatively, open a chart with the required TF, then the data on the adjacent chart is ready at once.
Today I spent half a day with indices. There were multicurrency/multitime.
The problem with not displaying is that you are trying to take a value from a bar that simply does not exist in this TF.
So you have to check before taking a bar - SeriesInfoInteger.No unloading needed. You won't unload the calculation part anyway (I just raised the topic on this today).
I've been working with the indices for half a day today. There were multicurrency/multitime.
The problem with the non-displaying is that it tries to take the value from a bar that just does not exist in this TF.
So you have to check before taking a bar - SeriesInfoInteger.No unloading needed. You can't unload the calculation part anyway (I just brought up a topic on this today).
Mimeo, I have a checker, I find the first date on TF M1 and the calculation of M15 bars starts from this date. TF is set as PERIOD_M1
1. the idea is good, although nothing can be assigned to prev_calculated, the variable is declared as const, but I understand you can have another similar variable.
2. one question remains, and if there is no data, what should we do?
3. I understand that the data request itself does not cause the data to be downloaded or uploaded from the local database, and this is exactly the problem.
I understand that the data request itself doesn't cause data downloading or uploading from local database, and this is exactly the problem.
From the CopyXXXX help:
When requesting data from an Expert Advisor or a script, it will initiate downloading from the server, if the terminal does not have these data locally, or it will start building the required timeseries, if the data can be built from the local history, but they are not ready yet. The function will return the amount of data that will be ready when the timeout expires, but history will continue to be downloaded and the next similar request will return more data.