[R-SIG-Finance] possible bug in cdoTA
Ulrich Staudinger
us at activestocks.de
Sun Mar 25 12:10:52 CEST 2007
Hi there,
i don't know if i am on the right list, but anyway :)
I am right now in the process of synchronizing my own code base (ccapi2
/ http://www.activestocksde) with the code base of RMetrics' indicators.
And i found this code in RMetrics:
> cdoTA
function (x, lag1 = 12, lag2 = 26, lag3 = 9)
{
cdo = macdTA(x, lag1, lag2) - cdsTA(x, lag3)
if (is.timeSeries(x))
colnames(cdo) <- "CDO"
cdo
}
>
and
> cdsTA
function (x, lag1 = 12, lag2 = 26, lag3 = 9)
{
cds = emaTA(macdTA(x, lag1, lag2), lag3)
if (is.timeSeries(x))
colnames(cds) <- "CDS"
cds
}
>
However, cdsTA in cdoTA is called with lag2=26 and lag3=9. I think these
hardcoded values are wrong. I think the cdoTA code should rather be
> cdoTA
function (x, lag1 = 12, lag2 = 26, lag3 = 9)
{
cdo = macdTA(x, lag1, lag2) - cdsTA(x, lag1, lag2, lag3)
if (is.timeSeries(x))
colnames(cdo) <- "CDO"
cdo
}
>
Please correct me if i am wrong. I also don't know if this has been
reported / discussed, yet.
Thanks,
Sincerely yours,
Ulrich Staudinger
More information about the R-SIG-Finance
mailing list