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

Run strategy only once indicators are warmed up



  • I have written a strategy that relies on a 200-day SMA. Therefore, during the first 200 days in my strategy, this indicator simply is not available.
    How can I make it that backtrader only runs my strategy once it has gathered the data for 200 days so that my SMA 200 indicator is available?



  • AFAIU this is a default Backtrader behavior. The indicators usually define their period such that the strategy will not get its next method called unit enough bars will be fetched to satisfy the indicators period.

    Are you experiencing a different behavior?



  • @vladisld is correct. You can find the description of this behaviour here.



});