Overall Statistics
Total Trades
2139
Average Win
0.52%
Average Loss
-0.14%
Compounding Annual Return
52.675%
Drawdown
19.200%
Expectancy
0.282
Net Profit
54.217%
Sharpe Ratio
1.788
Probabilistic Sharpe Ratio
65.817%
Loss Rate
72%
Win Rate
28%
Profit-Loss Ratio
3.65
Alpha
0.379
Beta
0.589
Annual Standard Deviation
0.349
Annual Variance
0.122
Information Ratio
0.611
Tracking Error
0.341
Treynor Ratio
1.057
Total Fees
$2139.00
Estimated Strategy Capacity
$12000000.00
Lowest Capacity Asset
SBOW WK9O766FC2UD
class BasicTemplateAlgorithm(QCAlgorithm):

    def Initialize(self):
     
        self.SetStartDate(2020,6,1)
        self.SetCash(4000)
        self.Data_Symbol = {}
        tickers = ["SPY","AMC","GME","SENS","AMSC","SNDL","HARP","EH","LOOP","QFIB","IDT",
                        "BB","BTX","RCON","BGFV","SBOW","EDRY","BBW","CELH","DDS","RRD",
                        "NOTV","UAN","JYNT","RFP","LOVE","NTP","RICK","SI","CMBM","CTRN",
                        "BNTX","TGLS","TGB","HYRE","BCRX","AVID","BBIG","WINT","DOCU"]
        
        self.SetWarmUp(30, Resolution.Daily)                
                        
        for stock in tickers:
            symbol = self.AddEquity(stock, Resolution.Minute).Symbol
            self.Data_Symbol[symbol] = SymbolData(self, symbol)
            
         
        self.Schedule.On(self.DateRules.EveryDay("SPY"), self.TimeRules.AfterMarketOpen("SPY", 31), 
            self.EveryDayAfterMarketOpen)
            
            
    def EveryDayAfterMarketOpen(self):
        if self.IsWarmingUp: return
        
        for symbol, symbol_data in self.Data_Symbol.items():
            if not symbol_data.rsi.IsReady: continue
            holdings = self.Portfolio[symbol]
            invested = holdings.Invested
            nowprice = holdings.Price
            quantity = holdings.Quantity
            bpower = self.Portfolio.Cash
            
            rsi = symbol_data.rsi.Current.Value
            macd = symbol_data.macd.Current.Value
            
            #The perfect Swing set up is Adx > 20 and Rsi > 60 and Macd > 0 and Cci > 100:
            if not invested and bpower > nowprice and rsi > 60 and macd > 0: 
                self.MarketOrder(symbol, 5)
                
                
            elif invested and rsi < 30 and macd < 0:
                self.Liquidate(symbol)


class SymbolData:
    def __init__ (self,algo,symbol):
        self.algorithm = algo
        self.symbol = symbol
        self.rsi = algo.RSI(symbol, 14, Resolution.Daily)
        self.macd = algo.MACD(symbol, 12, 26, 9, Resolution.Daily)