hi guys, I am facing an error. The high and low get interchanged due to which the bot buys at high and sells at low. How can it be fixed?

#region imports
from AlgorithmImports import *
#endregion
# Rolling Window Fractal Indicator (Binance)
CRYPTO = "USDCUSDT"; BAR = 60;
class BlackpantherFractal(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2022, 5, 1)
self.SetEndDate(2022, 5, 3)
self.SetCash("USDT", 1000)
self.crypto = self.AddCrypto(CRYPTO, Resolution.Minute, Market.Binance).Symbol
self.SetSecurityInitializer(lambda s: s.SetLeverage(1))
self.SetBrokerageModel(BrokerageName.Binance, AccountType.Margin)
self.Consolidate(self.crypto, timedelta(minutes = BAR), self.CustomBarHandler)
self.window = RollingWindow[TradeBar](3)
self.consolidator = TradeBarConsolidator(timedelta(minutes=BAR))
self.SubscriptionManager.AddConsolidator(self.crypto, self.consolidator)
self.SetWarmUp(BAR, Resolution.Minute)
def CustomBarHandler(self, bar):
if self.IsWarmingUp: return
self.window.Add(bar)
if not self.window.IsReady: return
H = [self.window[i].High for i in range(3)]
L = [self.window[i].Low for i in range(3)]
C = [self.window[i].Close for i in range(3)]
curr_price = self.Securities[self.crypto].Price
if not self.Portfolio[self.crypto].IsLong:
if ( curr_price <= L[1] <= L[2]):
self.SetHoldings(self.crypto,1)
elif not self.Portfolio[self.crypto].IsShort:
if ( curr_price >= H[1] >= H[2]):
self.SetHoldings(self.crypto,-1)