Overall Statistics |
Total Trades 1 Average Win 0% Average Loss 0% Compounding Annual Return 0.043% Drawdown 0.100% Expectancy 0 Net Profit 0.021% Sharpe Ratio 0.314 Probabilistic Sharpe Ratio 29.736% Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha 0.001 Beta -0.001 Annual Standard Deviation 0.001 Annual Variance 0 Information Ratio -0.543 Tracking Error 0.409 Treynor Ratio -0.446 Total Fees $1.00 |
class OptimizedCalibratedReplicator(QCAlgorithm): def Initialize(self): self.SetStartDate(2020, 2, 24) # Set Start Date self.SetCash(100000) # Set Strategy Cash self.AddEquity("SPY", Resolution.Daily) self.entry_ticket = None self.stop_loss_ticket = None def OnData(self, data): if self.stop_loss_ticket is None: self.entry_ticket = self.MarketOrder("SPY", 1) stop_price = self.entry_ticket.AverageFillPrice * 0.9 self.stop_loss_ticket = self.StopMarketOrder("SPY", -1, stop_price) def OnOrderEvent(self, orderevent): if orderevent.Status != OrderStatus.Filled: return if self.entry_ticket is not None and \ self.entry_ticket.OrderId == orderevent.OrderId: self.entry_ticket = None if self.stop_loss_ticket is not None and \ self.stop_loss_ticket.OrderId == orderevent.OrderId: self.stop_loss_ticket = None