I am trying to implement the following momentum strategy, with the following rebalancing routine:

  • From three ETFs representing US, EU and Emerging Markets, select the one with the highest momentum
  • if the momentum of this ETF is higher than the momentum of a treasury bills etf, invest everything in this ETF
  • else, invest everything in a bond ETF
My code looks like this: def Rebalance(self): self.symbolObjects.sort(key=lambda symbolObject: symbolObject.Momentum.Current.Value, reverse=True) currentLong = self.symbolObjects[0].Symbol if self.symbolObjects[0].Momentum.Current.Value < self.tBill.Momentum.Current.Value: currentLong = self.bonds self.SetHoldings(currentLong, self.leverage, True)

The attached backtest shows, that my implementation does not work as intended. 

Why is the US-etf sold 2 consecutive times? Why is there no position after July 2010? 

Author