Overall Statistics
Total Trades
86
Average Win
0.38%
Average Loss
-0.28%
Compounding Annual Return
1.808%
Drawdown
6.100%
Expectancy
1.266
Net Profit
11.369%
Sharpe Ratio
0.604
Probabilistic Sharpe Ratio
14.388%
Loss Rate
3%
Win Rate
97%
Profit-Loss Ratio
1.34
Alpha
0.017
Beta
-0.013
Annual Standard Deviation
0.025
Annual Variance
0.001
Information Ratio
-0.672
Tracking Error
0.171
Treynor Ratio
-1.214
Total Fees
$88.00
Estimated Strategy Capacity
$1300000000.00
Lowest Capacity Asset
TQQQ UK280CGTCB51
class HipsterVioletAntelope(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2015, 5, 14)  # Set Start Date
        self.SetEndDate(2021,5,14)
        self.SetCash(100000)  # Set Strategy Cash
        self.AddEquity("TQQQ", Resolution.Daily)
        self.window = RollingWindow[TradeBar](2)
        #self.DefaultOrderProperties.TimeInForce = TimeInForce.Day
        self.sellUp = False
        self.sellDown = False
        

    def OnData(self, data):
        if not data.Bars.ContainsKey("TQQQ"):
            return
        
        self.window.Add(data.Bars["TQQQ"])
        if not self.window.IsReady:
            return
        
        low = self.window[0].Low
        high = self.window[0].High 
        close = self.window[0].Close
        Open = self.window[0].Open
        low1 = self.window[1].Low
        high1 = self.window[1].High 
        close1 = self.window[1].Close
        
        if not self.Portfolio.Invested:
            if (low < low1) and (high < high1) and (close < Open) and (close < close1):
                self.ticket = self.StopMarketOrder("TQQQ", 100, high)
        else:
            if self.Securities["TQQQ"].Price > self.fill_price + 1:
                self.Liquidate("TQQQ")

    def OnOrderEvent(self, orderevent):
        if orderevent.Status == OrderStatus.Filled:
            self.fill_price = orderevent.FillPrice