Navigation

    Backtrader Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    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

    General Code/Help
    backtraderv20 indicator sma warmup strategy
    3
    3
    246
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D
      developer last edited by

      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?

      vladisld 1 Reply Last reply Reply Quote 0
      • vladisld
        vladisld @developer last edited by

        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?

        1 Reply Last reply Reply Quote 2
        • run-out
          run-out last edited by

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

          RunBacktest.com

          1 Reply Last reply Reply Quote 0
          • 1 / 1
          • First post
            Last post
          Copyright © 2016, 2017, 2018, 2019, 2020, 2021 NodeBB Forums | Contributors