Calculating window start and end pointers in window batch