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.913 Tracking Error 0.152 Treynor Ratio 0 Total Fees $0.00 Estimated Strategy Capacity $0 Lowest Capacity Asset |
# Bill Williams Fractal Indicator STOCK = 'QQQ'; class BillWilliamsFractal(QCAlgorithm): def Initialize(self): self.SetStartDate(2016, 6, 24) self.SetEndDate(2021, 11, 11) self.stock = self.AddEquity(STOCK, Resolution.Daily).Symbol def OnEndOfDay(self, symbol): H = self.History(self.stock, 5, Resolution.Daily)['high'] L = self.History(self.stock, 5, Resolution.Daily)['low'] upFractal = (L[-5] > L[-3] < L[-4]) and (L[-2] > L[-3] < L[-1]) dnFractal = (H[-5] < H[-3] > H[-4]) and (H[-2] < H[-3] > H[-1]) bull = 1 if upFractal else 0 bear = -1 if dnFractal else 0 self.Plot("Indicator", "bull", bull) self.Plot("Indicator", "bear", bear)