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/

    How to get cursor on chart to display time instead of date

    General Code/Help
    2
    3
    628
    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.
    • S
      Sagittarius19 last edited by

      Hello,

      Below i have a sample of my data, code and the chart i plotted. I need to be able to see precisely what time it is when i place my cursor on a spot on the chart. However it is just displaying the date on the bottom right next to "x =".

      Also how are the grid lines on the chart placed? I would like them to all be spaced with the same amount of time between each one.

      Thank you in advance!

      2018-03-14 09:47:01.307  41.0489  41.0489  41.0489  41.0489     300
      2018-03-14 09:47:01.310  41.0489  41.0489  41.0489  41.0489     100
      2018-03-14 09:47:01.310  41.0500  41.0500  41.0500  41.0500     100
      2018-03-14 09:47:01.568  41.0475  41.0475  41.0475  41.0475     100
      2018-03-14 09:47:01.931  41.0450  41.0450  41.0450  41.0450      50
      2018-03-14 09:47:02.130  41.0500  41.0500  41.0500  41.0500      10
      
       cerebro.plot(style = 'bar', bardown = 'black')
      

      0_1523896473437_d11370dd-5ba1-4933-8e1b-39f22d57e96f-image.png

      1 Reply Last reply Reply Quote 0
      • S
        Sagittarius19 last edited by

        Solved: i changed my code to:

         cerebro.plot(style = 'tick', bardown = 'black',fmt_x_data = ('%H:%M:%S'))
        
        1 Reply Last reply Reply Quote 1
        • B
          backtrader administrators last edited by

          Your problem is somewhere else:

          0_1524166599250_a6f6c96f-b7b9-406c-ba28-dcb085020f70-image.png

          You specify the wrong timeframe (1-day) for your data feed. The plotting code cannot know that and plots (and displays) according to the given timeframe

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