I'm using the default RSI calculation in the TTR package as follows:

result = RSI(data,14).

The function also allows the user to specify the averaging method:

result = RSI(data,14,"SMA"), result = RSI(data,14, "EMA") etc.

However, I cannot work out what averaging method is being used in the default version. I have compared the results from all the different averaging methods (SMA, EMA) and none of them match the default. Any ideas?


The TTR RSI code uses EMA by default. Code below:


# Default Welles Wilder EMA
if(missing(maType)) {
    maType <- 'EMA'
    maArgs$wilder <- TRUE

The answer is that the default uses the Wilder EMA, which does act slightly different from a standard EMA.

i.e. Default = RSI(data,14,"EMA",wilder = TRUE)

For more information on the Wilder Moving Average - https://www.incrediblecharts.com/indicators/wilder_moving_average.php

  • $\begingroup$ Can the user set the default to "EMA" and to not use wilder, without adjust the function code ? I get a discrepancy between 2 system that has the same OHLC-data source. the discrepancy is in the RSI result and I suspect it might have to do with that one system uses the TTR (thus wilder setting) and the other system does not use TTR (wilder). $\endgroup$ – Toolbox Jul 16 '19 at 13:44
  • $\begingroup$ I noticed that I get different results, adding the wilder flag, with or without [maType="EMA". That seems a bug, since not typing [maType="EMA] should give the "EMA" as default. $\endgroup$ – Toolbox Jul 16 '19 at 14:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.