joshuaulrich / TTR

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

growth function does not work #22

Open brandco opened 8 years ago

brandco commented 8 years ago

growth() returns NA for all values because growth <- cumprod(1 + ROC(price, ...) * signals) and ROC() returns an NA for the first value in a series. cumprod cannot handle the NA and returns NAs for everything.

Example: IBM <- getYahooData('IBM')$Open growth(IBM, rep(1, nrow(IBM)))