The most usual problem: you installed using pip but are running inside another environment like Spyder. You have to install it in your environment (the interpreter you use in the shell happens to be another installation)
# Keep a reference to the "close" line in the data dataseries
self.orderid = list()
self.order = None
self.dataclose = self.datas.close
self.upper_limit = self.p.upper
# self.counttostop = 0
self.datastatus = 0
self.bar_executed = 0
Your __init__ statement contain no indicators and no constraints to ensure buffers are filled with a minimum. This means that when you enter next the first time anything which uses [-1] and [-2] is actually broken, because the minimum period is 1, which means the code goes directly into next as soon as data is available.
My recommendation: learn backtesting loading data from a file and not playing with InteractiveBrokers.