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 Sortino 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.538 Tracking Error 0.147 Treynor Ratio 0 Total Fees $0.00 Estimated Strategy Capacity $0 Lowest Capacity Asset Portfolio Turnover 0% |
# region imports from AlgorithmImports import * import matplotlib as plt from collections import deque # endregion class MuscularFluorescentOrangeGoat(QCAlgorithm): def Initialize(self): self.SetStartDate(2021, 1, 1) self.SetCash(100000) self.ticker = self.AddEquity("SPY", Resolution.Daily) self.window = 10 self.prices = deque(maxlen=self.window) self.dates = deque(maxlen=self.window) self.stockPlot = Chart('Stock Plot') self.stockPlot.AddSeries(Series('Price', SeriesType.Line)) self.stockPlot.AddSeries(Series('High', SeriesType.Scatter)) self.stockPlot.AddSeries(Series('Low', SeriesType.Scatter)) self.AddChart(self.stockPlot) def OnData(self, data: Slice): self.Plot('Stock Plot', 'Price', data[self.ticker.Symbol].Close) self.prices.appendleft(data[self.ticker.Symbol].Close) self.dates.appendleft(data.Time) if len(self.prices) == self.window: lag_high = max(self.prices) self.Plot('Stock Plot', 'High', lag_high) lag_low = min(self.prices) self.Plot('Stock Plot', 'Low', lag_low) self.prices = deque(maxlen=self.window)