Overall Statistics
Total Trades
1595
Average Win
0.02%
Average Loss
0.00%
Compounding Annual Return
3.897%
Drawdown
3.300%
Expectancy
5.177
Net Profit
3.904%
Sharpe Ratio
0.731
Probabilistic Sharpe Ratio
38.991%
Loss Rate
41%
Win Rate
59%
Profit-Loss Ratio
9.52
Alpha
-0.083
Beta
0.243
Annual Standard Deviation
0.055
Annual Variance
0.003
Information Ratio
-3.443
Tracking Error
0.136
Treynor Ratio
0.165
Total Fees
$1636.50
Estimated Strategy Capacity
$79000000.00
Lowest Capacity Asset
TQQQ UK280CGTCB51
class HipsterVioletAntelope(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2020, 5, 14)  # Set Start Date
        self.SetEndDate(2021,5,14)
        self.SetCash(100000)  # Set Strategy Cash
        self.spy = self.AddEquity("TQQQ", Resolution.Minute).Symbol
        self.window = RollingWindow[TradeBar](2)
        self.DefaultOrderProperties.TimeInForce = TimeInForce.Day
        


    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:

                self.Liquidate("TQQQ")
                
    def OnOrderEvent(self, orderevent):

        if orderevent.Status == OrderStatus.Filled:

            self.fill_price = orderevent.FillPrice

            self.Debug(self.fill_price)