I am trying to identify the bar that closes below recent pull back bar. I can check close below previous bar using Ref() but can't seem to find close if there are more than one pullback bar. I have attached image for describing the scenario
In my opinion, the key here is how you define “recent pull back bar”? Recent would be something that happened in the last 5 candles, or 50?
You can have a look at the functions HHV and LLV, for when a new maximum or low is hit. Then writing a for loop to see if in a certain number of bars the price pullback below that level.
@ak87: no need for a loop in this case. Assuming you have identified the pullback bars, you can use BarsSince() to see how long it’s been since the most recent pullback.