R/meanPrice.R

Defines functions getMeanPrice

source("R/dbInterface.R")

getMeanPrice <- function(Symbol, SymbolName)
{
  mePrice <- meanPrice(unlist(strsplit(SymbolName, "[.]"))[1])

  if(is.null(mePrice))
    return(NULL)

  mPrice = xts(rep(mePrice,length(index(Symbol))), index(Symbol))

  assign("mPrice", mPrice, .GlobalEnv)

  col <- 3
  if(as.double(last(Cl(Symbol))) < mePrice)
    col <- 2

  return(sprintf("addTA(mPrice, lwd=1, on=1, col=%d)", col))
}
palencar/TraderBot documentation built on April 30, 2020, 11:50 p.m.