It's probably easiest to work with the code so here it is:


if( calc=="close" ) {
    # Add univariate case from Cedrick Johnson's R-SIG-Finance post
    if( NCOL(OHLC) == 1 ) {
      r <- ROC(OHLC[, 1], 1, ...)
    } else {
      r <- ROC(OHLC[, 4], 1, ...)
    }
    s <- sqrt(N) * runSD(r , n-1)
  }


Is runSD used correctly? To me the call should be: runSD(r, n=n,
sample=TRUE).

While at it, I would also like to have calc="close", but assuming zero mean
for the returns. In this case, the above becomes: sqrt(N) *
sqrt(runSum(r*r, n=n)/(n-1)). Is it ok if I add another method, like
calc="close.zero.mean"?

Thanks

	[[alternative HTML version deleted]]

