Overall Statistics |
Total Trades 56 Average Win 34.87% Average Loss -1.72% Compounding Annual Return 28.223% Drawdown 26.800% Expectancy 5.832 Net Profit 470.619% Sharpe Ratio 0.984 Probabilistic Sharpe Ratio 36.178% Loss Rate 68% Win Rate 32% Profit-Loss Ratio 20.26 Alpha 0.136 Beta 0.711 Annual Standard Deviation 0.22 Annual Variance 0.048 Information Ratio 0.525 Tracking Error 0.198 Treynor Ratio 0.304 Total Fees $113.73 Estimated Strategy Capacity $260000000.00 Lowest Capacity Asset AMZN R735QTJ8XC9X |
# region imports from AlgorithmImports import * # endregion class CGPT(QCAlgorithm): def Initialize(self): self.SetStartDate(2015, 1, 1) # Set Start Date self.SetEndDate(2022, 1, 1) # Set End Date self.SetCash(10000) # Set Strategy Cash self.symbol = self.AddEquity("AMZN", Resolution.Daily).Symbol lookback = 50 self.SetWarmup(100) self.rolling_closes = RollingWindow[float](lookback) self.sma = self.SMA(self.symbol, 200) def OnData(self, data: Slice): if data.ContainsKey(self.symbol) and data[self.symbol] is not None: self.rolling_closes.Add(data[self.symbol].Close) if (self.rolling_closes.Count < 50) or self.IsWarmingUp: return momentum = self.rolling_closes[0] - self.rolling_closes[49] entry = momentum > 0 if entry: self.SetHoldings(self.symbol,1,tag='Momentum > 0') elif self.rolling_closes[0] < self.sma.Current.Value: self.SetHoldings(self.symbol,0,tag='Price below SMA')