Overall Statistics
Total Trades
259
Average Win
1.47%
Average Loss
-2.02%
Compounding Annual Return
-6.502%
Drawdown
35.000%
Expectancy
0.004
Net Profit
-3.379%
Sharpe Ratio
0.073
Probabilistic Sharpe Ratio
25.523%
Loss Rate
42%
Win Rate
58%
Profit-Loss Ratio
0.73
Alpha
-0.022
Beta
0.996
Annual Standard Deviation
0.447
Annual Variance
0.2
Information Ratio
-1.61
Tracking Error
0.014
Treynor Ratio
0.033
Total Fees
$259.00
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()