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

Plotting - candlestick charts and highlighting economic/news events

  • Hi, is it possible to plot the chart as a candlestick/bar chart instead of a line chart?

    Another question, I am trying to incorporate economic events/data into Backtrader. Any suggestions on how to feed the events into Backtrader, and is it possible to highlight bars where major data has been released? Thanks!

  • administrators

    There are some tens of samples plotting candlesticks and/or bars.

    Check here for the option style when plotting: Docs - Plotting

    You can extend a data feed to have extra data Docs - Extending a Data Feed which can be the P/E ratio like in that case or anything you like.

    To Plot the events the best options would be:

    • Creating an Indicator that only delivers a point when an economic event happens. Assign the high or the low and plot and arrow/triangle or other marker

    • The same but with an Observer. In this blog post, the triangles of the BuySell observer are changed to arrows Blog - Arrows for the BuySell Observer

      Your best option is to check the source for the BuySell observer or the Trades observer and plot the economic events instead of the operations/trades.

  • @kicking_potato88 hi did you find a good solution yet for plotting economic news events into Backtrader. I am trying to do the same.

Log in to reply