Skip to content

Question about RSI command in the TTR package

2 messages · benn fine, Joshua Ulrich

#
Hello,
On Sat, Feb 28, 2009 at 7:27 PM, benn fine <bennfine at gmail.com> wrote:
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)
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.
HTH,
Josh
--
http://quantemplation.blogspot.com