This article presents a new method to identify the main patterns describing the flow motion in complex flows. The algorithm is an extension of the higher-order dynamic mode decomposition (HODMD), which compresses the snapshots from the analysed database and progressively updates new compressed snapshots on-the-fly, so it is denoted as HODMD on-the-fly (HODMD-of). This algorithm can be applied in parallel to the numerical simulations (or experiments), and it exhibits two main advantages over offline algorithms: (i) it automatically selects on-the-fly the number of necessary snapshots from the database to identify the relevant dynamics; and (ii) it can be used from the beginning of a numerical simulation (or experiment), since it uses a sliding-window to automatically select, also on-the-fly, the suitable interval to perform the data analysis, i.e. it automatically identifies and discards the transient dynamics. The HODMD-of algorithm is suitable to build reduced order models, which have a much lower computational cost than the original simulation. The performance of the method has been tested in three different cases: the axi-symmetric synthetic jet, the three-dimensional wake of a circular cylinder and the turbulent wake behind a wall-mounted square cylinder. The obtained speed-up factors are around 7 with respect to HODMD; this value depends on the simulation and the configuration of the hyperparameters. HODMD-of also provides a significant reduction of the memory requirements, between 40−80% amongst the two- and three-dimensional cases studied in this paper.