Overall Statistics |
Total Trades 11 Average Win 0% Average Loss -2.45% Compounding Annual Return 11.241% Drawdown 30.200% Expectancy -1 Net Profit 206.244% Sharpe Ratio 0.794 Probabilistic Sharpe Ratio 21.098% Loss Rate 100% Win Rate 0% Profit-Loss Ratio 0 Alpha -0.003 Beta 0.917 Annual Standard Deviation 0.16 Annual Variance 0.026 Information Ratio -0.886 Tracking Error 0.017 Treynor Ratio 0.139 Total Fees $47.63 |
class StopLoss(QCAlgorithm): def Initialize(self): self.SetStartDate(2010, 1, 1) self.SetEndDate(2020, 7, 1) self.SetCash(100000) self.spy = self.AddEquity("SPY", Resolution.Hour).Symbol self.Securities[self.spy].SetDataNormalizationMode(DataNormalizationMode.Raw) self.lastOrderEvent = None def OnData(self, data): weight = self.CalculateOrderQuantity(self.spy, 0.99) close = self.Securities["SPY"].Close if not self.Portfolio.Invested: self.MarketOrder("SPY", weight) self.StopMarketOrder("SPY", -weight, 0.98 * close)