In my Indicator I want to have at least 10 bars of the SPY for the first 1 minute bars processed by the indicator.
var dailyPeriod = new BarsPeriod() { BarsPeriodType = BarsPeriodType.Day, Value = 1, MarketDataType = MarketDataType.Last }; AddDataSeries("SPY", dailyPeriod, 10, "Default 24x7", null);
If I am viewing January 1st to January 30th the daily bars will only be from ~the 15th of January to the 30th.
In order to make sure I have at least 10 days of data prior to processing January 1st on the one minute chart, I will need to figure out how many trading days there are the date range, then add 10 more bars to that value and I need to do all this in State.Configure.
This gets even more complicated if I change the range of the chart. I could be looking at 5 minute bars and looking at 90 days. Now I will need # of trading days in 90 days + 10.
How can I calculate this value in State.Configure?
Why doesn't the barsToLoad parameter base it off the first bar of the chart, instead of the last?
Comment