[R-SIG-Finance] about quantmod and shaded region

Olivier MARTIN Olivier.Martin at avignon.inra.fr
Tue Aug 7 18:22:28 CEST 2012


Hi all,

I am a new user of quantmod package (version 0.3-8) and I have some 
problems.
I would like to add shaded regions to a chart.

1. I tried the following commands  (from slide presentation of Jeff Ryan)

getSymbols('^FCHI',source="yahoo")
CAC=FCHI
candleChart(CAC,theme="white",subset='2012-05::2012-08',TA=NULL)
addTA(RSI(Cl(CAC))>50,col="green",border=NA,on=-1)
addTA(RSI(Cl(CAC))>40 & RSI(Cl(CAC))<50 ,col="red",border=NA,on=-1)
addTA(RSI(Cl(CAC)) ,on=NA)

So the first region RSI(Cl(CAC))>50 is correctly shaded, but the second 
region
RSI(Cl(CAC))>40 & RSI(Cl(CAC))<50 isn't. So I supposed a bug with 
bollean vectors
with addTA() ?


2. On the web, I found a mail from Jeff Ryan and he proposed to use the 
function xts()

>times <- timeBasedSeq(20071001/2007)  # create a Date sequence from 2007-10-01 to 2007-12-31
>addTA(xts(rep(TRUE,length(times)), times), on=-1, col="#333333", border=NA)

Nevertheless, this command gives me an error concerning the function rect().


3. I also tried to use the function newAT() without success.. :-(


Best Regards,
O.



More information about the R-SIG-Finance mailing list