Thank you for your comment.
The logic to calculate the optimum window size. First, we divide the data into training and testing. We try different window sizes 10, 20, 30 etc. E.g.
Window size 10: t1,....,t10 for foreacst 1, t2,....,t11 for forecast 2 etc.
window size 20: t1,...., t20 for...