Overall Statistics |
Total Trades 67 Average Win 1.02% Average Loss -0.94% Compounding Annual Return -33.552% Drawdown 23.400% Expectancy -0.811 Net Profit -5.096% Sharpe Ratio -0.339 Probabilistic Sharpe Ratio 28.275% Loss Rate 91% Win Rate 9% Profit-Loss Ratio 1.08 Alpha -0.184 Beta 2.174 Annual Standard Deviation 0.489 Annual Variance 0.239 Information Ratio -0.62 Tracking Error 0.281 Treynor Ratio -0.076 Total Fees $144.05 Estimated Strategy Capacity $3400000000.00 Lowest Capacity Asset ES Y4D62XFM9IPT |
from AlgorithmImports import * class MuscularRedOrangeMosquito(QCAlgorithm): def Initialize(self): self.SetCash(100000) self.SetStartDate(2022, 9, 16) self.SetEndDate(2022, 11, 1) self.es = self.AddFuture(Futures.Indices.SP500EMini) self.es.SetFilter(5, 100) self.entryTicket = None self.exitTicket = None self.highestPrice = 0 self.lowestPrice = 25000 def OnData(self, slice): for chain in slice.FutureChains: self.popularContracts = [contract for contract in chain.Value if contract.OpenInterest > 1000] if len(self.popularContracts) == 0: continue sortedByOIContracts = sorted(self.popularContracts, key=lambda k : k.OpenInterest, reverse=True) self.liquidContract = sortedByOIContracts[0] price = self.Securities[self.liquidContract.Symbol].Price if not self.Portfolio.Invested and not self.Transactions.GetOpenOrders(self.liquidContract.Symbol): self.entryTicket = self.StopMarketOrder(self.liquidContract.Symbol, 1, price + 10) if self.entryTicket is not None and self.entryTicket.Status != OrderStatus.Filled: if price < self.lowestPrice: self.lowestPrice = price updateFields = UpdateOrderFields() updateFields.StopPrice = price + 10 self.entryTicket.Update(updateFields) if self.exitTicket is not None and self.Portfolio.Invested: if price > self.highestPrice: self.highestPrice = price updateFields = UpdateOrderFields() updateFields.StopPrice = price - 10 self.exitTicket.Update(updateFields) def OnOrderEvent(self, orderEvent): if orderEvent.Status != OrderStatus.Filled: return price = self.Securities[self.liquidContract.Symbol].Price if self.entryTicket is not None and self.Portfolio.Invested: self.exitTicket = self.StopMarketOrder(self.liquidContract.Symbol, -1, price - 10)