For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See:

Predefined signal which compares previous values

  • I have coded a signal, is there any way to compare previous values sticking to self.signal_enter in init?
    I get error IndexError: array index out of range

    def __init__(self, **kwargs): = bt.ind.Stochastic(, period=14, period_dfast=3, period_dslow=3)
         self.signal_enter =[-2] >[-3]
    def next(self):
        if self.signal_enter:

Log in to reply