I am trying to make an indicator that adds Daily time frame OHLC levels to intraday time frames charts, by using AddDataSeries() to add the Daily time frame DataSeries and and using its
BarsInProgress == 1 filter in the OnBarUpdate() called Calculate.OnBarClose.
With the chart trading hours manually set to "Default 24 x 5" in the Data Series properties inspector, and using an AddDataSeries() overload that attempts to also set the trading hours to "Default 24 x 5"... which sets Open and Close trading hours from midnight to midnight:
AddDataSeries( this.Instrument.FullName, new BarsPeriod{ BarsPeriodType = BarsPeriodType.Day, Value = 1 }, "Default 24 x 5");
While OnBarUpdate() IS called OnBarClose as expected at midnight for the added daily data series.
The Open[0] and Close[0] values for added daily data series do not reflect the requested trading hours... the Close[0] returned is from 5pm (or 6pm sorry a little hard to tell on a forex instrument with price stored in float that causes price rounding inaccuracies) and NOT midnight as expected?
I initially tried using the simpler AddDataSeries() overload, which the API notes say the added data series will use the properties of the primary chart data series:
AddDataSeries(BarsPeriodType.Day, 1);
Both seem ignore the chart configured and dynamically requested trading hours when calculating Open[0] and Close[0] ...possibly High[0] and Low[0] also.
It seems to possibly still be using the "Instrument Default" trading hours to form the OHLC for the the added data series?
I would like the OHLC for the the added data series to be calculated based on its "bar" opening at midnight and closing midnight. To match the charts primary bars.
Is there a way to control the Open and Close times of added data series?
Thanks
Comment