[R-SIG-Finance] help with quantmod and addTA

G See gsee000 at gmail.com
Fri Aug 10 20:54:18 CEST 2012


I don't know, Oliver.  You're code is not reproducible.  However, a
cursory search of this list suggests that wrapping your addTA calls in
plot may help.

HTH,
Garrett

On Fri, Aug 10, 2012 at 1:43 PM, Olivier MARTIN
<Olivier.Martin at avignon.inra.fr> wrote:
> Hi all,
>
> I don't understand very well the principles of oriented
> programmation and I have some diffculties with the function addTA().
>
> I suppose I have plotted a time serie with the function candleChart() for
> example.
> I have a vector y with 1,-1 and 0 values with the same length than my serie.
> If i want to add a shaded region corresponding to the value 1, I can do it
> with
> addTA(y==1,col="gray90",border=NA,on=-1)
>
> So I would like to write a function that add the three different regions
> I tried this
> addshaded=function(x){
> addTA(x==1,col="gray90",border=NA,on=-1)
> addTA(x==-1,col="green",border=NA,on=-1)
> addTA(x==0,col="red",border=NA,on=-1)
> }
>
> But the command addshaded(y) does not add the three different
> shaded regions. ;-(
>
> Regards,
> Olivier.
>
> _______________________________________________
> R-SIG-Finance at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions
> should go.



More information about the R-SIG-Finance mailing list