The link does not work.
Can you perhaps clarify "dynamic windows" and "windows get reset"? It is not clear what that could mean.
In Esper I have found an example in the docs in "4.2.6.1. Distinct Events for the Initiating Condition" and rewrote this for you what may match the somewhat fuzzy requirements:
create context Flight initiated by distinct(flightId) FlightEVent
terminated after 5 seconds; // you don't mention when to throw a flight away
context Flight select avg(speed) from FlightEvent.win:length(5);