This is essentially the same as version 1 with one update. You have the freedom to independently choose OHLC for current candle and prior candle.
To elaborate further, Version 1 had 1 choice. For example, Close; you could only compare the close of prior candle to the current candle. Version 2; you can compare close of the current candle to the low of the prior candle.
In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.