But using my eye from the plot it should have more local peaks even with
tolerance 5... no?

I cannot change the number 5....

On Thu, Feb 16, 2012 at 9:17 AM, R. Michael Weylandt <
michael.weylandt@gmail.com> wrote:

> You'll get more if you lower your threshold value (the 5)
>
> Michael
>
> On Thu, Feb 16, 2012 at 10:13 AM, Luna <lunamoonmoon@gmail.com> wrote:
> > Hi friends,
> >
> > Thanks for your help!
> >
> > I just did a new test:
> >
> > aa=100:1
> > bb=sin(aa/3)
> > cc=aa*bb
> > plot(cc, type="l")
> > p=findPeaks(cc, 5)
> > points(p, cc[p])
> > points(p, cc[p])
> >
> >>
> >
> > p
> >
> > [1] 3 22 41
> >
> >
> >
> > It only picks up 3 peaks, which is obviously wrong, am I correct?
> >
> > Thanks a lot!
> >
> > On Thu, Feb 9, 2012 at 9:55 PM, R. Michael Weylandt
> > <michael.weylandt@gmail.com> wrote:
> >>
> >> Happy to follow procedure.
> >>
> >> Thanks for jumping on it so quickly.
> >>
> >> Michael Weylandt
> >>
> >> On Thu, Feb 9, 2012 at 10:40 PM, Jeffrey Ryan <jeffrey.ryan@lemnica.com
> >
> >> wrote:
> >> > On Thu, Feb 9, 2012 at 9:00 PM, R. Michael Weylandt
> >> > <michael.weylandt@gmail.com> wrote:
> >> >> It looks like you need to wrap coredata() because some funny
> >> >> arithmetic is happening when the xts-ness is preserved.
> >> >>
> >> >> e.g.
> >> >>
> >> >> findPeaks(coredata(Ad(SPY)), 5)
> >> >>
> >> >> But this is perhaps a less-than-desirable feature. I'll patch it and
> >> >> send it to Josh.
> >> >
> >> > Proper procedure is indeed to blame Josh for all undesirable
> >> > functionality, even in code he didn't write ;-)
> >> >
> >> > Patched in R-forge rev 577. Thanks.
> >> >
> >> > Jeff
> >> >>
> >> >> Michael
> >> >>
> >> >> On Thu, Feb 9, 2012 at 9:56 PM, Michael <comtech.usa@gmail.com>
> wrote:
> >> >>>  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]]
> >> >>>
> >> >>> _______________________________________________
> >> >>> R-SIG-Finance@r-project.org mailing list
> >> >>> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> >> >>> -- Subscriber-posting only. If you want to post, subscribe first.
> >> >>> -- Also note that this is not the r-help list where general R
> >> >>> questions should go.
> >> >>
> >> >> _______________________________________________
> >> >> R-SIG-Finance@r-project.org mailing list
> >> >> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> >> >> -- Subscriber-posting only. If you want to post, subscribe first.
> >> >> -- Also note that this is not the r-help list where general R
> questions
> >> >> should go.
> >> >
> >> >
> >> >
> >> > --
> >> > Jeffrey Ryan
> >> > jeffrey.ryan@lemnica.com
> >> >
> >> > www.lemnica.com
> >> > www.esotericR.com <http://www.esotericr.com/>
> >> >
> >> > R/Finance 2012: Applied Finance with R
> >> > www.RinFinance.com <http://www.rinfinance.com/>
> >> >
> >> > See you in Chicago!!!!
> >>
> >> _______________________________________________
> >> R-SIG-Finance@r-project.org mailing list
> >> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> >> -- Subscriber-posting only. If you want to post, subscribe first.
> >> -- Also note that this is not the r-help list where general R questions
> >> should go.
> >
> >
>

	[[alternative HTML version deleted]]

