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

Walk Forward Analysis Demonstration

  • Huzzah! FINALLY I can do a walk-forward analysis, thanks to backtrader. I wrote a blog post demonstrating how to do this (along with a motivation, or why we may want this type of analysis and what it's for) here:

    The post should be enough for now, but if I could make a feature request, I think @backtrader could probably write a built-in method for walk-forward analysis that does basically what I did, but better (faster, or with better syntax maybe). If not, though, that's fine; the loop I wrote is good enough for me.

  • administrators

    Impressive post. To be analyzed

  • @Curtis-Miller nice job, any new work on this?

  • This is really cool. It would be really neat to get Walk forward optimization and genetic solver (using optunity) combined into one supported by backtrader.

    thinking more about the interface, maybe it makes sense to introduce a new method in cerebro to setup genetic optimization (since it only needs lower/upper boundaries and only works for doubles, maybe something like:)

    cerebro.genoptaddstrategy(Strategy, sma1=[3,15], sma2=[5,25])

    and then run could be modified to use optinuity (optionally using pmap argument to use multiprocessing).

    To support WFO, perhaps a new method could be added as well called walkforward(...).

    I'll probably try to code this up as and when I get some time and send in a pull request if I can make it happen and if its ok with you?