Overall Statistics |
Total Trades 184 Average Win 47.96% Average Loss -5.53% Compounding Annual Return 3011.257% Drawdown 86.200% Expectancy 2.721 Net Profit 11308.223% Sharpe Ratio 104.339 Probabilistic Sharpe Ratio 98.729% Loss Rate 62% Win Rate 38% Profit-Loss Ratio 8.68 Alpha 242.003 Beta 0.489 Annual Standard Deviation 2.321 Annual Variance 5.386 Information Ratio 104.201 Tracking Error 2.321 Treynor Ratio 495.114 Total Fees $18375.41 Estimated Strategy Capacity $4200000.00 Lowest Capacity Asset GME SC72NCBXXAHX |
# Ta-Lib Candlestick with RollingWindow import numpy as np import talib class TaLibCandlestick(QCAlgorithm): def Initialize(self): self.SetStartDate(2020, 1, 1) self.SetEndDate(2021, 5, 17) self.SetCash(100000) self.SetWarmUp(15) self.sym = self.AddEquity('GME', Resolution.Hour).Symbol self.rollingWindow = RollingWindow[TradeBar](15) self.Consolidate(self.sym, Resolution.Hour, self.CustomBarHandler) def OnData(self, data): if not self.rollingWindow.IsReady: return O = np.array([self.rollingWindow[i].Open for i in range(15)]) H = np.array([self.rollingWindow[i].High for i in range(15)]) L = np.array([self.rollingWindow[i].Low for i in range(15)]) C = np.array([self.rollingWindow[i].Close for i in range(15)]) pattern = [] pattern.append(talib.CDLBELTHOLD(O, H, L, C)) pattern.append(talib.CDL3INSIDE(O, H, L, C)) isPattern = False for l in pattern: if l.any() > 0: # self.Debug('Pattern found') isPattern = True break if isPattern: self.SetHoldings(self.sym, 1) else: if self.Securities[self.sym].Price < L[-2]: self.Liquidate(self.sym) def CustomBarHandler(self, bar): self.rollingWindow.Add(bar)