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

Save out indicator values into a dataframe

  • Hi all,

    I am new to this powerful tool and trying to get myself familiar with its use. I developed a self-defined indicator in cerebro and I would like to have it saved into a new dataframe. Also I would like to ask how to adjust the height of the indicator subplot for it ? Is there a way to achieve that? Thanks!


  • Hi Will,
    I am not sure exactly what you want but if you are looking to play around with plotting, you can see some of the options here:

    Note that Backtrader uses matplotlib for plotting so you should find the plotting quite flexible.

    Can you elaborate a bit more on what you mean when you say that you would like to save it to a new dataframe?

  • Thanks for the answer!

    As for the indicator, I mean I develop a self-defined indicator in the cerebro engine. It can be plotted properly in the final graph. But I would like to look deeper into the indicator values during the backtest process.

    As for now, I can only inspect them from plot and not sure on whether they are precisely calculated. Besides, the subplot for the indicator is quite narrow to see them clearly. The first idea came to me is to output the indicator values during the test period along with price data into a dataframe to inspect them. Is there a way to do it?

    Hope I can find help here! Thanks!

Log in to reply

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