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/

    How to plot open and close prices together

    General Discussion
    2
    4
    583
    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
      Santhosh last edited by

      By default Backtrader plot close price on chart, I like to see open and close price lines together on plot.

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

        Use a 2nd data feed in which you use the open price of your main data feed as the close price.

        You can then plot both data feeds on the same axis.

        S 1 Reply Last reply Reply Quote 0
        • S
          Santhosh @backtrader last edited by

          @backtrader Thanks, Could you provide code sample if you have. I could't find samples of two feed from same data stream.

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

            There are some uses of clone there, but it basically comes down to either of these:

            Option A

            • You use GenericCSVData or PandasData. You can tell those feeds in which part of the original data the close and open prices are. Open a 2nd stream and play with the config - See Docs - PandasData Example and Docs - Datafeed Reference

            Option B

            • You can clone the existing data (with the method clone)
            • Add a filter and manipulate the open price to be the close price - See Docs - Filters
            1 Reply Last reply Reply Quote 0
            • 1 / 1
            • First post
              Last post
            Copyright © 2016, 2017, 2018, 2019, 2020, 2021 NodeBB Forums | Contributors