#' Apply a rank function to an \code{xts} price history.
#' @param x the price history as an \code{xts} object
#' @param rank_fun the ranking function to apply
#' @param ... any parameters passed to the rank function
#' @return the result of the given rank function
#' @seealso ave_3ROC, weight_ave_3ROC, strength_ROC
#' @examples
#' \dontrun{
#' library(quantmod)
#' getSymbols(XLE,auto.assign=TRUE)
#' rv <- apply_rank(XLE,ave_3ROC)
#' head(rv)
#' }
apply_rank <- function(x, rank_fun, ...) {
FUN <- match.fun(rank_fun)
FUN(x, ...)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.