Overall Statistics |
Total Trades 810 Average Win 1.11% Average Loss -1.09% Compounding Annual Return 0.928% Drawdown 18.600% Expectancy 0.019 Net Profit 3.545% Sharpe Ratio 0.115 Probabilistic Sharpe Ratio 1.882% Loss Rate 50% Win Rate 50% Profit-Loss Ratio 1.02 Alpha -0.012 Beta 0.214 Annual Standard Deviation 0.132 Annual Variance 0.017 Information Ratio -0.589 Tracking Error 0.188 Treynor Ratio 0.071 Total Fees $810.00 Estimated Strategy Capacity $14000000.00 Lowest Capacity Asset AMZN R735QTJ8XC9X |
class EmotionalFluorescentPinkSalmon(QCAlgorithm): def Initialize(self): self.SetStartDate(2018, 1, 1) self.SetEndDate(2021, 11, 1) self.SetCash(100000) self.atrs = {} self.tickers = {} symbols = ["AMZN", "MSFT", "AAPL"] for ticker in symbols: self.AddEquity(ticker, Resolution.Minute) self.tickers[ticker] = IndicatorExtensions.Over(self.ATR(ticker, 14, MovingAverageType.Simple, Resolution.Minute), self.Securities[ticker].Price) self.tickers = {k: v for k, v in sorted(self.tickers.items(), key=lambda item: item[1], reverse=True)[:1]} self.portfolio_targets = [] for stock, volt in self.tickers.items(): self.stock = self.AddEquity(stock, Resolution.Minute).Symbol self.portfolio_targets.append(self.stock) self.spy = self.AddEquity("SPY", Resolution.Minute).Symbol self.SetWarmUp(1, Resolution.Daily) self.yest_close = self.SMA(self.spy, 1, Resolution.Daily, Field.Close) """ Figure out universe selection error """ def OnData(self, data): if self.IsWarmingUp or not self.yest_close.IsReady or not len(data.Bars) > 0: return # If SPY is above yesterday's close at 9:45, go long all stocks in ticker_symbols if self.Time.hour == 9 and self.Time.minute == 45: for stock in self.portfolio_targets: price = self.Securities[self.spy].Price yest_close = self.yest_close.Current.Value if price < yest_close: self.SetHoldings(stock, 1/len(self.portfolio_targets)) if self.Time.hour == 15 and self.Time.minute == 45: self.Liquidate()