Hello everyone, im trying to use consolidators and rolling windows in an attempt to obtain OHLC of a previous monthly bar. Im not sure if this is even possible or if there is a better way to do this, so any info is appreciated.

Below is the code i have so far. I try to create monthly data with a consolidator and add it to a rolling window. It throws the error: 

Runtime Error: Python.Runtime.PythonException: ArgumentOutOfRangeException : Must be between 0 and 0

I then change my arguement like so...... monthlyhigh = self.monthly[0].High
it gives me a bunch of daily highs. i cant figure out what im doing wrong.

from QuantConnect.Data.Market import TradeBar from datetime import timedelta from System import * from QuantConnect import * from QuantConnect.Algorithm import * from QuantConnect.Indicators import * import decimal as d class MyAlgorithm(QCAlgorithm): def Initialize(self): '''Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.''' self.SetStartDate(2017,1,1) #Set Start Date self.SetEndDate(2017,6,6) self.SetCash(100000) #Set Strategy Cash self.AddEquity("SPY", Resolution.Second) consolidator = TradeBarConsolidator(timedelta(1)) consolidator.DataConsolidated += self.OnMonthlyData self.SubscriptionManager.AddConsolidator("SPY", consolidator) self.monthly = RollingWindow[TradeBar](2) def OnData(self, data): pass # Add monthly bar to monthly rolling window def OnMonthlyData(self, sender, bar): self.monthly.Add(bar) monthlyhigh = self.monthly[1].High self.Debug(str(monthlyhigh))