Overall Statistics
Total Trades
0
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
-5.717
Tracking Error
0.06
Treynor Ratio
0
Total Fees
$0.00
Estimated Strategy Capacity
$0
Lowest Capacity Asset
class RetrospectiveRedSalmon(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2021, 11, 1)  # Set Start Date
        self.SetCash(100000)  # Set Strategy Cash
        
        self.ibm = self.AddEquity("IBM", Resolution.Tick).Symbol

        self.sum = 0
        self.td = 10000000
        self.n = 1
        self.count = 0
        
        self.Schedule.On(self.DateRules.On(2021,11, 14), self.TimeRules.At(15,45), self.ExitPositions)
                        
    def OnData(self, slice):
        
        if not slice.Bars.ContainsKey(self.ibm):
            return
        
        #self.Debug(f"Last price: {tick[-1].LastPrice}")
        #self.Debug(f"Last Quantity: {tick[-1].Quantity}")
        
        quantity = 0 if slice[self.ibm][-1].Quantity is None else slice[self.ibm][-1].Quantity 
        
        
        self.sum = quantity + self.sum #slice['AAPL'] instead of ticks
        tl = []
        
        if abs(self.sum)/self.n == self.td:
            tl[(self.n - 1)] = self.sum/self.n
            if tl[-1] > 0 and tl[-2] is not None:
                if tl[-2] > 0:
                    self.count = self.count + 1
        else:
            return
        
        self.n = self.n + 1
        
    def ExitPositions(self):
        self.Liquidate() 
        self.Debug("p estimate: " + str(self.count))