Maybe you could run tick() once at the end of each bar? This will trigger the function upon the next incoming price tick (which should be the open of the new bar).