Hello, I hope you all are having a great day. I started to work on a VWAP algorithm that trades with the intersection of VWAP and price but I realized that it misses trades regularly and the trades it makes are inconsistent with the intersections. Can anyone help?

# region imports
from AlgorithmImports import *
# endregion

class DeterminedAsparagusManatee(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2020, 6, 22)  # Set Start Date
        self.SetEndDate(2020, 6, 23)
        self.SetCash(100000)  # Set Strategy Cash
        self.ethusd = self.AddCrypto("ETHUSD", Resolution.Minute).Symbol

        self.window = RollingWindow[Decimal](2)

        self.vwap = self.VWAP(self.ethusd)

        self.p1 = 0.01
        self.p2 = 0.02

        stockplot = Chart("TradePlot")
        stockplot.AddSeries(Series("Price", SeriesType.Line, 0))
        stockplot.AddSeries(Series("VWAP", SeriesType.Line, 0))
        self.AddChart(stockplot)
      
    def OnData(self, data: Slice):

        self.window.Add(data[self.ethusd].Close)

        if not self.window.IsReady:
            return

        pnl = self.Securities[self.ethusd].Holdings.UnrealizedProfitPercent
        
        self.Plot("TradePlot", "Price", self.Securities[self.ethusd].Close)
        self.Plot("TradePlot", "VWAP", self.vwap.Current.Value)

        currentclose = self.window[0]
        pastclose = self.window[1]
        vwap = self.vwap.Current.Value

        if not self.Portfolio.Invested:
            if pastclose < vwap and currentclose > vwap:
                self.Buy(self.ethusd, 1)
            
            elif pastclose > vwap and currentclose < vwap:
                self.Sell(self.ethusd, 1)
        
        elif self.Portfolio.Invested:
                if pnl > self.p2 or pnl < -self.p1:
                    self.Liquidate(self.ethusd)

Author