Bearish candles to close the operation.

 
Is there any good Samaritan with a big heart who can help me with how to do this? The image speaks for a thousand words, but what I need is that when I open a position, in this case, Sell, if the price moves in favor, it should count the bearish bars. However, if a bullish bar appears, it should not count it until another bar surpasses the price, in this case, bar 3, and so on until reaching bar 5 to close the operation once it is confirmed as bearish.

Thank you.

 

So, you need for example 5 bearish bars, to close the sell position in profit? And it must not be 5 bearish bars in a row, some bull bars can be between it? Correct?

Do you need the code or advice how to realise this?

 

And as I understand every next bear bar, must have closing price lower then previous counted bearish bar, correct?

 
Lazar Buga #:

And as I understand every next bear bar, must have closing price lower then previous counted bearish bar, correct?

Exactly, it should have a closing price lower than the previously counted bearish bar, just as you indicate in the image.

If you have that piece of code, I would greatly appreciate it, or if not, suggest an idea. I'm not really good at this, but I've tried many ways and haven't been able to do it.

Reason: