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
When I need more I must scroll back manually on each symbol/timeframe chart.
If I don't do this I will never get the real value for example iHigh(Symbol(), Period(), 5000) .
Also, should the iteration and sleep delays not be enough and you notice that only by scrolling the chart, you are able to obtain more bars, consider scrolling it programmatically in your EA with "ChartNavigate()".
PS! Also, consider using "CopyRates()" or "ArrayCopyRates()" instead.
mmh, the count is just an information actually, to count how many times the WHILE loop has runned before getting a value that is not error 4066 and 4073.
Also, should the iteration and sleep delays not be enough and you notice that only by scrolling the chart, you are able to obtain more bars, consider scrolling it programmatically in your EA with "ChartNavigate()".
That is my friend, since the beginning of the thread i aws asking for something to automate the chart scrolling, that is the problem, getting value of bars that i can get only if scroll the chart. Or if i add an absurd delay like 60000 i can get value with a normal function? I'll try this.
What's the difference using the mqlRates structure? I'm using iFunction currently.
Also, should the iteration and sleep delays not be enough and you notice that only by scrolling the chart, you are able to obtain more bars, consider scrolling it programmatically in your EA with "ChartNavigate()".
That is my friend, since the beginning of the thread i aws asking for something to automate the chart scrolling, that is the problem, getting value of bars that i can get only if scroll the chart. Or if i add an absurd delay like 60000 i can get value with a normal function? I'll try this.
What's the difference using the mqlRates structure? I'm using iFunction currently.
Then why did you not read up on the Chart Operations in the documentation? It has an entire section devoted to that subject!
As for "mqlRates", it is more compatible with MQL5, and since it is an Array, it is more code efficient than using function calls (hence why I suggested using "CopyRates()" or "ArrayCopyRates()" instead).
Also, 60000 is an absurd delay if you are talking about milliseconds and not loop counts. My test delays were just 561 ms (which is about 1/2 second)! If you are talking loop counts, then use "Sleep()" as I explained.
Then why did you not read up on the Chart Operations in the documentation? It has an entire section devoted to that subject!
As for "mqlRates", it is more compatible with MQL5, and since it is an Array, it is more code efficient than using function calls (hence why I suggested using "CopyRates()" or "ArrayCopyRates()" instead).
Also, 60000 is an absurd delay if you are talking about milliseconds and not loop counts. My test delays were just 561 ms (which is about 1/2 second)! If you are talking loop counts, then use "Sleep()" as I explained.
If you do go with ChartNavigate, from my experience you have to keep calling it until you hit Max Bars in Chart (or the broker history limit, I guess). It seems to jump in 197 bar intervals.
Example on a fresh chart opened with no pre-existing history:
void OnStart()
{
ChartSetInteger(0,CHART_AUTOSCROLL,false);
long maxbars=TerminalInfoInteger(TERMINAL_MAXBARS);
printf("Max bars: %i", maxbars);
printf("Chart starts with %i bars",Bars);
for(int try=0; try<1000 && Bars<maxbars; try++)
{
RefreshRates();
ChartNavigate(0,CHART_BEGIN,-10000);
printf("Chart currently has %i bars",Bars);
Sleep(50);
}
printf("Chart ends with %i bars",Bars);
}
By the way, the "CopyRates()" function allows you to specify, how many bars to collect, so try it before resorting to the Chart Scroll work-around.
As far as I know, CopyRates will only go as far back as there are bars on the chart.
Using my example above, you would only get 2048 rates copied even if you specified a higher number in CopyRates().
Using my example above, you would only get 2048 rates copied even if you specified a higher number in CopyRates().