Inside Bar Scanner Bug..?

Hello ,

I have made a basic scanner which simple checks whether an inside bar has formed on 15 min candle which just closed. But sometimes, it is giving me false alerts.
Eg the screenshots below, why did i get this alert on BharatFin when the inside bar was formed 2 bars back and not the immediately closed bar. Kindly see the last 3 bars , the alert was provided to me based on 3 bar from last when it should be provided based on 2nd bar from last. Please see the code as well as chart and please help me understand what am I doing or interpreting wrong??

It is not a bug, as you have selected 15 minute candle and scanner will check your condition based on LTP prices and as the repainting of the candle happens, there may be the change of getting the signals when ever the condition met while repainting of current candle.

Today I found this scanner and the result are correct

https://scanners.streak.tech/scanner/bearish-inside-bar