Overall Statistics |
Total Trades 0 Average Win 0% Average Loss 0% Compounding Annual Return 0% Drawdown 0% Expectancy 0 Net Profit 0% Sharpe Ratio 0 Probabilistic Sharpe Ratio 0% Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha 0 Beta 0 Annual Standard Deviation 0 Annual Variance 0 Information Ratio -0.668 Tracking Error 0.303 Treynor Ratio 0 Total Fees $0.00 Estimated Strategy Capacity $0 Lowest Capacity Asset |
class TrailingStopLoss(QCAlgorithm): def Initialize(self): self.SetStartDate(2020, 1, 1) self.SetEndDate(2020, 12, 31) self.stock = self.AddEquity("LNN", Resolution.Daily).Symbol self.sma = self.SMA(self.stock, 30, Resolution.Daily) closing_prices = self.History(self.stock, 30, Resolution.Daily)["close"] for time, price in closing_prices.loc[self.stock].items(): self.sma.Update(time, price) def OnData(self, data): hist = self.History(self.stock, timedelta(30), Resolution.Daily) high = max(hist["high"]) self.Debug(str(data[self.stock].Price)) self.Plot("Benchmark", "30 day-High", high) self.Plot("Benchmark", "SMA", self.sma.Current.Value)