Indicator invoke question



  • 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


  • administrators

    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.


Log in to reply
 

Looks like your connection to Backtrader Community was lost, please wait while we try to reconnect.