mt4forum:
What do you think RefreshRates() does ? if this Indicator were on a EURJPY chart there is no need for RefreshRates() as the incoming tick updates anyway, if the Indicator isn't on EURJPY RefreshRates() is refreshing information you aren't interested in . . . you can't slow down the Interface thread.
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.
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.
mt4forum:
Because you ask for data and it isn't there, hence the error 4066, then you wait . . . and while waiting the data arrives. You can't wait in an Indicator, "you can't slow down the Interface thread."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!
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
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.