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



  • 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



  • Solved: i changed my code to:

     cerebro.plot(style = 'tick', bardown = 'black',fmt_x_data = ('%H:%M:%S'))
    

  • administrators

    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


Log in to reply
 

Looks like your connection to Backtrader Community was lost, please wait while we try to reconnect.