std66, I keep cumulative ticks and calculate measures and bars from it.Constants are the same as in your code. Missunderstood why you want to calculate ticks if they are given in data.