I suggest applying iBarShift with true flag to make sure a specific bar exists in history. If not present set it to zero.
Hi
You can try and show us your attempt of doing this in your code and we can try to show you where might be a problem. But here I think there might be no easy solution and you just must get the market hours for each symbol and setup the total summary market hours (for all symbols together). Then compare time from each candle with those market hours and if the time is not within the range set the value to 0. If the times within the time range, just make the calculations normally.
You can get trading hour by this function: https://www.mql5.com/en/docs/marketinformation/symbolinfosessiontrade
Best Regards

Documentation on MQL5: Market Info / SymbolInfoSessionTrade
- www.mql5.com
Allows receiving time of beginning and end of the specified trading sessions for a specified symbol and day of week. Parameters name [in] ...
learn about CopySeries, copy the rates (bars) into a double array and the times into a datetime array
Apply some conditions to check if current data can be retrieved or not

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 friends, I am doing a multisymbol indicator that is already working OK for two symbols that have the SAME market hours. My problem is for multi symbols with different market hours. At first I want just to plot the close price of the second symbol in a separated screen, but later on I want to develop other ideas based on the behavior of the second symbol.
My question is how to make sure that the second symbol close price stays aligned witht the close prices of the main symbol? for example: MAIN symbol starts market hours: 01:00 to 18:00 .. second symbol market hours: 03:00 to 18:00... during the 2 hours that the second symbol does not have prices I would like it to show zero at the separated chart, but I am not able to do it.. would anyone kindly suggest a approach/solution?