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/

    Determine if last data candle

    General Code/Help
    1
    2
    797
    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
      deepak singh negi last edited by

      Hi,
      I want to know if there is a way to know if the current call to "next" within a ''strategy' is its last call. i.e. the current candle is the last candle.
      I am using filters on the input data so I am unable to pre-calculate the length of data.
      I think my only option is to calculate it inside "next" function, but i am unable to get the total number of candles after the filters are applied.

      Thanks in advance.

      1 Reply Last reply Reply Quote 0
      • D
        deepak singh negi last edited by

        I figured that "len(self.data.close.array) " returns the length of the candles, and I can use that.

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