find peak and bottom values from a series