[R-SIG-Finance] Question about RSI command in the TTR package

Josh Ulrich josh.m.ulrich at gmail.com
Sun Mar 1 03:30:01 CET 2009


Hello,

On Sat, Feb 28, 2009 at 7:27 PM, benn fine <bennfine at gmail.com> wrote:
> How does one use the maType command inside RSI ?
>
> I want to call something like RSI(price,n=2,maType=list(SMA,n=2))
>
It's a bit redundant to specify n=2 for RSI and in maType.  That said,
it shouldn't cause an error... this is a bug.  What you want is:
RSI(price,n=2,maType=SMA)

> Also, in the RSI help file is the following code-what is it doing with the
> maUp and maDown?
> Can't figure it out either:
>
> # Case of two different 'maType's for both MAs
>  rsiMA2 <- RSI(price, n=14, maType=list(maUp=list(EMA,ratio=1/5),
>                maDown=list(WMA,wts=1:10)))
> Thanks.
>
The code in the above example is doing something highly unusual, in
order to demonstrate the flexibility of the TTR packge.  RSI compares
the average positive and negative prices changes and TTR's RSI allows
you to specify two different moving averages for positive/negative
price changes.  In the example, the positive price changes are
smoothed with an EMA, while the negative price changes are smoothed
with a weighted moving average.

>
> _______________________________________________
> R-SIG-Finance at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only.
> -- If you want to post, subscribe first.
>

HTH,
Josh
--
http://quantemplation.blogspot.com



More information about the R-SIG-Finance mailing list