Fixed end date problem with automatic n-grams generation around peaks