Navigation

    Backtrader Community

    • Register
    • 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/

    LinePlotterIndicator - how to change color, line width etc.?

    General Code/Help
    2
    7
    2204
    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.
    • D
      deedy last edited by

      I have a custom indicator with several lines. One of the line I would like to plot in a separate subplot.

      I can do it using the SMA trick where I create a new instance of an SMA indicator then pass in my line.

      I can also use the LinePlotterIndicator method.

      My question is - how can I change line colour / plot type etc.?

      Many thanks

      1 Reply Last reply Reply Quote 0
      • B
        backtrader administrators last edited by

        Docs - Plotting - Section: Line specific plotting options

        1 Reply Last reply Reply Quote 0
        • D
          deedy last edited by

          I've already checked that

          1 Reply Last reply Reply Quote 0
          • B
            backtrader administrators last edited by

            If you have checked that, what's missing? Unless you are a bit more specific ... adding some code with your own attempt at something does usually help.

            1 Reply Last reply Reply Quote 0
            • D
              deedy last edited by deedy

              So I have this in my strategy:

              my_indicator = bt.LinePlotterIndicator(self.indicator.my_indicator_line, "ABC")

              ...and I don't know where to interface with this thing to tell it I want a green histogram

              1 Reply Last reply Reply Quote 0
              • B
                backtrader administrators last edited by

                A LinePlotterIndicator is only meant to be an aid for quickly plotting a line. If you really want to customize it, you should go for a custom indicator in which you can define all properties of a line using plotlines

                class MyCustomIndicator(bt.Indicator):
                    lines = ('abc',)
                    plotlines = dict(abc=dict(ls='--'))
                

                As indicated in Docs - Plotting - Section: Line specific plotting options, customizations like line colors or line style (like in the above example) are from matplotlib and you have to refer to its documentation.

                1 Reply Last reply Reply Quote 0
                • D
                  deedy last edited by

                  @backtrader said in LinePlotterIndicator - how to change color, line width etc.?:

                  Line specific plotting options, customiz

                  thank you 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