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

OBV function: bug with XTS price and volume as the input #28

Closed davidlamcm closed 8 years ago

davidlamcm commented 8 years ago

on line 10 of the function: obv <- c(volume[1], ifelse(prChg > 0, volume, -volume)[-1])

in the case that both price and volumn argument is a numeric vector, volume[1] will return an 2d xts object but ifelse will return a numeric vector, which will return error if you combine them using c()