Hi! 

Using rolling windows, I want to calculate average value of a pip for fx pairs within last 20 days. Unfortunately I wasn't able to find similar topics within this forum. I attempted to implement the code by myself, but I am stuck with this error: 

During the algorithm initialization, the following exception has occurred: Loader.TryCreatePythonAlgorithm(): Unable to import python module ./cache/algorithm/project/main.pyc. AlgorithmPythonWrapper(): name 'Pair1_0D' is not defined
  at 
    AvgPair1_Variation = (Pair1_0D + Pair1_1D + Pair1_2D + Pair1_3D + Pair1_4D +Pair1_5D + Pair1_6D) / 7

Here is my code:

def Initialize(self):

        self.Pair_1 = "USDDKK"
        self.Pair_2 = "USDPLN"
        self.SetStartDate (2000, 3, 3) 
        self.SetEndDate(2022,5,24)
        self.SetCash(1000000)  
        self.SetBrokerageModel(BrokerageName.OandaBrokerage)
        self.EURSEK = self.AddForex(self.Pair_1, Resolution.Daily, Market.Oanda)
        self.GBPSGD = self.AddForex(self.Pair_2, Resolution.Daily, Market.Oanda)
        self.symbols = [self.Pair1, self.Pair_2]
        self.prevMinPriceVariation = { symbol : RollingWindow[QuoteBar](20) for symbol in self.symbols }     
        
def OnData(self,data):
    for symbol in self.symbols:
        if data.ContainsKey(symbol):
            self.prevPrices[symbol].Add( data[symbol] )

        if not all([ window.IsReady for window in self.prevMinPriceVariation.values() ]):
            return            
    Pair1_Variation = self.prevMinPriceVariation[self.Pair1]
    Pair1_6D = Pair1_window[6].MinimumPriceVariation
    Pair1_5D = Pair1_window[5].MinimumPriceVariation
    Pair1_4D = Pair1_window[4].MinimumPriceVariation
    Pair1_3D = Pair1_window[3].MinimumPriceVariation        
    Pair1_2D = Pair1_window[2].MinimumPriceVariation
    Pair1_1D = Pair1_window[1].MinimumPriceVariation
    Pair1_0D = Pair1_window[0].MinimumPriceVariation

    Pair2_Variation = self.prevMinPriceVariation[self.Pair_2]
    Pair2_6D = Pair1_window[6].MinimumPriceVariation
    Pair2_5D = Pair1_window[5].MinimumPriceVariation
    Pair2_4D = Pair1_window[4].MinimumPriceVariation
    Pair2_3D = Pair1_window[3].MinimumPriceVariation        
    Pair2_2D = Pair1_window[2].MinimumPriceVariation
    Pair2_1D = Pair1_window[1].MinimumPriceVariation
    Pair2_0D = Pair1_window[0].MinimumPriceVariation

AvgPair1_Variation = (Pair1_0D + Pair1_1D + Pair1_2D + Pair1_3D + Pair1_4D +Pair1_5D + Pair1_6D) / 7
AvgPair2_Variation = (Pair2_0D + Pair2_1D + Pair2_2D + Pair2_3D + Pair2_4D +Pair2_5D + Pair2_6D) / 7

self.Log("Average variation Pair1 : " + str+(AvgPair1_Variation))

Does anyone have any idea or suggestions on how to solve this?