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
-0.778
Tracking Error
0.167
Treynor Ratio
0
Total Fees
$0.00
Estimated Strategy Capacity
$0
Lowest Capacity Asset
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