There is not even an attempt to use CheckLoadHistory() in your code ? No need to open all charts, use the function and check the returned code. Act accordingly.
BTW: I found this a little better for my purposes as it is set-up as an include file. shttps://www.mql5.com/en/code/1251
I checked the CheckLoadHistory() function in the documentation and it seems unsuitable for indicators, because of all the Sleep() functions.
As far as I know Sleep() functions do nothing in indicators and a while loop using them will just bump the cpu to 100% utilization and hang the client.
So. It seems it should be modified for indicator use. But thanks for the info, this function contains all the necessary info to do just that.
Just recently converted to MT5 to use multi-pair strategies. Currently trying to write a currency strength meter indicator that looks at 28 pairs.
At present, the only way I can make Bars("XXXYYY",PERIOD_CURRENT) work across all 28 pairs is to open all the relevant charts using ChartOpen(SymbolIndex_Array[i],PERIOD_CURRENT).
If the a relevant chart is not open, Bars("XXXYYY",PERIOD_CURRENT) returns a zero value, eve though the relevant symbol is available in the MarketWatch (using SymbolSelect function).
Does anyone have any suggestions apart from opening all the other 27 windows......??
Currently this signal open positions for EURUSD, GBPUSD, EURGBP, USDCAD, USDJPY, NZDUSD and XAUUSD.
Just make sure they are available in the Market Watch and it should work.