This python script make candles from ticks CSV file. But this is old way, now is better use the Pandas ( ohlc fce ).

I thinking first question not howto convert tick to candles but how many times tick go up/dn during H1 candle