Overall Statistics |
Total Trades 747 Average Win 0.01% Average Loss 0.00% Compounding Annual Return 2.296% Drawdown 2.100% Expectancy 54.929 Net Profit 5.853% Sharpe Ratio 0.942 Probabilistic Sharpe Ratio 44.956% Loss Rate 1% Win Rate 99% Profit-Loss Ratio 55.29 Alpha 0.013 Beta 0.049 Annual Standard Deviation 0.017 Annual Variance 0 Information Ratio -0.288 Tracking Error 0.145 Treynor Ratio 0.324 Total Fees $747.00 Estimated Strategy Capacity $28000000.00 Lowest Capacity Asset QQQ RIWIV7K5Z9LX Portfolio Turnover 0.02% |
# region imports from AlgorithmImports import * # endregion class RetrospectiveMagentaDragonfly(QCAlgorithm): def Initialize(self): self.SetStartDate(2021, 3, 13) self.SetCash(1000000) self.qqq=self.AddEquity("QQQ", Resolution.Hour).Symbol # self.DefaultOrderProperties.TimeInForce = TimeInForce.Day self.entryTicket=None self.stopLossTicket=None self.entryTime=None self.stopLossTime=None self.sma20=self.SMA(self.qqq, 20) self.sma200=self.SMA(self.qqq,200) self.exitPrice=None def OnOrderEvent(self, orderEvent): if orderEvent.Status != OrderStatus.Filled: return if self.entryTicket is not None and self.entryTicket.OrderId == orderEvent.OrderId: self.entryTime=self.Time self.Debug(self.entryTicket.Tag) if self.entryTicket.Tag == "buy_main_order": self.stopLossTicket=self.TrailingStopOrder(self.qqq, -abs(self.entryTicket.Quantity),0.03,True,tag="sell_stop_loss") elif self.entryTicket.Tag == "sell_main_order": self.stopLossTicket=self.TrailingStopOrder(self.qqq, abs(self.entryTicket.Quantity),0.03,True ,tag="buy_stop_loss") self.Debug("inside the permises") def OnData(self, data: Slice): if not self.Portfolio.Invested and self.qqq in data.Bars: recentClose=data[self.qqq].Close self.quantity=1 if self.sma20.Current.Value > self.sma200.Current.Value: limitPrice=recentClose*.80 self.exitPrice=recentClose*1.10 self.entryTicket=self.LimitOrder(self.qqq,1,limitPrice,tag="buy_main_order") elif self.sma20.Current.Value < self.sma200.Current.Value: limitPrice=recentClose*1.20 self.exitPrice=recentClose*0.95 self.entryTicket=self.LimitOrder(self.qqq, -abs(1), limitPrice,tag="sell_main_order") # if self.exitPrice and recentClose >= self.exitPrice: # self.Liquidate(self.qqq)