I think I started thinking about it for Bitcoins at some point, got to about where you are now, and never really figured it out.
Could somebody who really knows what they're doing explain how to do this?
Just set up a point in time and consider it as a day close. Same happens when going down - e.g. make hourly data from tick data: we just take hour's close as being 59 minutes 59 seconds, and next hour 0 minutes 0 seconds is the opening of a new hour (depends though, it might be that 0"0' would be hour's close and 0"1' would be opening of a new hour, would need to check in my app).