Hi All, 

I have been trying to use the ATR indicator value in the RenkoConsolidator for the brick size input. I keep getting error messages including ones that say that ‘Renko consolidator BarSize must be strictly greater than zero’.

Can anyone shed some light on this? Thanks :) 

from AlgorithmImports import *

from QuantConnect.DataSource import *


 

class TrendlineRSI(QCAlgorithm):


 

    def Initialize(self):

        self.SetStartDate(2015, 10, 6)

        self.SetCash(10000)

        self.ticker = self.AddEquity("SPY", Resolution.Minute)        

        self.rsi = self.RSI(self.ticker.Symbol, 10, Resolution.Minute)


 

        self.lastrsi = {}


 

        self.TREND = self.SMA(self.ticker.Symbol, 30, Resolution.Daily)

        self.SetWarmup(43200)  # 30 days in minutes


 

        self.atr = self.ATR(self.ticker.Symbol, 14, MovingAverageType.Simple)


 

        self.brick = {}


 

        self.consolidator = RenkoConsolidator(self.brick)

        self.consolidator.DataConsolidated += self.OnDataConsolidated

        self.SubscriptionManager.AddConsolidator(self.ticker.Symbol, self.consolidator)


 

    def OnData(self, slice):

        if self.atr.IsReady:

            self.brick[self.ticker.Symbol] = self.atr.Current.Value

            self.consolidator.Update(self.brick)


 

    def OnDataConsolidated(self, sender, RenkoBar):

        if self.IsWarmingUp:

            return

        if not self.ticker.Close > self.TREND.Current.Value:

            return


 

        if self.ticker.Symbol not in self.lastrsi:

            self.lastrsi[self.ticker.Symbol] = self.rsi.Current.Value


 

        if self.lastrsi[self.ticker.Symbol] < 29 and self.rsi.Current.Value > 29:

            quantity = self.CalculateOrderQuantity(self.ticker.Symbol, 0.9)

            self.MarketOrder(self.ticker.Symbol, quantity)

            self.TrailingStopOrder(self.ticker.Symbol, -quantity, 0.007, True)


 

        self.lastrsi[self.ticker.Symbol] = self.rsi.Current.Value