Backtrader Community

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    1. Home
    2. ssb
    For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/
    S
    • Profile
    • Following 2
    • Followers 0
    • Topics 1
    • Posts 2
    • Best 0
    • Controversial 0
    • Groups 0

    ssb

    @ssb

    0
    Reputation
    1
    Profile views
    2
    Posts
    0
    Followers
    2
    Following
    Joined Last Online

    ssb Unfollow Follow

    Latest posts made by ssb

    • RE: Indicator Repaint

      @ssb @backtrader Can you answer this pls?

      posted in Indicators/Strategies/Analyzers
      S
      ssb
    • Indicator Repaint

      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

      posted in Indicators/Strategies/Analyzers
      S
      ssb