Hi, I am an okay R programmer, but I'm just learning about technical analysis. I'm trying to write a script for spotting peaks and valleys in historical stock data.
For now, I am *not* trying to predict future prices, just unambiguously identify peaks and valleys in historical information. Seems easy, right?
Well, there seems to be a lot of local minima and maxima. For instance, if I locate the maxima between an upward crossing through the upper 20-day Bollinger band and a downward crossing through the lower 20-day Bollinger band (and the reverse for minima) I often miss the yearly highs and lows while hitting a lot of noise peaks.
Does anybody have suggestions for what technical indicators I should use, and how? MACD, RSI, Bollinger bands, SMA, etc.? Or suggested reading on this topic? I'm sure this has got to be a solved problem among technical analysts.