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 doesn't write to csv

    General Code/Help
    2
    2
    476
    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.
    • S
      sfkiwi last edited by

      I am using the bt.Writer to write to a csv and already have my data feeds and indicators writing successfully to the file.

      I would now like to create some custom parameters, lets say for example (2 * close(-1) / volume), and have those output to the csv. I tried to create a LinePlotterIndicator in my strategy in the init function.

      pricevol = 2 * self.data.close(-1) / self.data.volume
      pv = bt.LinePlotterIndicator(pricevol, name='pricevol')
      pv.csv = True
      

      As you can see in the plot below, I am seeing the result of LinePlotterIndicator in red, but I'm also getting 10 other values that seem to be related to the LinesCouplers. I think the LinesCouplers are from using the PivotPoint indicator although I don't seem to be able to get rid of them even when I set plot=False on the PP indicator.

      0_1531901240217_Screen Shot 2018-07-18 at 10.03.58 AM.png

      In the csv file, I just see see 11 empty columns for pricevol

      0_1531901296404_Screen Shot 2018-07-18 at 10.07.39 AM.png

      How can I get the pricevol to output to the csv and just as one column instead of 11.

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

        LinePlotterIndicator is not a real indicator but a wrapper to show lines on the chart, hence the name.

        If you want the output, you should wrap the operations you want considered in indicator classes.

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