Diethelm et al,

Hi, I have been using fairly regulary a number of packages in the rmetrics group--most recently both fImport and fTrading.  I noticed a bug in one of the functions in the fTrading package.  The function cdoTA() is defined as below:

  
> 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
}

The problem occurs when it calls cdsTA, which is defined as below:

 
> cdsTA
function (x, lag1 = 12, lag2 = 26, lag3 = 9) 
{
    cds = emaTA(macdTA(x, lag1, lag2), lag3)
    if (is.timeSeries(x)) 
        colnames(cds) <- "CDS"
    cds
}

cdsTA is expecting a vector and three lag terms.  cdoTA feeds a vector and only one lag term, lag3.  However, cdsTA is expecting lag1 to be the first term.  Thus whatever cdoTA thinks lag3 is, cdsTA is treating it as if it's actually lag1.  This all seems a bit wordy, I know.  However, if you replace the blue text above with:

cdo = macdTA(x, lag1, lag2) - cdsTA(x, lag3=lag3)

That should clear up the assignment problems.

Best Regards,
Adam Murphy



 
	[[alternative HTML version deleted]]

