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

help with line coupling

  • Hi,

    I am trying to couple some data passed to the indicator i.e. coupling based on the clock created from the first data passed. The following works in the sense that signal2 is the coupled version to the clock based on datas[0]. However, I guess there must be a better way to achieve this i.e. without creating signal1 that is not needed.


    class NaiveIndicator(bt.Indicator):
        lines = ('signal1','signal2',)
        def __init__(self):
            self.lines.signal1 = self.datas[1]
            self.lines.signal2 = self.lines.signal1()
    cerebro.addindicator(NaiveIndicator, cerebro.datasbyname["Data0"], cerebro.datasbyname["Data1"], cerebro.datasbyname["Data2"])

  • administrators

    Try self.data1()

Log in to reply