Overall Statistics
Total Trades
0
Average Win
0%
Average Loss
0%
Compounding Annual Return
0%
Drawdown
0%
Expectancy
0
Net Profit
0%
Sharpe Ratio
0
Probabilistic Sharpe Ratio
0%
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
0
Beta
0
Annual Standard Deviation
0
Annual Variance
0
Information Ratio
-22.219
Tracking Error
0.347
Treynor Ratio
0
Total Fees
$0.00
class MomentumBasedTacticalAllocation(QCAlgorithm):
    
    def Initialize(self):
        
        self.SetStartDate(2020, 1, 1) 
        self.SetEndDate(2020, 1, 14)  
        self.SetCash(100000)
        self.leveragedETFSymbol = "TQQQ"
        self.minutesBeforeMarketClose = 10
        self.movingAveragePeriod = 200
        self.timeSmaPriceToString = ""
        
        self.tqqq = self.AddEquity(self.leveragedETFSymbol, Resolution.Daily)  
      
        self.tqqqSMA = self.SMA(self.leveragedETFSymbol, self.movingAveragePeriod, Resolution.Daily) 
        
        self.Schedule.On(self.DateRules.EveryDay(self.leveragedETFSymbol), self.TimeRules.BeforeMarketClose(self.leveragedETFSymbol, self.minutesBeforeMarketClose), self.dailyStockComputations)
        
        self.SetBenchmark(self.leveragedETFSymbol)  
        self.SetWarmUp(self.movingAveragePeriod) 
  
    def OnData(self, data):
        
        if self.IsWarmingUp:
            return
            
    def dailyStockComputations(self):
        
        if self.IsWarmingUp:
            return
        self.timeSmaPriceToString = "Time: " + str(self.Time) + ", SMA: "+str(self.tqqqSMA.Current.Value) +", 3xETF: "+str(self.Portfolio[self.leveragedETFSymbol].Price)
        self.Debug(self.timeSmaPriceToString)