Here is my experiment: I am using the "findPeaks" function in the "Quantmod" package: I want to detect "local" peaks within a tolerance 5, i.e. the first locations after the time series drops from the local peaks by 5: aa=100:1 bb=sin(aa/3) cc=aa*bb plot(cc, type="l") p=findPeaks(cc, 5) points(p, cc[p]) p The output is [1] 3 22 41 It seems wrong... as I am expecting more "local peaks" than 3... Any thoughts? Thanks a lot! It only picks up 3 peaks, which is obviously wrong, am I correct? Thanks a lot!