Overall Statistics |
Total Trades 61 Average Win 0.35% Average Loss -0.27% Compounding Annual Return 1.117% Drawdown 4.000% Expectancy 1.136 Net Profit 6.904% Sharpe Ratio 0.438 Probabilistic Sharpe Ratio 6.503% Loss Rate 7% Win Rate 93% Profit-Loss Ratio 1.31 Alpha 0.011 Beta -0.011 Annual Standard Deviation 0.022 Annual Variance 0 Information Ratio -0.708 Tracking Error 0.17 Treynor Ratio -0.823 Total Fees $61.50 Estimated Strategy Capacity $1200000000.00 Lowest Capacity Asset TQQQ UK280CGTCB51 |
class FormalFluorescentPinkCamel(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).Symbol self.window = RollingWindow[TradeBar](2) self.ticket = None def OnData(self, data): if not data.Bars.ContainsKey("TQQQ"): return self.window.Add(data.Bars["TQQQ"]) if not self.window.IsReady: return if self.ticket and (self.UtcTime - self.ticket.Time).days > 1: if self.ticket.Status != OrderStatus.Filled: self.ticket.Cancel("Order cancelled after 1 day") close = self.window[0].Close if not self.Portfolio.Invested: low = self.window[0].Low high = self.window[0].High Open = self.window[0].Open low1 = self.window[1].Low high1 = self.window[1].High close1 = self.window[1].Close if (low < low1) and (high < high1) and (close < Open) and (close < close1): self.ticket = self.StopMarketOrder("TQQQ", 100, high) else: if close > self.fill_price + 1: self.Liquidate("TQQQ") def OnOrderEvent(self, orderevent): if orderevent.Status == OrderStatus.Filled: self.fill_price = orderevent.FillPrice