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

DVI output has incorrect colnames starting in v23-0 #36

Closed joshuaulrich closed 7 years ago

joshuaulrich commented 7 years ago

When the code below is run using TTR_0.22-0, the colnames are: c("dvi.mag", "dvi.str", "dvi"). When run using TTR_0.23-0, the colnames are: c("..1", "..2", "..3").

require(TTR)
data(ttrc)
d <- setNames(ttrc$Close, ttrc$Date)
colnames(dvi <- DVI(d))

It appears the cause is due to the change in #2. The affected call is:

reclass(cbind(dvi.mag, dvi.str, dvi), price)

In 0.22-0, dvi.mag, dvi.str, and dvi were all simple vectors. In 0.23-0, dvi.mag is a matrix with row names indicating datetimes, while dvi.str and dvi are both xts objects. None of these objects have column names, which is likely what causes cbind.xts/merge.xts not to deparse the object names for column names on the new object.

Thanks to @ivannp for the report, and to @jjphorn for the reminder.