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

Daily return (P&L) of total broker value



  • Dear Backtrader community,

    I replicated the quickstart example with the SMA indicator (chapter: "adding an indicator"), and it works perfectly. Backtrader is awesome, so thanks to everybody who contributed to this project and the great documentation!

    I would now like to better understand the return characteristics of the strategy, and would therefore like to access the daily returns ("PnL") of the strategy (=total broker value of active positions and cash combined). The final idea would be to plot a histogram of the daily returns of the strategy and compare it with the returns of just "buy-and-hold"-ing the asset, similar to this plot: http://www.cboe.com/publish/histogram-charts/1012-BFLY.png

    So far I could only find the absolute value of the broker (using "broker.getvalue()") but not the daily returns (= daily percentage change of the absolute value).

    Could anybody indicate where the returns are stored/how I can access them? I couldn't find that in the documentation nor the forum...

    Your help would be highly appreciated!

    Thanks,
    jf


  • administrators

    You have to plug in an analyzer.

    You probably want to read this post:



  • ok great, thanks!