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

customized indicator plot problem

  • I customized an indicator , I wanted to plot it with main data, I wrote " =" but it doesn't work. please tell me the reason. Thank you !

  • Can you kindly include the full block of code and the error message in your question?

    @Sam said in customized indicator plot problem:

    it doesn't work. please tell me the reason not very informative.

  • class LeiDa(bt.Indicator):
    lines = ('zhuli', )

    def __init__(self):
    def next(self):
        dataclose =
        close_ma = talib.MA(np.array(dataclose), timeperiod=7, matype=0)
        temp = (dataclose[-20:] - close_ma[-20:]) / close_ma[-20:] * 480
        result = talib.EMA(temp, timeperiod=2) * 5
        self.zhuli[0] = result[-1:]

    class MyStrategy(bt.Strategy):

    def __init__(self):
        self.leida = LeiDa(
        self.leida.plotinfo.plotmaster =


  • @run-out Hi ,I just post my code, Can you help me? Why didn't my indicator plot with the main data? Thank you!

  • your price range is 240+, your indicator shows -1.43. diagram range is set by master, therefore you can't see the indicator. I suggest to show it on the separate plot since this is type of the oscillator.

  • @ab_trader Thank you!

Log in to reply