As mentioned before, it uses an approximation of Up and Down (because they are not kept by Tradingview/not accessible by Pinescript).
The approximation is:
The "up path" on the "up" candle can be approximated by ( High-Low ).
The "down path" on the "up" candle can be approximated by (High-Close)+(Open-Low).
(and similar for the down candle, like in the 1st post.)
Total path=up path + down path.
Up = Tick * up path/total path
Down = Tick * down path/total path
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 a publication is governed by House Rules. You can favorite it to use it on a chart.