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 -2.499 Tracking Error 0.095 Treynor Ratio 0 Total Fees $0.00 Estimated Strategy Capacity $0 Lowest Capacity Asset |
class FocusedAsparagusBeaver(QCAlgorithm): def Initialize(self): self.SetStartDate(2021, 3, 13) # Set Start Date self.SetCash(100000) # Set Strategy Cash self.symbolData = {} self.AddUniverse(self.MyCoarseFilterFunction) def MyCoarseFilterFunction(self, coarse): sortedByDollarVolume = sorted(coarse, key=lambda x: x.DollarVolume, reverse=True) filtered = [ x.Symbol for x in sortedByDollarVolume if x.Price > 10 and x.DollarVolume > 10000000 ] return filtered[:5] def OnSecuritiesChanged(self, changes): for added in changes.AddedSecurities: self.symbolData[added.Symbol] = SymbolData(self, added.Symbol) for removed in changes.RemovedSecurities: if removed.Symbol in self.symbolData: del self.symbolData[removed.Symbol] def OnData(self, data): for symbol, symbolData in self.symbolData.items(): self.Plot("My Indicators", f"{symbol.Value} Hull Moving Average", symbolData.hma.Current.Value) self.Plot("My Indicators", f"{symbol.Value}Ichimoku Kinko Hyo", symbolData.ichimoku.Current.Value) class SymbolData: def __init__(self, algo, symbol): # initialize the indicators self.hma = HullMovingAverage(12) self.ichimoku = IchimokuKinkoHyo(9, 26, 26, 52, 26, 26) # warm up history = algo.History(symbol, 52, Resolution.Hour) for bar in history.itertuples(): tradeBar = TradeBar(bar.Index[1], bar.Index[0], bar.open, bar.high, bar.low, bar.close, bar.volume) self.hma.Update(bar.Index[1], bar.close) self.ichimoku.Update(tradeBar) # subscribe to auto update algo.RegisterIndicator(symbol, self.hma, Resolution.Hour) algo.RegisterIndicator(symbol, self.ichimoku, Resolution.Hour)