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

Olivier MARTIN Olivier.Martin at avignon.inra.fr
Fri Aug 10 21:37:44 CEST 2012


Hi Garrett,

Thanks a lot!!! It is the solution for my problem!!

Regards,
Olivier.

Le 10/08/2012 20:54, G See a écrit :
> 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.


-- 
-------------------------------------------------------------
Martin Olivier
INRA - Unité Biostatistique & Processus Spatiaux
Domaine St Paul, Site Agroparc
CS 40509
84914 Avignon Cedex 9, France
Tel : 04 32 72 21 57



More information about the R-SIG-Finance mailing list