I would like to have this program run for 10-15 symbols. How can I do that without restructuring the entire program?

Can I just make a list and put the list name in the space where the symbol went?

I just posted the first half of my code... I think it gets the point across...

Thanks in advance!!

class BootCampTask(QCAlgorithm): # Order ticket for our stop order, Datetime when stop order was last hit stopMarketTicket = None stopMarketOrderFillTime = datetime.min highestTSLAPrice = 0 openingBar = None def Initialize(self): self.SetStartDate(2017, 10, 2) self.SetEndDate(2019, 5, 30) self.SetCash(100000) tsla = self.AddEquity("TSLA", Resolution.Minute) tsla.SetDataNormalizationMode(DataNormalizationMode.Raw) self.Consolidate("TSLA", timedelta(minutes=30), self.OnDataConsolidated) #3. Create a scheduled event triggered at 13:30 calling the ClosePositions function self.Schedule.On(self.DateRules.EveryDay("TSLA"), self.TimeRules.At(13,30), self.ClosePositions) def OnData(self, data): # 1. Plot the current SPY price to "Data Chart" on series "Asset Price" #self.Plot("Data Chart", "Asset Price", data["SPY"].Close) if self.openingBar is None: return #if not self.Portfolio.Invested: # self.MarketOrder("SPY", 500) # self.stopMarketTicket = self.StopMarketOrder("SPY", -500, 0.9 * self.Securities["SPY"].Close) if data["TSLA"].Close > self.openingBar.High and not self.Portfolio.Invested: self.Debug("high of 30m bar: " + str(self.openingBar.High)) # print the high of the 30 minute bar self.Debug("opening price bar where signal triggered " + str(data["TSLA"].Open)) # print the opening of the first minute bar after the initial 30 minute bar #self.SetHoldings("TSLA", .5) # invest half of cash into it self.MarketOrder("TSLA", 500) # orders 500 shares self.Debug("price paid avg: " + str(self.Portfolio["TSLA"].AveragePrice))

 

Author