All indicators are just R functions.


On Tue, Jul 22, 2014 at 1:43 AM, Andy Lu <luandrew@qq.com> wrote:

> Thanks for your reply, I modify the label to  other word such as
> "llbottom", it still doesn't work. Do you have an experience that a
> self-defined indicator can work with a parameter set？
>
>>
>> bottom <- function(s, n, w) {
>>   rl <- Linear(Cl(s),n)
>>   atr <- ATR(s,n)$atr
>>   ll <- rl+atr*w
>>   anchor <- 0.0
>>   for (i in 1:length(ll)) {
>>     if (!is.na(ll[i,1]) & ll[i,1]>anchor) {
>>       anchor <- as.numeric(ll[i,1])
>>     } else if (!is.na(ll[i,1])) {
>>       ll[i,1] <- anchor
>>     }
>>   }
>>   return (ll)
>> }‍
>>
>>
>>
>> and add it like below:
>>
>>
>> add.indicator(strategy=strategy.st, name="bottom",
>>
>> arguments=list(s=quote(mktdata),n=13,w=.weight),
>>                             label="llbottom")‍
>
>
>>
>>
>> then I add a prameter set like below
>>
>>
>> add.distribution(strategy=strategy.st,
>>                  paramset.label = 'bottom',
>>                  component.type = 'indicator',
>>                  component.label = 'llbottom',
>>
>>                  variable = list(w=.lowPara ),
>>                  label = 'AT'
>> )‍‍
>
> ------------------
> Andy Lu
>
>
>
> ------------------ Original ------------------
> *From: * "Ilya Kipnis";<ilya.kipnis@gmail.com>;
> *Date: * Tue, Jul 22, 2014 01:38 PM
> *To: * "Andy"<luandrew@qq.com>;
> *Cc: * "r-sig-finance"<r-sig-finance@r-project.org>;
> *Subject: * Re: [R-SIG-Finance] A problem of parameter set can not be
> effect
>
> Well the first thing I'd recommend is not labeling something as "low".
> That's a reserved keyword for the OHLC function.
>
>
> On Tue, Jul 22, 2014 at 1:31 AM, Andy Lu <luandrew@qq.com> wrote:
>
>> Hi, I myself defined such a indicator:
>>
>>
>> bottom <- function(s, n, w) {
>>   rl <- Linear(Cl(s),n)
>>   atr <- ATR(s,n)$atr
>>   ll <- rl+atr*w
>>   anchor <- 0.0
>>   for (i in 1:length(ll)) {
>>     if (!is.na(ll[i,1]) & ll[i,1]>anchor) {
>>       anchor <- as.numeric(ll[i,1])
>>     } else if (!is.na(ll[i,1])) {
>>       ll[i,1] <- anchor
>>     }
>>   }
>>   return (ll)
>> }‍
>>
>>
>>
>> and add it like below:
>>
>>
>> add.indicator(strategy=strategy.st, name="bottom",
>>
>> arguments=list(s=quote(mktdata),n=13,w=.weight),
>>                             label="llbottom")‍
>
>
>>
>>
>> then I add a prameter set like below
>>
>>
>> add.distribution(strategy=strategy.st,
>>                  paramset.label = 'bottom',
>>                  component.type = 'indicator',
>>                  component.label = 'llbottom‍',
>>
>>                  variable = list(w=.lowPara ),
>>                  label = 'AT'
>> )‍
>>
>>
>>
>> originally, I set the indicator's parameter "w" as .weight=-6, but I want
>> to test a set values .lowPara=c‍(-5,-4.5,-4,-3.5,-3)
>> but when I tried apply.paramset  ‍several times, I am sure that the w
>> always is -6, it can't  be chaned to values in .lowPara respectively, what
>> are the possible‍ easons? is that because the package don't support self
>> defined indicators or other reasons?‍
>> Thanks in advance for your answers.
>>
>>
>> ------------------
>> Andy Lu
>>         [[alternative HTML version deleted]]
>>
>>
>> _______________________________________________
>> R-SIG-Finance@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.
>>
>
>

	[[alternative HTML version deleted]]

