For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See:

How many previous days/candles 'High' is broken as soon as we encounter a Open=High Candle?

  • I am stuck on how to calculate the no. of previous days/candles 'High' is taken out, as soon as we encounter a Open=High day/candle. There is no fixed period (no. of days/candles). No. of such previous days/candles are dynamic but at-least 1. I am confused in writing the code as I don't know where to check this (i.e. if i make an Indicator, should I check it there or in my Strategy class). Moreover, I am confused with the flow of backtrader. I read the documentation but still it's quite confusing.

  • You should consider trying simple examples until you get the concepts and then tackle the strategy you want to execute here. This forum it's difficult to back up and give you the entire lesson of backtrader. Dive into the manuals and once you are ready, tackle your code. Then we will help you solve your problems. It takes time.

Log in to reply