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/

    Indicator invoke question

    Indicators/Strategies/Analyzers
    2
    2
    586
    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.
    • A
      asuralm last edited by

      Hi:

      Indicators in BT is instantiated in the init method, if I want to make the decision to use a certain indicator at run time, is there a way to do the indicator calculation in the next() method without declaration in init? The plotting is not a problem to me. What I need is that I can switch different indicators at different conditions.

      Thanks

      1 Reply Last reply Reply Quote 0
      • B
        backtrader administrators last edited by

        No. Because the indicator needs to be calculated for each bar (set) of prices.

        Instantiate all indicators you may need and let your logic choose which one counts when it comes down to making a decision.

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