I'm trying to use machine learning to scalp crypto using current and previous period data: quotebar and indicator data rsi, atr, aroon. I developed the model in the research environment but now trying to implement it in a backtest. I need the quotebars and indicator values to be saved in rolling windows. I can't get the data to save so I can use it. Any suggestions?

class CryptoAIScapping(QCAlgorithm):

    def initialize(self):

        self.set_warm_up(100, Resolution.DAILY)

        self.set_start_date(2024, 10, 28)

        self.set_end_date(2024, 10, 30)

        self.set_cash(10000)

        self.crypto_symbol = self.add_crypto("BTCUSD", Resolution.MINUTE).Symbol

        self.quote_bar_window = RollingWindow[QuoteBar](3)

        self.rsi = self.rsi(self.crypto_symbol, 14, Resolution.DAILY)

        self.rsi_current = RollingWindow[IndicatorDataPoint](2)

        self.atr = self.atr(self.crypto_symbol, 20, MovingAverageType.SIMPLE, Resolution.DAILY)

        self.atr_current = RollingWindow[IndicatorDataPoint](2)

        self.aroon = self.aroon(self.crypto_symbol, 10, Resolution.DAILY)

        self.aroon_current = RollingWindow[IndicatorDataPoint](2)

 

    def on_data(self, data):

        if self.is_warming_up:

            return

        if data.quote_bars.contains_key(self.crypto_symbol):

            self.quote_bar_window.add(data.quote_bars[self.crypto_symbol])

        if self.std.is_ready:

            self.std_current.add(self.std.current)

        if self.rsi.is_ready:

            self.rsi_current.add(self.rsi.current)

        if self.atr.is_ready:

            self.atr_current.add(self.atr.current)

        if self.aroon.is_ready:

            self.aroon_current.add(self.aroon.current)

        if self.macd.is_ready:

            self.macd_current.add(self.macd.current)

        if not self.quote_bar_window.is_ready:

            return

if not all([self.rsi.IsReady, self.rsiCurrent.IsReady, self.atr.IsReady, self.aroon.IsReady, self.macd.IsReady ]):

            return

        Bar0 = self.quoteBarWindow[0]  # Current bar has index zero.

        Bar1 = self.quoteBarWindow[1]  # Previous bar has index one.

        Bar2 = self.quoteBarWindow[2]  # Bar from two periods ago

    # Compute the difference between the current close and the previous close

        close_diff0 = Bar0.close - Bar1.close

        close_diff1 = Bar1.close - Bar2.close

        # Compute the difference between the current volume and the previous volume

        volume_diff0 = Bar0.volume - Bar1.volume

        volume_diff1 = Bar1.volume - Bar2.volume

        close_spread_AB0 = Bar0.ask.close - Bar1.bid.close

        close_spread_AB1 = Bar1.ask.close - Bar2.bid.close

        size_spread_AB0 = Bar0.last_ask_size - Bar1.last_bid_size

        size_spread_AB1 = Bar1.last_ask_size - Bar2.last_bid_size

 

        rsi_0 = self.rsiCurrent[0]

        rsiAL_0 = self.rsiAverage_loss[0]

        rsiAG_0 = self.rsiAverage_gain[0]

        rsi_1 = self.rsiCurrent[1].current.value

        rsiAL_1 = self.rsiAverage_loss[1]

        rsiAG_1 = self.rsiAverage_gain[1]

        atr_0 = self.atrCurrent[0]

        atrTR_0 = self.atrTrue_range[0]

        atr_1 = self.atrCurrent[1]

        atrTR_1 = self.atrTrue_range[1]