I have an indicator that oscillates between 0 and 1. It looks like a stochastic oscillator and the signal has a variable frequency. It's smooth most of the time, and the peaks are usually curved or sharp / pointed. I want to identify the locations of the peaks. One way to do this is by keeping track of the min / max points and then calling the peak the highest point once the signal deviates away from that point by some margin. Then after the highest point is called, reset the min/max points to the value of the current point. However, does anyone know of a simpler or more robust way? I could code this up myself, but I figure there's a better / more computationally efficient way to do it than what I have just described. I figure this must come up a lot in technical analysis / automated trading.