Backtrader Community

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/

    How to skip the plot of some datas in a mutidata strategy

    General Code/Help
    2
    3
    211
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • weibudda
      weibudda last edited by

      In an indicator development, simply adding a _plotskip=True command, can skip the plot of a specific line. But how to skip the plot of some datas in a mutidata strategy?
      I have tried the following, but it does not work? data_0 and data_1 are still plotted. Any suggestions?

      data_0 = bt.feeds.PandasData(dataname=data_index, tz=tz_cn)
          data_0.plotinfo._plotskip = True
          cerebro.adddata(data_0)
          data_1 = cerebro.replaydata(data_0, timeframe=getattr(bt.TimeFrame, 'Weeks'))
          data_1.plotinfo._plotskip = True
      
      run-out 1 Reply Last reply Reply Quote 0
      • run-out
        run-out @weibudda last edited by

        @weibudda said in How to skip the plot of some datas in a mutidata strategy:

        data_0 = bt.feeds.PandasData(dataname=data_index, tz=tz_cn)
        data_0.plotinfo._plotskip = True
        cerebro.adddata(data_0)

        I have an answer for you but it might not be the best one. I don't use the built in plotting very much. So someone else may have a more backtrader proper answer.

        That all said, you can set the attribute directly after creating data_0.

        data_0.plotinfo.plot = False
        

        I think you need at least one dataline plotting for the chart to execute.

        RunBacktest.com

        weibudda 1 Reply Last reply Reply Quote 1
        • weibudda
          weibudda @run-out last edited by

          @run-out said in How to skip the plot of some datas in a mutidata strategy:

          data_0.plotinfo.plot = False

          Problem has been solved, thanks very much!

          1 Reply Last reply Reply Quote 0
          • 1 / 1
          • First post
            Last post
          Copyright © 2016, 2017, 2018, 2019, 2020, 2021 NodeBB Forums | Contributors