For converting price to pips you must divide by PIP, not multiply. And for candle height you must subtract H-L, not add. Also use var instead of int.

How to use printf, read the tutorial, its on the first page.