Possible bug when using LinePlotterIndicator
Rubén Briones last edited by Rubén Briones
When I use the bt.LinePlotterIndicator the Strategy starts executing later than the period defined in params. I think that when we add the bt.LinePlotterIndicator, backtrader multiply by 2 the bars needed to start executing the strategy.
My code is:
class SMACloseSignal(bt.SignalStrategy): params = (('period', 30),) def __init__(self): signal = bt.indicators.CrossOver(self.data, bt.indicators.SMA(period=self.p.period)) self.signal_add(bt.SIGNAL_LONG, signal) signal_to_plot = self.data - bt.indicators.SMA(period=self.p.period) bt.LinePlotterIndicator(signal_to_plot, name='SMAsignal')
sksuram last edited by
@Rubén-Briones I am noticing a similar issue. Were you able to figure out a solution to this problem.
ratulb last edited by
Did either of you haven any luck with this? I also think I'm having a similar issue whereby I get a 'IndexError: array assignment index out of range' exception raised from linebuffer.py