Overall Statistics |
Total Trades 2 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 $2.00 Estimated Strategy Capacity $89000000.00 Lowest Capacity Asset QQQ RIWIV7K5Z9LX |
class FocusedSkyBlueGalago(QCAlgorithm): def Initialize(self): self.SetStartDate(2020, 1, 1) #self.SetEndDate(2018, 1, 3) self.InitCash = 10000 self.SetCash(self.InitCash) self.AddEquity("SPY", Resolution.Minute) self.SetWarmUp(5) # ETF's we're going to trade=================================== spy = self.AddEquity("SPY", Resolution.Minute) qqq = self.AddEquity("QQQ", Resolution.Minute) WMT = self.AddEquity("QLD", Resolution.Minute) spy.SetDataNormalizationMode(DataNormalizationMode.Raw) qqq.SetDataNormalizationMode(DataNormalizationMode.Raw) WMT.SetDataNormalizationMode(DataNormalizationMode.Raw) self.spy = spy.Symbol self.qqq = qqq.Symbol self.WMT = WMT.Symbol #Option Contract ================================================= self.contract = None # Rebalance beginning of every month ======================= self.Schedule.On(self.DateRules.MonthStart("SPY"), self.TimeRules.AfterMarketOpen("SPY"), self.monthlyRebalance) self.Schedule.On(self.DateRules.EveryDay("SPY"), self.TimeRules.AfterMarketOpen("SPY"), self.captureSpy) #Variables used in stoploss================================= self.stoplosshold = 0 self.dailythresh = 0 self.activestop = 0 def OnData(self, data): ''' OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here. Arguments: data: Slice object keyed by symbol containing the stock data ''' if self.IsWarmingUp: return if not self.Portfolio.Invested: self.SetHoldings(self.spy, .55) self.SetHoldings(self.qqq, .35) self.dailythresh = self.data['SPY'].Open if self.stoplosshold == 1: pass else: self.stoploss() def captureSpy(self, data): ''' captureSpy logic: 1. Grab the opening value of spy ''' pass #self.dailythresh = self.data['SPY'].Open def monthlyRebalance(self): #Now I need to rebalance portfolio on a monthly basis if self.IsWarmingUp: return self.SetHoldings(self.spy, 0.55) self.SetHoldings(self.qqq, 0.35) return def stoploss(self): ''' Stoploss logic: 1. If any equity drops more than 5% liquidate entire portfolio 2. Hold the portfolio with no equity until next trading day ''' pass