Hi all,

I can't get this algo to start trade on Paper trading. Any idea why ? Backtest works fine, but when I deploy it Live and use broker Paper Trading it does not execute any trades at all. 

 

# KOK 02-11-2021
# Trade setup with multiple tickers
# ------------------------------------------------------------------------------------
STOCKS = ["SE", "GMAB", "ZIM", "U", "CELH", "PYPL", "CVNA", "DOCU", "FUBO", "SQ", "SONO", "ROKU", "PFE", "MELI", "GS", "LMND", "MDB", "MRNA", "NIO", "DM", "NFLX", "AAPL", "MSFT", "GOOGL", "TX", "ABNB", "TSLA", "NVDA", "UPST", "CRWD", "NET", "SNOW", "MTTR", "GRVY"]; #
MA_F = 6; MA_S = 25; MA_50 = 60; FAST = 12; SLOW = 26; SIGN = 9; LEV = 0.95; RSI_Signal = 14
# ------------------------------------------------------------------------------------

class SimpleStockTrade_KOK(QCAlgorithm):
   
    def Initialize(self):
        self.SetStartDate(2020, 11, 1)  
        #self.SetEndDate(2021, 4, 1)
        #self.SetCash(20000)  
        
        res = Resolution.Daily
        #SMA setup
        self.fast_sma = {}
        self.slow_sma = {}
        self.slowSMA_50 = {}
        #MACD setup
        self.macd = {}
        self.signalDeltaPercent = {}
        #RSI setup
        self.rsi = {}
        #Day count
        self.daycount = {}
        
        self.tolerence_exit = {}
        
        self.stocks =  [self.AddEquity(ticker, Resolution.Minute).Symbol for ticker in STOCKS]
        for sec in self.stocks:
            self.fast_sma[sec] = self.SMA(sec, MA_F, res)
            self.slow_sma[sec] = self.SMA(sec, MA_S, res)
            self.slowSMA_50[sec] = self.SMA(sec, MA_50, res)
            self.macd[sec] = self.MACD(sec, FAST, SLOW, SIGN, MovingAverageType.Exponential, res)
            self.rsi[sec] = self.RSI(sec, RSI_Signal, MovingAverageType.Simple, res)
            self.daycount[sec] = 0
        self.SetWarmUp(23400) # How to calculate this number ?
        
    def OnData(self, data):
        if self.IsWarmingUp: return
        if self.Time.time() != time(9, 31): return
        
        for sec in self.stocks:
            if not (self.fast_sma[sec].IsReady) or not (self.slow_sma[sec].IsReady): continue
            if not (self.macd[sec].IsReady): continue
    
            self.signalDeltaPercent[sec] = (self.macd[sec].Current.Value - self.macd[sec].Signal.Current.Value)/self.macd[sec].Fast.Current.Value
            
            if self.Portfolio[sec].Quantity <= 0: 
                if self.slow_sma[sec] < self.fast_sma[sec] and self.signalDeltaPercent[sec] > 0 and self.slow_sma[sec] > self.slowSMA_50[sec]:
                    self.SetHoldings(sec, LEV / 8)
                    
            elif self.Portfolio[sec].Quantity > 0 : 
                self.daycount[sec] = self.daycount[sec] + 1
                if self.slow_sma[sec] > self.fast_sma[sec]: 
                    self.Liquidate(sec)