Just got through the boot camp and I'm trying to build a simple test algorithm to practice some basic concepts like consolidation. For some reason though, I'm getting this error and can't figure out why… Help!

from AlgorithmImports import *
import numpy as np

class SimpleBreakoutExample(QCAlgorithm):

    def Initialize(self):
        self.SetCash(100000)
        self.SetStartDate(2022,8,31)
        self.SetEndDate(2022,9,10)
        self.symbol = self.AddEquity("PIXY", Resolution.Second).Symbol

        self.Consolidate(self.symbol, Resolution.Minute, self.BarHandler)

        self.Schedule.On(self.DateRules.EveryDay(), self.TimeRules.At(15, 0), self.Liquidate)

    def OnData(self, data):
        # if within 10 mins of first bar & price goes above opening1minhigh, buy and set stop loss at opening1minlow.
        if not self.Portfolio.Invested or self.opening1minBar is not None or data.Time.hour == 9 and data.Time.minute <= 11 and self.Securities[self.symbol].Close > self.opening1minBar.high:
            self.SetHoldings("PIXY", 1)
            stocknumber = self.CalculateOrderQuantity("PIXY", -1)
            self.Highprice = self.opening1minBar.High

        # trail exit price once the price exceeds a certain amount.
        if self.Portfolio.Invested:
            self.stopMarketTicket = self.StopMarketOrder("PIXY", stocknumber, self.opening1minBar.Low)
            if self.Securities["PIXY"].Close > self.Highprice:
                Highprice = self.Securities["PIXY"].Close
                updateFields = UpdateOrderFields()
                updateFields.StopPrice = self.Securities["PIXY"].Close * 0.9
                self.stopMarketticket.Update(updateFields)

    def BarHandler(self, bar):
        if bar.Time.hour == 9 and bar.Time.minute == 1:
            self.opening1minBar = bar

 

'SimpleBreakoutExample' object has no attribute 'opening1minBar'
  at OnData
    self.Highprice = self.opening1minBar.High
   at Python.Runtime.PythonException.ThrowLastAsClrException()
   at Python.Runtime.PyObject.Invoke(PyTuple args in main.py: line 20