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
I have an indicator that runs on D1 and pulls a values from W1 using iBarShift(). When the data isn't there, it isn't there, so I need to pull it.
The first script example of https://www.mql5.com/en/docs/series/bars has a synchronization technique that I hadn't seen before. It appears that the call to Bars() instantiates the pull request, and repeated checks on SERIES_SYNCHRONIZED tells whether the data has come in yet.
But there is nothing in the documentation to suggest that Bars() requests a pull of data.
Implementing this technique, my indicator does indeed request higher TF values when I add the indicator in Terminal to a chart.
Problems with back testing:
When I run my indicator through the Tester, the Bars() technique does not pull the higher TF data. Bars() always returns 0, and iBarShift() returns -1 always.
Weird.
Getting it to work:
So, I revamped my synchronization technique to use CopyTime() instead. At least with CopyTime(), the documentation is explicit:
And now my indicator works in Terminal and also in the Tester. So, I should have done this in the first place.
So I guess I am confused about the script in the Bars() documentation that supposedly synchronizes data. It misled me. What is this, and what would I use it for?