joshuaulrich / TTR

Technical analysis and other functions to construct technical trading rules with R
GNU General Public License v2.0
326 stars 102 forks source link

TRIX bug #45

Open coderxiaok opened 7 years ago

coderxiaok commented 7 years ago

Hi Joshua, I found a bug in the TRIX function. If the "maType" is not a list variable, the "nSig" parameter will not be used when calculating the signal value from the TRIX value. Instead, the "n" parameter will be used as the "nSig" parameter.

Some of the code as bellow: if (is.list(maType)) { signal <- do.call(maType[[4]][[1]], c(list(TRIX), maType[[4]][-1])) } else { signal <- do.call(maType, c(list(TRIX), list(n = n, ...))) }

The correct code might be: if (is.list(maType)) { signal <- do.call(maType[[4]][[1]], c(list(TRIX), maType[[4]][-1])) } else { signal <- do.call(maType, c(list(TRIX), list(n = nSig, ...))) }