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/

    Plotting a LinesOperationObject

    General Code/Help
    4
    5
    200
    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.
    • O
      oldmonk last edited by

      Apologies if this has been mentioned in the docs (I couldn't find it), but how do I plot a LinesOperation object that I create within a strategy? For instance, I created a zscore object using two other lines, and I want to plot it. This is what I tried:

      self.zscore = self.spread / self.stdev
      self.zscore.plotinfo.plot = True
      

      where self.spread and self.stdev are two lines created previously.

      I get the following error: AttributeError: 'LinesOperation' object has no attribute 'plotinfo'.

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

        The end of this might help.

        1 Reply Last reply Reply Quote 0
        • E
          eric2020 last edited by

          exactly same question

          1 Reply Last reply Reply Quote 0
          • E
            eric2020 last edited by

            So far it needs to create a new indicator for zscore and plot it

            1 Reply Last reply Reply Quote 0
            • Yaroslav Horyslavets
              Yaroslav Horyslavets last edited by

              Firstly: "lines objects from operations DO NOT GET plotted (like close_over_sma = self.data.close > self.sma)"
              Second: "There is an auxiliary LinePlotterIndicator which plots such operations if wished with the following approach:"
              And the example:

              close_over_sma = self.data.close > self.sma
              LinePlotterIndicator(close_over_sma, name='Close_over_SMA')
              
              enjoy:)
              1 Reply Last reply Reply Quote 0
              • 1 / 1
              • First post
                Last post
              Copyright © 2016, 2017, 2018 NodeBB Forums | Contributors
              $(document).ready(function () { app.coldLoad(); }); }