title: Find highs and lows in time series data
body: <p>I've been searching high and low (no pun intended) for a formula, or more likely, a loop that can pick out the higher highs and lower lows so as to be able to draw a trend line across them. This is often used in technical analysis of stocks. At first it seems like such a simple problem but I'm stuck. I'm using python but any pseudo code would probably suffice for myself and others that stumble across this thread in the future.</p>