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/

    Only Close data being plotted

    General Code/Help
    2
    3
    78
    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.
    • G
      Gleetche last edited by

      Hi,

      I am trying to plot Open,High,Low,Close using GenericCSVData, but all I get is the close being plotted as a line.

      035f7064-7b33-4473-adc8-9b6910b2e282-image.png

      Here's a line of code of the csv:

      1577836800.0,7195.24000000,7196.25000000,7178.64000000,7179.78000000,95.50913300,1577837099999,686317.13625177,1127,32.77324500,235537.29504531,0
      

      Here's my code:

      import backtrader as bt
      
      cerebro = bt.Cerebro()
      
      data = bt.feeds.GenericCSVData(dataname='data/1jan2020.csv', dtformat=2)
      
      cerebro.adddata(data)
      
      cerebro.run()
      
      cerebro.plot()
      

      How do I plot the open,high,low,close too like :

      4c6e16cc-b150-4627-8d7f-d721f374d77b-image.png

      1 Reply Last reply Reply Quote 0
      • R
        rajanprabu last edited by

        You need to instruct cerebro to plot candlestick. Use cerebro.plot(style='candlestick').

        G 1 Reply Last reply Reply Quote 1
        • G
          Gleetche @rajanprabu last edited by

          @rajanprabu thanks!

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