For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/
2019-10-02: The community is currently in read-only mode

Why does backtrader print two charts?



  • Hey guys, new to backtrader (looks awesome btw). I'm trying to get the daily chart of my one minute data but for some reason it prints two charts and I only want one? Any ideas why that is and how to fix? I have attached a picture and my code below. Cheers.
    alt text

    import backtrader as bt
    import pandas
    
    
    cerebro = bt.Cerebro(optdatas=True, optreturn=True)
    # 1 minute data
    df = pandas.read_parquet('DIESELCMDUSD')
    data = bt.feeds.PandasData(dataname=df)
    
    cerebro.resampledata(data, timeframe=bt.TimeFrame.Days)
    
    cerebro.adddata(data)
    
    cerebro.run()
    cerebro.plot(style='candle', volume=False)
    


  • @student you added two data feeds, so bt shows two pictures. To fix it you need first to show correct time frame for your 1 minute data feed and second set plot=False.

    Check out Data feeds and Plotting options


Log in to reply
 

});