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/

    Multi Data Feed Plotting Issue

    General Code/Help
    2
    4
    705
    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.
    • Michael Scofield
      Michael Scofield last edited by

      Hi guys, I was wondering if someone can give me some advice for plotting multiple data feed within same axis.

      So I have two data feeds : Bid & Ask and I can plot each of them separately like below :
      0_1553603909648_1.png

      But if I choose to set something like : ask_data.plotinfo.plotmaster = bid_data before adding into cerebro, then after I run the backtest it will look like this :
      0_1553604006894_2.png

      They overlapped and only ask data remains (top-left corner).

      How to prevent this problem ? I want to plot them on the same axis without overlapping each other. And show both data's details on the top-left corner.

      Thank you.

      1 Reply Last reply Reply Quote 0
      • Michael Scofield
        Michael Scofield last edited by

        @backtrader
        Can you help with this? Or give me some suggestion please?

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

          Only the legend is not plotted, but this is something that is not easy to account for, given the inner workings of matplotlib.

          Both the bid and the ask are plotted on the same axis and one can clearly see both, close to each other but separate.

          @michael-scofield said in Multi Data Feed Plotting Issue:

          I want to plot them on the same axis without overlapping each other

          I fail to understand your expectation. They are not overlapping, they are close to each other, which is what one would expect when plotting to things with a very similar price on the same axis.

          Michael Scofield 1 Reply Last reply Reply Quote 0
          • Michael Scofield
            Michael Scofield @backtrader last edited by

            @backtrader

            Hey thank you for replying.

            @backtrader said in Multi Data Feed Plotting Issue:

            I fail to understand your expectation. They are not overlapping, they are close to each other, which is what one would expect when plotting to things with a very similar price on the same axis.

            I am not saying those lines are overlapped. I said :

            They overlapped and only ask data remains (top-left corner).

            I mean those numbers on top-left corner. Sorry for confusing.

            I want to show both bid and ask data feed's details on top-left corner, something like this:

            sma_bid_open  (15) 1.20
            sma_bid_high  (15) 1.20
            sma_bid_low   (15) 1.20
            sma_bid_close (15) 1.20
            bid_data (1 Min) O :1.20 H : 1.20 L : 1.20 C : 1.20
            
            sma_ask_open  (15) 1.20
            sma_ask_high  (15) 1.20
            sma_ask_low   (15) 1.20
            sma_ask_close (15) 1.20
            ask_data (1 Min) O :1.20 H : 1.20 L : 1.20 C : 1.20
            

            Can it be done? If so, how?

            Also I want to ask can I set both cheat-on-open and cheat-on-close to True ?
            I mean like this : cerebro.broker.set_coc(True) and cerebro.broker.set_coo(True) at the same time.

            Again, thank you for your reply.

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