We have a set of discretely sampled points that are on a sinusoid, in this case its period is 40:

If we have windows of different lengths that slide over this time series, like this little animation that I made, (and the amplitude is irrelevant)

which calculation would I have to make in order to get a maximum value if I make the calculation on the observations in the window that is of length of 1/4th the period of the sinusoid? So as the period in this example is 40, making the calculation on the last 10 observations will return the highest value, more than making the same calculation on the last 5 or the last 18 observations, no matter which step we are at in the "sliding process"?

The result of the calculation vs. the window length does not need to have a particular shape, although I would think it will be symmetrical. Also, the length of the window should probably be accounted for: after doing some mathematical calculations (for which I would appreciate your input), you should probably divide by the window length, so you can compare the result on the past 39 observations to the result on the past 2, and still the calculation on the observations from a window length of 10 (in this example) would return the maximum value. Thank you.