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.226 Tracking Error 0.162 Treynor Ratio 0 Total Fees $0.00 Estimated Strategy Capacity $0 Lowest Capacity Asset Portfolio Turnover 0% |
""" Algo Overview: Create Renko bars. 1) Trade in direction of last Renkobar. 2) close at next renko bar or at first reversal candle. Adding something for a direction bias could go a long way - volume could be used for reversals (see docs to add volume) https://www.quantconnect.com/docs/v2/writing-algorithms/consolidating-data/consolidator-types/renko-consolidators/renko-consolidators futures example: https://www.quantconnect.com/forum/discussion/6001/creating-renko-bars-from-futures-security-seems-broken/p1 """ # region imports from AlgorithmImports import * # endregion FUTURES_CONTRACT = Futures.Metals.Gold # FUTURES_CONTRACT = Futures.Metals.MicroGold class MeasuredYellowJaguar(QCAlgorithm): def Initialize(self): # Debug self.SetStartDate(2021, 3, 1) self.SetEndDate(2023, 3, 3) # self.SetStartDate(2023, 1, 1) # self.SetEndDate(2023, 3, 7) # Opto # self.SetStartDate(2018, 1, 1) # self.SetEndDate(2022, 12, 1) # OOS1 # self.SetStartDate(2022, 1, 1) # self.SetEndDate(2023, 3, 1) # Long Set # self.SetStartDate(2015, 1, 1) # self.SetEndDate(2023, 1, 1) self.SetCash(300000) # self.equity = self.AddEquity(EQUITY, Resolution.Minute) # Setup Futures Contract self.gc = self.AddFuture(FUTURES_CONTRACT, Resolution.Minute, dataNormalizationMode = DataNormalizationMode.Raw, dataMappingMode = DataMappingMode.LastTradingDay, contractDepthOffset = 0, extendedMarketHours=True) self.renkoConsolidators = {} # self.consolidator = TradeBarConsolidator(timedelta(minutes=60)) def OnData(self, data: Slice): self.gcPrice = self.gc.Price def RenkoBarHandler(self, sender, data): self.Debug(str(self.Time) + " RenkoBar ") def OnSecuritiesChanged(self, changes): for security in changes.AddedSecurities: consolidator = RenkoConsolidator(5) ## Create Renko consolidator consolidator.DataConsolidated += self.RenkoBarHandler ## Define the handler function self.SubscriptionManager.AddConsolidator(security.Symbol, consolidator) ## Add the consolidator to our main data handler self.renkoConsolidators[security.Symbol] = consolidator ## Add consolidator to the dictionary, indexed by symbol for security in changes.RemovedSecurities: consolidator = self.renkoConsolidators.pop(security.Symbol) ## Remove/assign consolidator self.SubscriptionManager.RemoveConsolidator(security.Symbol, consolidator) ## Remove the consolidator from our data handler to keep memory usage low consolidator.DataConsolidated -= self.RenkoBarHandler ## Remove handler function