Backtrader Community

    • 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/

    Using data feed name and line name in Indicator

    General Code/Help
    2
    2
    1066
    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.
    • M
      momentum last edited by

      Hi,

      I wonder whether I can use the data feed name and the line name passed as parameters within the Indicator class to retrieve the corresponding line.

      In a Strategy class I can do for example

      self.getdatabyname(self.params.data_name)._getline(self.params.line_name)
      

      I understand that I could pass either the actual data/line or data and line indices but I wonder whether there is something similar to the above for the indicator class.

      Thanks

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

        Indicators can take anything as a data feed, including other indicators and temporary line buffers created out of (for example) arithmetic operations, which of course immediately forbids something like getdatabyname

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