averages values over a defined history