diff --git a/R/RSI.R b/R/RSI.R index 1ede03c..4bc48c7 100644 --- a/R/RSI.R +++ b/R/RSI.R @@ -75,8 +75,7 @@ #' rsiMA1 <- RSI(price, n=14, maType="WMA", wts=ttrc[,"Volume"]) #' #' # 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))) +#' rsiMA2 <- RSI(price, n=14, maType=list(maUp=list(EMA),maDown=list(WMA))) #' #' "RSI" <- @@ -114,7 +113,7 @@ function(price, n=14, maType, ...) { # If MA function has 'n' arg, see if it's populated in maType; # if it isn't, populate it with RSI's formal 'n' for(i in 1:length(maType)) { - if( !is.null( formals(maType[[i]])$n ) && is.null( maType[[i]]$n ) ) { + if( !is.null( formals(maType[[i]][[1]])$n ) && is.null( maType[[i]]$n ) ) { maType[[i]]$n <- n } mavgUp <- do.call( maType[[1]][[1]], c( list(up), maType[[1]][-1] ) ) diff --git a/man/RSI.Rd b/man/RSI.Rd index 64ba488..2fa86f2 100644 --- a/man/RSI.Rd +++ b/man/RSI.Rd @@ -58,8 +58,7 @@ rsi <- RSI(price) rsiMA1 <- RSI(price, n=14, maType="WMA", wts=ttrc[,"Volume"]) # 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))) +rsiMA2 <- RSI(price, n=14, maType=list(maUp=list(EMA),maDown=list(WMA))) }