@yerlin Yes, that depends on your definition of BE. For me, BE means what I show in the image. If you need to add some slippage, you can ad another additional condition blocks searching for that max distance.
Your structure is not searching at the past. It will only work from the present candle onwards. Searching loops to past candles are not trivial to do. Can't you find a custom indicator doing that job?
@yerlin Ok. Now I get it. In that case you need a loop searching for past fractal to meet those conditions. I'm afraid loops are not my strong point. Maybe mr. roar would be able to help. He's very good at it.
I had my first loop question just a couple days ago, also, and I've gotten some really good replies so far. I'm probably not the best to answer, but maybe my post will help you find some answers in the mean time?