Skip to content
All library documents

The TTR RSI Default Uses Wilder’s Exponential Average

Article Quant Q&A · Author: Cameron

Summary

The document answers which averaging method the TTR package uses when calculating the Relative Strength Index without an explicit averaging-method argument. Although the function allows alternatives such as simple and standard exponential averages, its default uses an exponential moving average configured with Wilder’s smoothing. This explains why the default output may not match results computed with an ordinary EMA or SMA.

The answer identifies the equivalent explicit configuration and points to the package implementation, which sets the average type to EMA and enables Wilder mode when no method is supplied. The material gives a practical clarification about software behavior, not a full derivation of RSI or a comparison of indicator performance. Users should still check the installed package version and function documentation if implementation details matter, since library behavior can change.

Key ideas

  • The TTR package defaults to an EMA-based average when calculating RSI.
  • Wilder smoothing makes that average differ from a standard EMA.
  • The default can be reproduced by explicitly selecting EMA with Wilder mode enabled.
  • This clarification concerns implementation behavior and does not establish which RSI variant performs best.

Tags

Full text
# R RSI Calculation (TTR package)


# R RSI Calculation (TTR package)












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?

## Answer by Cameron (score 1)

https://quant.stackexchange.com/a/30136

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

## Answer by plwiz (score 1)

https://quant.stackexchange.com/a/36818

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

https://github.com/joshuaulrich/TTR/blob/master/R/RSI.R

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

Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.