Hi, 

Despite going through problems posted, I can't find a solution on how to use close a position, without implementing a reverse market order. As you can see, at the end of my code I open 2 positions, each with separate ticket-name. Then, I want to close only one of them. 
I tried changing the liquidate function to self.Liquidate(self.ticketPair1.Symbol) as it has been suggested previously, but unfortunately it doesn't solve the problem.

# region imports
from AlgorithmImports import *
# endregion

class CustomIndexStrategy(QCAlgorithm):

    def Initialize(self):

        self.Pair_1_Multiplier = 1
        self.Pair_1 = "USDDKK"
        self.holdingDays = 1
        self.SetStartDate (2010, 1, 1) 
        self.SetEndDate(2022,7,1)
        self.SetCash(10000)  
        self.SetBrokerageModel(BrokerageName.OandaBrokerage)
        self.EURSEK = self.AddForex(self.Pair_1, Resolution.Daily, Market.Oanda)
        self.symbols = [self.Pair_1]
        self.prevPrices = { symbol : RollingWindow[QuoteBar](7) for symbol in self.symbols }
        self.ticketPair1 = None 
        self.ticketPair2 = None
        self.maximumholdingdays = 4
        self.volume = 10

    def OnData(self,data):
        
        self.quantity_1 = self.CalculateOrderQuantity(self.Pair_1 , self.volume)
        
        for symbol in self.symbols:
            if data.ContainsKey(symbol):
                self.prevPrices[symbol].Add( data[symbol] )

        if not all([ window.IsReady for window in self.prevPrices.values() ]):
            return
            
        Pair1_window = self.prevPrices[self.Pair_1]
        Pair1_1D = Pair1_window[1].Close
        Pair1_0D = Pair1_window[0].Close

        if self.ticketPair2 is None and self.Securities[self.Pair_1].Exchange.ExchangeOpen is True and Pair1_0D < Pair1_1D    :
            self.ticketPair2 = self.MarketOrder(self.Pair_1, self.quantity_1 ) 
            self.priceLong= self.ticketPair2.AverageFillPrice
            self.ticketPair1 = self.MarketOrder(self.Pair_1, self.quantity_1)
            self.openingTime = self.ticketPair2.Time

        if self.ticketPair2 is not None and self.Securities[self.Pair_1].Exchange.ExchangeOpen is True and Pair1_0D > self.priceLong and  self.UtcTime >= self.openingTime + timedelta(days = 1): 
            self.Liquidate()