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
-6.316
Tracking Error
0.087
Treynor Ratio
0
Total Fees
$0.00
class OnInOut(QCAlgorithm):

    def Initialize(self):
        
        self.MinsAfterOpen = 30
        
        self.RsiDays = 24
        self.SmaDays = 14
        self.PpoSlowDays = 14
        self.PpoFastDays = 10

        self.SetStartDate(2020, 1, 1)
        self.SetEndDate(2020,1,14)
        
        self.StartCash = 100000
        self.SetCash(self.StartCash)
        
   # ------------------------------------------- Defining Tickers and collection Indicators -----------------------------
        self.tickers = ["QQQ","TLT"]  
       
        self.TickerTable = {}
        
        for ticker in self.tickers:
            
            # Problem 2 ---------------- Change Hour to Minute and ceck results
            self.AddEquity(ticker, Resolution.Hour)
            
            rsi = self.RSI(ticker, self.RsiDays, Resolution.Daily)
            sma = self.SMA(ticker, self.SmaDays, Resolution.Daily)
            rcShort = self.RC(ticker,self.SmaDays, Resolution.Daily)
            ppo = self.PPO(ticker, self.PpoFastDays, self.PpoSlowDays, MovingAverageType.Simple, Resolution.Daily)
            
            symbolData = SymbolData(ticker, rsi, sma, rcShort, ppo)
            
            self.TickerTable[ticker] = symbolData
            

        # problem 1 ----------------------- Change 30 mins to 90 mins and check indicator results
        self.Schedule.On(self.DateRules.EveryDay("QQQ"),self.TimeRules.AfterMarketOpen("QQQ",30), self.Trade)

        self.SetWarmUp(timedelta(days=30))

    # ------------------------------------------------- On Data -----------------------------------------------------
    def OnData(self, data):
        pass
        
        
    # ---------------------------------------------- Trade Function --------------------------------------------------
    def Trade(self):
        
      
        
        self.QQQ_RSI = self.TickerTable["QQQ"].Rsi.Current.Value
        self.QQQ_PPO = self.TickerTable["QQQ"].Ppo.Current.Value
        self.QQQ_SMA = self.TickerTable["QQQ"].Sma.Current.Value
        self.QQQ_SLOPE = self.TickerTable["QQQ"].RcShort.Slope.Current.Value
        
        self.Debug(f"{self.Time} PPO:{round(self.QQQ_PPO,2)} Slope:{round(self.QQQ_SLOPE,2)} RSI:{round(self.QQQ_RSI,2)} ")
     
    
# ------------------------------------------- SymbolData --------------------------------------------------
         
class SymbolData:
    def __init__(self, symbol, rsi, sma, rcShort, ppo):
        self.Symbol = symbol
        self.Rsi = rsi
        self.Sma = sma
        self.RcShort = rcShort
        self.Ppo = ppo