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/

    Read the customer indicator value

    General Code/Help
    2
    3
    93
    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
      adrianyuen last edited by

      I'm a newbie to Backtrader and just developed my first custom indicator (I mainly follow the samples at https://community.backtrader.com/topic/2145/full-example-of-custom-indicator/5)

      However, when I try to compare indicator values, e.g. lazy is my custom indicator, and I try to compare the values of itself one units ago, i.e.

          self.lazy(-1)>self.lazy(0)
      

      I got the following error message:

      bool should return bool, returned LineOwnOperation

      I know the custom indicator is actually a line object. How can I get the value of it?

      1 Reply Last reply Reply Quote 0
      • R
        rajanprabu last edited by

        I think you are using wrong brackets. Have a look at delayed indexing. If you are doing this in next section use square brackets. Its all guess as information given is no enough to debug.

        1 Reply Last reply Reply Quote 1
        • A
          adrianyuen last edited by

          Thank you, rajanprabu. You're right, I'm using a wrong bracket...

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