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/

    Instant values of indicators solution

    Indicators/Strategies/Analyzers
    2
    2
    644
    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.
    • T
      turnyay last edited by

      Re: Instant values of indicators

      I'm creating a live data feed and was looking to see if there's already a solution to instant indicator values.

      For example:
      Strategy:
      Buy when: (1min_RSI < _buy_value) AND (30min_RSI < _buy_value)
      Sell when: (1min_RSI > _sell_value) AND (30min_RSI > _sell_value)
      CustomData:
      self.datas[0] = 1min data, self.datas[1] = 30min data
      Polls every 5s for data, but only calls _load_bar() every 1min.

      When next() is called in strategy, the 30min_RSI will stay the same value for 30 minutes. Is there an easy way to get the 'current' 30min_RSI every minute?

      (Also, I tried the solution in the thread above but had no luck )

      One solution i see would be to copy the 30min indicator and simulate the next value every minute, but was just looking to see if a solution was already found.

      Thanks,
      MT

      1 Reply Last reply Reply Quote 0
      • P
        Paska Houso last edited by

        I believe the solution was found long ago (actually implemented long ago). It's called *replay.

        • https://www.backtrader.com/docu/data-replay/data-replay.html
        1 Reply Last reply Reply Quote 1
        • 1 / 1
        • First post
          Last post
        Copyright © 2016, 2017, 2018, 2019, 2020, 2021 NodeBB Forums | Contributors