Can anyone explain why I'm not able to retrieve crypto quotebar data in backtesting?  The self.quote_bar_window never receives the data (all NONE). If I remove the “if then” statement, the program hit a runtime error. Any help would be appreciated.

        for quote_bar in self.crypto_history:

            self.quote_bar_window.add(quote_bar)

        if not self.quote_bar_window.is_ready:

            return

 

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.crypto_history = self.history("BTCUSD", 3, Resolution.MINUTE)

        self.quote_bar_window = RollingWindow[QuoteBar](3)

        self.set_risk_management(MaximumDrawdownPercentPerSecurity(0.20))
 

        # Correct method calls for indicators

        self.std = self.std(self.crypto_symbol, 22)

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

        self.atr = self.aroon(self.crypto_symbol, 10, 20)

        self.aroon = self.aroon(self.crypto_symbol, 10, 20) # Corrected to include both up and down periods

        self.macd = self.macd(self.crypto_symbol, 12, 26, 9, MovingAverageType.Exponential)

 

        self.set_benchmark("BTCUSD")

 

    def on_data(self, data):

        if self.is_warming_up:

            return

 

        for quote_bar in self.crypto_history:

            self.quote_bar_window.add(quote_bar)
 

        if not self.quote_bar_window.is_ready:

            return

 

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

            return
 

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

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

        Bar2 = self.quote_bar_window[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

 

        ask_rangeOC_0 = Bar0.ask.open - Bar0.ask.close

        ask_rangeHL_0 = Bar0.ask.high - Bar0.ask.low

        ask_rangeHC_0 = Bar0.ask.high - Bar0.ask.close

        ask_rangeHO_0 = Bar0.ask.high - Bar0.ask.open

        ask_rangeOL_0 = Bar0.ask.open - Bar0. ask.low

        ask_rangeCL_0 = Bar0.ask.close - Bar0.ask.low