View source: R/Analyses_functions_2.R
RS_Index | R Documentation |
This function computes the Relative Strength Index (RSI) for a time series.
RS_Index(X, period = 14, plot = FALSE, overbought = 70, oversold = 30)
X |
A vector. |
period |
Period length used for smoothing. Default is set to 14. |
plot |
Logical: If |
overbought |
Horizontal line which indicates an overbought level in the RSI plot. Default is set to 70. |
oversold |
Horizontal line which indicates an oversold level in the RSI plot. Default is set to 30. |
To compute the RSI,
\text{RSI} = 100 \dfrac{\text{Average\_gain}}{\text{Average\_gain}+\text{Average\_loss}}
formula is used. Average gain and average loss are computed using the Wilders's smoothing method.
A list or vector of the RSI values.
Wilder, J. W. (1978). New concepts in technical trading systems. Greensboro, NC.
X <- c(74.44,74.19,74.25,73.65,74.37,74.73,75.15,75.46,75.88,76.78,
75.81,76.53,75.11,76.28,76.68,76.08,76.53,76.11,76.42,75.58,
75.44,75.46,74.98)
RS_Index(X, plot = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.