Hi,
I’ve experienced the following strange behaviour regarding the history update:
When using a while-loop in an indicator, with refreshrates() in between, the history data doesn’t get updated within the loop, even when I run the loop for 60 seconds. Instead the data is updated immediately after the loop has finished.
Okay, I've overestimated refreshrates() a bit.
I don't run the indicator/EA on EURJPY.
But why is the data updated within the EA loop, if refreshrates() is only updating the data for the current symbol?
TheTime = iTime(EURJPY, PERIOD_M15, 0);In a EA only, if TheTime is zero, then capture GetLastError, and if it is ERR_HISTORY_WILL_BE_UPDATED THEN and ONLY THEN should you wait 15 seconds and retry. If you get anything other than 4066, you are done, there is no history for the pair/tf specified. RefreshRates if you slept and you need updated predefined variables after the data arrives.
Okay, I've overestimated refreshrates() a bit.
I don't run the indicator/EA on EURJPY.
But why is the data updated within the EA loop, if refreshrates() is only updating the data for the current symbol?
Refreshrates() is irrelevant to this issue, don't take my word for it, read the documentation for RefreshRates() and predefined variables and see for yourself . . .
Okay, I understand. Thank you!
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
I’ve experienced the following strange behaviour regarding the history update:
When using a while-loop in an indicator, with refreshrates() in between, the history data doesn’t get updated within the loop, even when I run the loop for 60 seconds. Instead the data is updated immediately after the loop has finished.
When I use the same code in an EA, the update works within the loop.
See attached code and logs.
Why is that?
I know that the EA is running in an own thread, while the indicator is running within the main thread, but still.
Is there a way to get the data updated within the while loop of an indicator?
Thanx.