 Hi all,

I am having trouble using the function "findPeaks":

tickers="SPY"

data *<-* new.env()

getSymbols(tickers, src = 'yahoo', from = '1970-01-01', env = data,
auto.assign = T)

p=findPeaks(data$SPY[, 6], 5)

plot(data$SPY[, 6], type="l")

points(p, data$SPY[, 6][p])

My goal is to implement a trailing-stop on a buy-and-hold strategy using
findPeaks...

I wanted to detect whenever SPY falls 5 points from the local peak...

The above example failed in finding the peaks (p == NULL).

Am I missing anything here?

Thanks a lot!

	[[alternative HTML version deleted]]

