[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [GT] Fix to I:Generic:ByName



Sorry, forgot to delete some redundant code... Th.

> -----Original Message-----
> From: Weigert, Thomas
> Sent: Saturday, March 08, 2008 7:47 PM
> To: 'devel
AT
geniustrader.org'
> Cc: Weigert, Thomas
> Subject: Fix to I:Generic:ByName
> 
> This indicator had a bug which made it somewhat difficult to predict
when
> it would work and when not. A good example is the rewrite of DSS that
kw
> did. He was forced to redo the unneeded computations when applying the
> second smoothing:
> 
>     $self->{'ema1'} = GT::Indicators::EMA->new([ $self->{'args'}-
> >get_arg_names(2), $sto1 ]);
>     $self->{'ema2'} = GT::Indicators::EMA->new([ $self->{'args'}-
> >get_arg_names(3),
>         "{I:EMA @{[$self->{'ema1'}->{'args'}->get_arg_names()]}}" ]);
> 
> Ideally, ema2 should just use ema1, as follows:
> 
>     $self->{'ema2'} = GT::Indicators::EMA->new([ $self->{'args'}-
> >get_arg_names(3),
>         "{I:Generic:ByName " . $self->{'ema1'}->get_name . "}" ]);
> 
> That way, the first smoothing is not computed twice, and it is also
easier
> to understand and has more reuse.
> 
> However, that did not work due to the bug mentioned.
> 
> The attached indicator fixes this problem. As the construction of
ArgTree
> is somewhat brittle in GT, please advise of any problems you run into
with
> this indicator if you do. I'll take care of it.
> 
> Cheers, Th.

Attachment: ByName.pm
Description: ByName.pm