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



  • 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.



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


  • administrators

    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.



  • @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.


Log in to reply
 

});