Overall Statistics
class ModulatedOptimizedProcessor(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2019, 12, 16)  
        self.SetCash(60000)  
        
        self.spy = self.AddEquity("SPY").Symbol
        self.qqq = self.AddEquity("QQQ").Symbol
        self.Schedule.On(self.DateRules.EveryDay(self.spy), self.TimeRules.BeforeMarketClose(self.spy, 5), self.ClosePositionsEndOfDay)
 
        #Use WILR indicator to track percent change.
        self.wilrSpy = self.WILR(self.spy, 1, Resolution.Daily)
        self.wilrQqq = self.WILR(self.qqq, 1, Resolution.Daily)
        #Plot the percent change.
        self.PlotIndicator("PercentChange", self.wilrSpy, self.wilrQqq)
        
    def OnData(self, data):
        
        if self.spy not in data or self.qqq not in data:
            return
        
        if not self.Portfolio.Invested:
            self.SetHoldings(self.spy, 1)
        
    def ClosePositionsEndOfDay(self):
        self.Liquidate()