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/

    Indicator Repaint

    Indicators/Strategies/Analyzers
    1
    2
    152
    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.
    • S
      ssb last edited by

      My strategy uses two TFs- 5m for calculating the Indicator, 1m for taking entry and exits. In the notify_order() method in MyStrategy whenever a buy is successful I am immediately creating an SL order.

      1. Suppose MyIndicator(5m TF) calculated a signal to buy above 12:45 candle. So in the next() method of MyStrategy I would place a buy SL order above 12:45 candle. At 12:48 the price goes above 12:45 candle and the buy SL order is completed.
      2. When the buy is completed, immediately a sell SL order is placed in the notify_order() method.
      3. Here is the problem. MyIndicator runs in a 5m TF. So at 12:48 the indicator hasn't yet calculated.

      What I need?
      I want MyIndicator to compute based on whatever value is there in the latest 5m bucket. A new bucket starts at 12:46 and ends at 12:50. At 12:46 the indicator should just take in 12:46 data. Likewise, at 12:47 the indicator should repaint based on the value of 12:47 considering the high and low of 12:46.
      12:45 -> bucket ends
      12:46 - 12:50 -> new bucket
      At 12:46 - MyIndicator([12:46]) -- Indicator paints for the first time
      At 12:47 - MyIndicator([12:46 - 12:47]) -- should repaint based on 12:47
      At 12:48 - MyIndicator([12:46 - 12:48]) -- should repaint based on 12:48

      Hope I can get some help here. Thanks

      S 1 Reply Last reply Reply Quote 0
      • S
        ssb @ssb last edited by

        @ssb @backtrader Can you answer this pls?

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