For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/

Grouping days three ways



  • I am pretty new to Backtrader, so I suspect this would be fairly easy for an expert. I am trying to plot multiple versions of the same candlestick chart and apply the same indicator to all plots.

    The first plot should be simply daily bars, along with a custom indicator in a subplot. I was able to accomplish this:
    0_1538350508585_60d792d2-0827-48d0-861c-69ca1a550628-image.png

    I added a second plot that is supposed to be the same daily bars resampled into three-day bars:

    `

    cerebro.adddata(data, name=datalist[i][1])
    cerebro.resampledata(data, name='3 Day', timeframe=bt.TimeFrame.Days, compression=3)
    

    However, this does not result in what I expect to see, which is one bar in the second plot for every three bars in the first plot. So that's my first question, is why isn't resampling resulting in one-third as many bars? How am I ending up with one bar in the second chart for each bar in the first chart?

    0_1538351063327_e6e966c9-5efc-44e3-8470-27384f378802-image.png

    My next question is how can I apply the same indicator to the second plot that I've applied to the first plot? I want to see the same subplot under the second candlestick chart that I have on the first chart.

    And, finally, I noticed that when I zoom on one chart, the Y-axis gets resized to match the data that was zoomed on, but the other chart has the original Y-axis zoom, leaving the candlesticks very flat. Is there a way to keep the zoom consistent between the charts?

    Thank you for any guidance for this newbie!



  • Nothing?



  • 0_1538778311231_a572c3bb-2ec2-459c-8703-8f55af1fce2a-image.png


  • administrators



  • Thank you for the update, @backtrader ! That restored my confidence and fixed my first problem.

    The other two problems remain, though...

    @tradeunafraid said in Grouping days three ways:

    My next question is how can I apply the same indicator to the second plot that I've applied to the first plot? I want to see the same subplot under the second candlestick chart that I have on the first chart.

    And, finally, I noticed that when I zoom on one chart, the Y-axis gets resized to match the data that was zoomed on, but the other chart has the original Y-axis zoom, leaving the candlesticks very flat. Is there a way to keep the zoom consistent between the charts?

    0_1539547615446_d4338679-4801-4a10-a696-60f577b6c8db-image.png


  • administrators

    @tradeunafraid said in Grouping days three ways:

    My next question is how can I apply the same indicator to the second plot that I've applied to the first plot?

    Apply the indicator to the second data in the system.

    @tradeunafraid said in Grouping days three ways:

    And, finally, I noticed that when I zoom on one chart, the Y-axis gets resized to match the data that was zoomed on, but the other chart has the original Y-axis zoom, leaving the candlesticks very flat. Is there a way to keep the zoom consistent between the charts?

    You have to talk to the matplotlib developers.