
Reproductible on Windows 7 OS, R 2.15.0, TTR 0.21-1

> Date: Wed, 10 Oct 2012 12:47:24 -0500
> From: brian@braverock.com
> To: r-sig-finance@r-project.org
> Subject: Re: [R-SIG-Finance] MACD crash problem
> 
> On 10/10/2012 12:38 PM, Bos, Roger wrote:
> > Here is some reproducible code that causes R to crash while running the MACD function in the TTR library.  The problem seems to be when the nSlow and nSig parameters are so large that the function is not able to calculate the moving average length denoted by nSig.  Now that I know what the problem is I can avoid it, but it would be nice if the MACD function returned an error instead of crashing R (unless its just my setup-R 2.15.1 64-bit win7).  Maybe someone can confirm for me by testing out the code below.
> >
> > The first call to MACD should work as many times as you call it, as expected.  However the second one causes problems because the data in temp is too short to product a moving average over 22 data points.  This crashes R almost always, but occasionally it does work once or twice.  That's why I used for loops to make my point.  First lets see if other people have the same results that I do.  If so, it would be nice if MACD produced an error instead of crashing R.
> >
> > Thanks,
> >
> > Roger
> >
> >
> > library(TTR)
> > temp <- 1:60
> > for (i in 1:10) x <- MACD(temp, nFast=15, nSlow=40, nSig=21) # Works fine
> > print("okay so far")
> > for (i in 1:10) x <- MACD(temp, nFast=15, nSlow=40, nSig=22) # Crashes R
> > print("bet you don't see this")
> 
> This is reproducible for me with TTR-0.21-1 on 64 bit linux, and with 
> svn r135 from R-Forge.
> 
> Regards,
> 
>     - Brian
> 
> _______________________________________________
> 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]]

