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

[GT] Re: Re: Proposed patch for Indicators::new()



I've been keeping an eye on GT for a while, but just recently got
really involved in it. The reason I started analyzing the Perl code
was because I couldn't find any real documentation on how to use the
system. So I started reading the code.

> i will evaluate your changes, however, you will find similar code in most
> of the other 'new()' methods for all data objects implemented by gt.
>    GT::Analyzers
>    GT::CloseStrategy
>    ...

I haven't gotten to those yet, but it seems like they are all using
99% for the same code, at least for the constructor of the object. The
Object Oriented approach to this would be to write the common code in
a parent class once and then inherit it where needed. Should be an
easy fix ...

> so if we really want to make this change (i'm not against it, i have gotten
> more than one headache staring at those 'new()' method code blocks than i
> care to remember), but to do the right thing we really should fix all of
> them at the same time.

What these code blocks do is:
1. Check for the passed arguments
2. Find if the number of arguments is sufficient and if not add from a
predefined list of default arguments.
For example:
./display_indicator.pl I:SMA YHOO 40
silently adds a second argument of {I:Prices CLOSE}
This is neat, because one can explicitly add the second argument, for example:
./display_indicator.pl I:SMA YHOO 21 {I:RSI 14}
This will give you the 21 day moving average of the RSI(14) for Yahoo.

> how much evaluation testing have you conducted (and how) to show this change
> is equivalent?

I tested with all display_*.pl files and I get the same results as the
previous code, which doesn't really surprise me because anyway you
look at it both codes do the exact same thing. The one I propose is
just a little shorter and more compatible.

> as far as versions go -- i will try to always refer to the gt trunk version
> not the cpan or exp branches.

I saw GT on cpan, but I didn't think it was a good idea. At least I
don't see the reason for it.
I'm using git to keep track of my modifications, and I also work on
the GT trunk version.

Best regards,
Nick