Overall Statistics
Total Trades
2267
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
0
Tracking Error
0
Treynor Ratio
0
Total Fees
$308499.52
class EMAMomentumUniverse(QCAlgorithm):
    
    # Get EMA for stocks
    # Compare 50 day EMA to stock price
    # If we have crossed it, buy / sell
    # At end of day, liquidate

    def Initialize(self):
        self.SetStartDate(2020, 4, 30)
        self.SetEndDate(2020, 4, 30)
        self.SetCash(100000)
        self.symbol = 'CHK'
        self.StockList = [self.symbol]
        self.SetUniverseSelection(ManualUniverseSelectionModel(self.StockList))
        self.AddEquity(self.symbol, Resolution.Tick)
        #self.SetWarmup(50)
        self.slow = self.EMA(self.symbol, 10, Resolution.Tick)
        self.fast = self.EMA(self.symbol, 1, Resolution.Tick)
        self.isSlow = True
        self.isFast = True
        
        self.Schedule.On(self.DateRules.EveryDay(),\
        self.TimeRules.At(16, 00), \
        self.SellPortfolio)
        
    def OnData(self, data):
        if self.slow < self.fast and self.isSlow:
            self.Liquidate()
            self.SetHoldings(self.symbol, -1)
            self.isFast = True
            self.isSlow = False
            self.Debug(self.slow)
            self.Debug(self.fast)
        elif self.slow > self.fast and self.isFast:
            self.Liquidate()
            self.SetHoldings(self.symbol, 1)
            self.isSlow = True
            self.isFast = False
            
    def SellPortfolio(self):
        self.Liquidate()