I have seen many convoluted ways to do it and it seemed none were satisfactory, here is a simple statement that works for me.
RoundedValue = Math.Round(RawValue/TickSize) * TickSize
If you need to "Tick up" or "Tick down" substitute Math.Floor or Math.Ceiling.
Comment