I assume you are talking about making sure the history is up to date ?
I do this, it's not very elegant but it seems to work, you can easily adapt it for other pairs . . .
// Check for current data, try to get Open of bar 1 for a few time periods . . . TestBar1Price = iOpen(NULL, PERIOD_M1, 1); TestBar1Price = iOpen(NULL, PERIOD_M1, 2); TestBar1Price = iOpen(NULL, PERIOD_M1, 3); TestBar1Price = iOpen(NULL, PERIOD_M5, 1); TestBar1Price = iOpen(NULL, PERIOD_M15, 1); TestBar1Price = iOpen(NULL, PERIOD_M30, 1); TestBar1Price = iOpen(NULL, PERIOD_H1, 1); TestBar1Price = iOpen(NULL, PERIOD_H4, 1); TestBar1Price = iOpen(NULL, PERIOD_D1, 1); TestBar1Price = iOpen(NULL, PERIOD_W1, 1); TestBar1Price = iOpen(NULL, PERIOD_MN1, 1); if (GetLastError() == 4066) { Print("Error 4066, Requested history data in updating state", " Bars = ", Bars, " lMax_Bars_Indicator= ", lMax_Bars_Indicator); RestartBarPaint = true; return(0); }
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
Currently I'm using something like this:
So why do I need to load Indicator I don't intend to use. Tho, the indicator is removed later by the log. I'm wondering if there's a more direct option for loading history bars for different Symbols.