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.
- 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.
- When the buy is completed, immediately a sell SL order is placed in the notify_order() method.
- 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