Not sure but this change would have been shared somewhere in this thread already
Your code (the one you had posted) is tracking the intraday bar with the lowest volume on it as significant PA
the small change I made was instead of the bar with smallest Volume we are looking at the one with Highest Volume
All these ideas, and many more, were presented by the OP of this thread
But its to your credit that you are trying to use them and improvising
All the best
.