My requirement is to calculate value across indicator of multiple symbols and get back result in whole, but looks like something got wrong that I can never guarentee all of the symbols outside of the current chart window is right.
Brief code is as follows:
And execute on one chart, say, EURUSD.
I found the value done by EURUSD is always correct, but other values cannot be guarenteed - they change as per my behavior of executing the script by using Debug on MT4 Editor or Execute in trading platform. eg when using debug ,EURNZD might not correct, but using platform, EURNZD is right, GBPUSD & EURJPY is not.
Also the symptom varies across dates, like, I execute this on yesterday in Debug and found wrong in EURNZD, but execute on today in Debug, EURNZD is right, EURCAD not.
My initial research found the reason might caused by some of the symbols were not correctly refreshed and the value was calculated by some timestamp in previous time. But I have refreshed the rate in script and All enlisted symbols are shown in market watch window.
So what's wrong with my code and how to fix the problem?
Download history in MQL4 EA - Forex Calendar - MQL4 programming forum - Page 3 #26 № 4
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
My requirement is to calculate value across indicator of multiple symbols and get back result in whole, but looks like something got wrong that I can never guarentee all of the symbols outside of the current chart window is right.
Brief code is as follows:
And execute on one chart, say, EURUSD.
I found the value done by EURUSD is always correct, but other values cannot be guarenteed - they change as per my behavior of executing the script by using Debug on MT4 Editor or Execute in trading platform. eg when using debug ,EURNZD might not correct, but using platform, EURNZD is right, GBPUSD & EURJPY is not.
Also the symptom varies across dates, like, I execute this on yesterday in Debug and found wrong in EURNZD, but execute on today in Debug, EURNZD is right, EURCAD not.
Update 1: My initial research found the reason might caused by some of the symbols were not correctly refreshed and the value was calculated by some timestamp in previous time. But I have refreshed the rate in script and All enlisted symbols are shown in market watch window.
Update 2: Looks like the trick is I didn't refresh the historical data for the symbols so that it goes wrong. But how to refresh the data if I want to make it automated (at least once every few hours) without opening the chart, eg, I want to execute script on EURUSD to refresh rate on EURCAD etc?