You can subscribe to this list here.
| 2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(32) |
Oct
(144) |
Nov
(14) |
Dec
(44) |
| 2002 |
Jan
(16) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
(65) |
Nov
(4) |
Dec
(30) |
| 2003 |
Jan
(84) |
Feb
(101) |
Mar
(58) |
Apr
(30) |
May
(138) |
Jun
(336) |
Jul
(36) |
Aug
(12) |
Sep
(8) |
Oct
(4) |
Nov
(12) |
Dec
(12) |
| 2004 |
Jan
(186) |
Feb
(274) |
Mar
(248) |
Apr
(18) |
May
(104) |
Jun
(48) |
Jul
(144) |
Aug
(98) |
Sep
(60) |
Oct
(72) |
Nov
(32) |
Dec
(130) |
| 2005 |
Jan
(84) |
Feb
(130) |
Mar
(50) |
Apr
(106) |
May
(240) |
Jun
(154) |
Jul
(66) |
Aug
(82) |
Sep
(36) |
Oct
(18) |
Nov
(14) |
Dec
(4) |
| 2006 |
Jan
(68) |
Feb
(2) |
Mar
(14) |
Apr
(6) |
May
|
Jun
|
Jul
|
Aug
(2) |
Sep
|
Oct
|
Nov
(50) |
Dec
(4) |
| 2007 |
Jan
(14) |
Feb
(42) |
Mar
(70) |
Apr
(30) |
May
(8) |
Jun
|
Jul
(2) |
Aug
(2) |
Sep
|
Oct
(88) |
Nov
(168) |
Dec
(2) |
| 2008 |
Jan
(56) |
Feb
(372) |
Mar
(446) |
Apr
(112) |
May
(144) |
Jun
(94) |
Jul
(208) |
Aug
(90) |
Sep
(26) |
Oct
(10) |
Nov
(2) |
Dec
|
| 2009 |
Jan
|
Feb
(8) |
Mar
|
Apr
(46) |
May
(188) |
Jun
(120) |
Jul
(448) |
Aug
(202) |
Sep
(4) |
Oct
(72) |
Nov
(154) |
Dec
(2) |
| 2010 |
Jan
(58) |
Feb
|
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
(68) |
Aug
(24) |
Sep
|
Oct
|
Nov
|
Dec
(11) |
| 2011 |
Jan
(6) |
Feb
(11) |
Mar
(8) |
Apr
(10) |
May
(4) |
Jun
|
Jul
|
Aug
(8) |
Sep
|
Oct
(3) |
Nov
(2) |
Dec
|
| 2012 |
Jan
|
Feb
(13) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(31) |
Aug
(21) |
Sep
(2) |
Oct
(1) |
Nov
(29) |
Dec
(17) |
| 2013 |
Jan
(2) |
Feb
|
Mar
|
Apr
(25) |
May
(1) |
Jun
|
Jul
|
Aug
(1) |
Sep
(3) |
Oct
(4) |
Nov
(11) |
Dec
|
| 2016 |
Jan
(1) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2018 |
Jan
(3) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2019 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
| 2020 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2023 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
(1) |
Oct
|
Nov
|
Dec
|
|
From: Raphael H. <rhe...@hr...> - 2003-01-04 23:59:06
|
Le Sat, Jan 04, 2003 at 09:53:35AM +0100, ol...@ol... écrivait:
> Hi All,
Hi,
> I converted the VIDYA-indicator -- posted some days ago -- to the
> Args::Tree-architecture. I tested it with display_indicator and IMO it
> should work. Maybe someone can go through the code and look for bugs
> and errors.
It looks mostly ok. I replaced "&" by "&&". I used the max function
of GT::Tools instead of the long syntax (a>b)?a:b.
I wonder what is the use of the "speed" variable ... and also of
"period2", the second parameter seems to be used nowhere ... :)
I wonder why you add the fourth parameter to $maxperiod in
add_prices_dependency. The 4th parameter seems to be a percentage and
not a number of days ...
Check the patch joined ... it returns the same result as your version but
is simpler. :) I should check with the definition of the VIDYA indicator
on the website listed in the file but I'm too tired for that right now.
I'll leave that to you.
> GT::Indicators::EMA->new([ $self->{'args'}->get_arg_names(1) ], "EMA
> of ema1",
> sub { $_[0]->indicators->get($self->{'ema1'}->get_name, $_[1])
> });
> $self->{'ema3'} =
> GT::Indicators::EMA->new([ $self->{'args'}->get_arg_names(1) ], "EMA
> of ema2",
> sub { $_[0]->indicators->get($self->{'ema2'}->get_name, $_[1])
> });
>
> The indicators are calculated, but when I try to test it, they return
> 0. Is it possible to solve the problem this way or do I have to
> calculate the indicators in the calculate-procedure?
It's possible to do it this way but you have to call
$self->add_indicator_dependency for each of the EMA with the good number
of days needed (check Indicators/T3.pm for example). Then the
calculation is automatically done in $self->check_dependencies ...
> An other idea (it's nothing important; it is just because I'm a little
> bit lazy): As you can see in the appended patch I added a stock-alias
> function to GT/Tools.pm. As shown in graphic.pl you can replace the
> code with the company name and vice versa.
This is isn't nice enough, I will not apply it. But I'll think about
doing something for that. But it will be part of the DB module ...
Cheers,
--
Raphaël Hertzog -+- http://www.ouaza.com
Formation Linux et logiciel libre : http://www.logidee.com
|
|
From: <ol...@ol...> - 2003-01-04 09:56:03
|
Hi All,
happy new year to everybody! Many thanks to Raphael for implementing
the ArgsTree-architecture for the gerneric signals.
I converted the VIDYA-indicator -- posted some days ago -- to the
Args::Tree-architecture. I tested it with display_indicator and IMO it
should work. Maybe someone can go through the code and look for bugs
and errors.
Concerning the other indicator, the TRIX-indicator, I have a question:
The TRIX is calculated on the basis of the EMA of an EMA of the EMA of
a certain period. I thought it should be sufficient if I handle the
period argument of the TRIX over to the EMA-calls like that in the
initialize-procedure:
$self->{'ema1'} = GT::Indicators::EMA->new([
$self->{'args'}->get_arg_names() ]);
$self->{'ema2'} =
GT::Indicators::EMA->new([ $self->{'args'}->get_arg_names(1) ], "EMA
of ema1",
sub { $_[0]->indicators->get($self->{'ema1'}->get_name, $_[1])
});
$self->{'ema3'} =
GT::Indicators::EMA->new([ $self->{'args'}->get_arg_names(1) ], "EMA
of ema2",
sub { $_[0]->indicators->get($self->{'ema2'}->get_name, $_[1])
});
The indicators are calculated, but when I try to test it, they return
0. Is it possible to solve the problem this way or do I have to
calculate the indicators in the calculate-procedure?
An other idea (it's nothing important; it is just because I'm a little
bit lazy): As you can see in the appended patch I added a stock-alias
function to GT/Tools.pm. As shown in graphic.pl you can replace the
code with the company name and vice versa.
With a line like
Aliases::Stock::13000 The Magic Company
in the configurationfile you can call the program like
./graphic.pl --title="Test of %n" Magic
And get the chart of the stock no. 13000 out of the database. For me
(as a person with a very bad memory for useless data) this feature is
very useful. Maybe you want to include it.
CU, Olf
|
|
From: Raphael H. <ra...@ge...> - 2003-01-02 23:57:49
|
Le Thu, Jan 02, 2003 at 11:25:20PM +0100, GeniusTrader CVS rhertzog écrivait:
> - Make Signals use ArgsTree by default.
> - Converted all Signals/Generic/*.pm to use ArgsTree.
This does mean that the syntax of all Signals/Generic modules has
changed ...
For example the old "S:Generic:Above Indicators:RSI 12 Limit:75" is now
"S:Generic:Above {I:RSI 12} 75". Similar conversions must be done for
the other modules.
If you look at the patch, you'll notice how much it simplify the code.
However I guess that performances are not improved. That's why I tried
to add the "precalculation" stuff for the "variable parameters"...
BTW, I find that the POD documentation is lacking for those
Signals/Generic modules ... if anyone wants to extend it, you're
welcome. :-)
Cheers,
--
Raphaël Hertzog -+- http://www.ouaza.com
Formation Linux et logiciel libre : http://www.logidee.com
|
|
From: GeniusTrader C. r. <ra...@ge...> - 2003-01-02 23:28:15
|
Update of /bourse/cvsroot/GT/Signals/Generic
In directory p200:/scratch/tmp/cvs-serv8538/Signals/Generic
Modified Files:
Above.pm And.pm Below.pm CrossOverDown.pm CrossOverUp.pm
Decrease.pm Equal.pm False.pm Increase.pm Or.pm True.pm
Log Message:
- Add precalculation system for ArgsTree.
- Make Signals use ArgsTree by default.
- Converted all Signals/Generic/*.pm to use ArgsTree.
--- /bourse/cvsroot/GT/Signals/Generic/Above.pm 2002/12/22 00:55:26 1.3
+++ /bourse/cvsroot/GT/Signals/Generic/Above.pm 2003/01/02 22:25:20 1.4
@@ -4,13 +4,14 @@
# This file is distributed under the terms of the General Public License
# version 2 or (at your option) any later version.
+# Standards-Version: 1.0
+
use strict;
use vars qw(@ISA @NAMES);
use Carp::Datum;
use GT::Signals;
use GT::Eval;
-use GT::Indicators qw($GET_LAST);
use GT::Tools qw(:generic);
@ISA = qw(GT::Signals);
@@ -21,77 +22,30 @@
=head2 Overview
This Generic Signal will be able to tell you when a specific indicator is
-above something else which could be an other indicator, a limit or current prices.
+above a given value which could be an other indicator or a fixed limit.
=cut
-
-sub new {
- my $type = shift;
- my $class = ref($type) || $type;
- my $args = shift;
-
- my $self = { "args" => $args };
-
- return manage_object(\@NAMES, $self, $class, $self->{'args'}, "");
-}
-
sub initialize {
my ($self) = @_;
- my @args = @{$self->{'args'}};
-
- my @function1 = shift_args_until("(Indicators|I|Limit):", @args);
- $self->{'f1'} = create_standard_object(@function1);
- $self->{'f1_number'} = extract_object_number(@function1);
- $self->add_indicator_dependency($self->{'f1'}, 1);
-
- if (scalar @args)
- {
- if ($args[0] =~ /^Limit:(-?\d+(?:\.\d+)?)/) {
- my $number = $1;
- $self->{'f2'} = sub { return $number };
- } else {
- my @function2 = shift_args_until("", @args);
- $self->{'temp'} = create_standard_object(@function2);
- $self->{'temp_number'} = extract_object_number(@function2);
- $self->{'f2'} = sub {
- $_[0]->indicators->get($self->{'temp'}->get_name(
- $self->{'temp_number'}), $_[1])
- };
- $self->add_indicator_dependency($self->{'temp'}, 1);
- }
- } else {
- $self->{'f2'} = $GET_LAST;
- $self->add_prices_dependency(1);
- }
}
sub detect {
- DFEATURE my $f;
my ($self, $calc, $i) = @_;
- my $indic = $calc->indicators;
- my $function1_name = $self->{'f1'}->get_name($self->{'f1_number'});
- my $function2 = $self->{'f2'};
- return DVAL 0 if (! $self->check_dependencies($calc, $i));
+ return if ($calc->signals->is_available($self->get_name, $i));
+
+ my $first = $self->{'args'}->get_arg_values($calc, $i, 1);
+ my $second = $self->{'args'}->get_arg_values($calc, $i, 2);
- if ($indic->get($function1_name, $i) > &$function2($calc, $i)) {
+ return if not defined($first);
+ return if not defined($second);
+
+ if ($first > $second) {
$calc->signals->set($self->get_name, $i, 1);
} else {
$calc->signals->set($self->get_name, $i, 0);
}
-}
-
-sub detect_interval {
- my ($self, $calc, $first, $last) = @_;
-
- $self->{'f1'}->calculate_interval($calc, $first, $last);
- if ($self->{'temp'})
- {
- $self->{'temp'}->calculate_interval($calc, $first, $last);
- }
-
- GT::Signals::detect_interval(@_);
}
1;
--- /bourse/cvsroot/GT/Signals/Generic/And.pm 2002/10/06 15:39:27 1.2
+++ /bourse/cvsroot/GT/Signals/Generic/And.pm 2003/01/02 22:25:20 1.3
@@ -4,6 +4,8 @@
# This file is distributed under the terms of the General Public License
# version 2 or (at your option) any later version.
+# Standards-Version: 1.0
+
use strict;
use vars qw(@ISA @NAMES);
@@ -23,31 +25,9 @@
mentionned signals also give positive signals.
=cut
-sub new {
- my $type = shift;
- my $class = ref($type) || $type;
- my $args = shift;
-
- my $self = { "args" => $args, "signals" => [], "sig_numner" => [] };
-
- return manage_object(\@NAMES, $self, $class, $self->{'args'}, "");
-}
-
sub initialize {
my ($self) = @_;
- my @args = @{$self->{'args'}};
-
- my ($re) = ($args[0] =~ /^([^:]+:)/);
- while (@args)
- {
- my @function = shift_args_until($re, @args);
- $function[0] =~ s/^$re/Signals:/;
- my $sig = create_standard_object(@function);
- push @{$self->{'signals'}}, $sig;
- push @{$self->{'sig_number'}}, extract_object_number(@function);
- $self->add_signal_dependency($sig, 1);
- }
}
sub detect {
@@ -56,29 +36,21 @@
my $signals = $calc->signals;
return if ($calc->signals->is_available($self->get_name, $i));
- return if (! $self->check_dependencies($calc, $i));
- for (my $n = 0; $n < scalar(@{$self->{'signals'}}); $n++)
+ my $defined = 0;
+ for (my $n = 1; $n <= $self->{'args'}->get_nb_args; $n++)
{
- my $signame = $self->{'signals'}[$n]->get_name(
- $self->{'sig_number'}[$n]);
- if (! $signals->get($signame, $i))
- {
+ my $value = $self->{'args'}->get_arg_values($calc, $i, $n);
+ next if (! defined($value));
+ $defined = 1;
+ if (! $value) {
$signals->set($self->get_name, $i, 0);
return;
}
}
- $signals->set($self->get_name, $i, 1);
-}
-
-sub detect_interval {
- my ($self, $calc, $first, $last) = @_;
-
- foreach (@{$self->{'signals'}})
- {
- $_->detect_interval($calc, $first, $last);
+ if ($defined) {
+ $signals->set($self->get_name, $i, 1);
}
- GT::Signals::detect_interval(@_);
}
1;
--- /bourse/cvsroot/GT/Signals/Generic/Below.pm 2002/12/22 00:55:26 1.3
+++ /bourse/cvsroot/GT/Signals/Generic/Below.pm 2003/01/02 22:25:20 1.4
@@ -4,13 +4,14 @@
# This file is distributed under the terms of the General Public License
# version 2 or (at your option) any later version.
+# Standards-Version: 1.0
+
use strict;
use vars qw(@ISA @NAMES);
use Carp::Datum;
use GT::Signals;
use GT::Eval;
-use GT::Indicators qw($GET_LAST);
use GT::Tools qw(:generic);
@ISA = qw(GT::Signals);
@@ -24,74 +25,28 @@
below something else which could be an other indicator, a limit or current prices.
=cut
-
-sub new {
- my $type = shift;
- my $class = ref($type) || $type;
- my $args = shift;
-
- my $self = { "args" => $args };
-
- return manage_object(\@NAMES, $self, $class, $self->{'args'}, "");
-}
-
sub initialize {
my ($self) = @_;
- my @args = @{$self->{'args'}};
-
- my @function1 = shift_args_until("(Indicators|I|Limit):", @args);
- $self->{'f1'} = create_standard_object(@function1);
- $self->{'f1_number'} = extract_object_number(@function1);
- $self->add_indicator_dependency($self->{'f1'}, 1);
-
- if (scalar @args)
- {
- if ($args[0] =~ /^Limit:(-?\d+(?:\.\d+)?)/) {
- my $number = $1;
- $self->{'f2'} = sub { return $number };
- } else {
- my @function2 = shift_args_until("", @args);
- $self->{'temp'} = create_standard_object(@function2);
- $self->{'temp_number'} = extract_object_number(@function2);
- $self->{'f2'} = sub {
- $_[0]->indicators->get($self->{'temp'}->get_name(
- $self->{'temp_number'}), $_[1])
- };
- $self->add_indicator_dependency($self->{'temp'}, 1);
- }
- } else {
- $self->{'f2'} = $GET_LAST;
- $self->add_prices_dependency(1);
- }
}
sub detect {
DFEATURE my $f;
my ($self, $calc, $i) = @_;
- my $indic = $calc->indicators;
- my $function1_name = $self->{'f1'}->get_name($self->{'f1_number'});
- my $function2 = $self->{'f2'};
- return DVAL 0 if (! $self->check_dependencies($calc, $i));
+ return if ($calc->signals->is_available($self->get_name, $i));
+
+ my $first = $self->{'args'}->get_arg_values($calc, $i, 1);
+ my $second = $self->{'args'}->get_arg_values($calc, $i, 2);
- if ($indic->get($function1_name, $i) < &$function2($calc, $i)) {
+ return if not defined($first);
+ return if not defined($second);
+
+ if ($first < $second) {
$calc->signals->set($self->get_name, $i, 1);
} else {
$calc->signals->set($self->get_name, $i, 0);
}
-}
-
-sub detect_interval {
- my ($self, $calc, $first, $last) = @_;
-
- $self->{'f1'}->calculate_interval($calc, $first, $last);
- if ($self->{'temp'})
- {
- $self->{'temp'}->calculate_interval($calc, $first, $last);
- }
-
- GT::Signals::detect_interval(@_);
}
1;
--- /bourse/cvsroot/GT/Signals/Generic/CrossOverDown.pm 2002/12/22 00:55:26 1.9
+++ /bourse/cvsroot/GT/Signals/Generic/CrossOverDown.pm 2003/01/02 22:25:20 1.10
@@ -4,13 +4,14 @@
# This file is distributed under the terms of the General Public License
# version 2 or (at your option) any later version.
+# Standards-Version: 1.0
+
use strict;
use vars qw(@ISA @NAMES);
use Carp::Datum;
use GT::Signals;
use GT::Eval;
-use GT::Indicators qw($GET_LAST);
use GT::Tools qw(:generic);
@ISA = qw(GT::Signals);
@@ -24,78 +25,29 @@
crossing down an other one.
=cut
-
-sub new {
- my $type = shift;
- my $class = ref($type) || $type;
- my $args = shift;
-
- my $self = { "args" => $args };
-
- return manage_object(\@NAMES, $self, $class, $self->{'args'}, "");
-}
-
sub initialize {
my ($self) = @_;
- my @args = @{$self->{'args'}};
-
- my @function1 = shift_args_until("(Indicators|I|Limit):", @args);
- $self->{'f1'} = create_standard_object(@function1);
- $self->{'f1_number'} = extract_object_number(@function1);
- $self->add_indicator_dependency($self->{'f1'}, 2);
-
- if (scalar @args)
- {
- if ($args[0] =~ /^Limit:(-?\d+(?:\.\d+)?)/) {
- my $number = $1;
- $self->{'f2'} = sub { return $number };
- } else {
- my @function2 = shift_args_until("", @args);
- $self->{'temp'} = create_standard_object(@function2);
- $self->{'temp_number'} = extract_object_number(@function2);
- $self->{'f2'} = sub {
- $_[0]->indicators->get($self->{'temp'}->get_name(
- $self->{'temp_number'}), $_[1])
- };
- $self->add_indicator_dependency($self->{'temp'}, 2);
- }
- } else {
- $self->{'f2'} = $GET_LAST;
- $self->add_prices_dependency(2);
- }
}
sub detect {
DFEATURE my $f;
my ($self, $calc, $i) = @_;
- my $indic = $calc->indicators;
- my $function1_name = $self->{'f1'}->get_name($self->{'f1_number'});
- my $function2 = $self->{'f2'};
- return DVAL 0 if (! $self->check_dependencies($calc, $i));
+ return if ($calc->signals->is_available($self->get_name, $i));
- if (($indic->get($function1_name, $i - 1) >=
- &$function2($calc, $i - 1)) and
- ($indic->get($function1_name, $i) < &$function2($calc, $i)) )
- {
+ my $first1 = $self->{'args'}->get_arg_values($calc, $i - 1, 1);
+ my $first2 = $self->{'args'}->get_arg_values($calc, $i, 1);
+ my $second1 = $self->{'args'}->get_arg_values($calc, $i - 1, 2);
+ my $second2 = $self->{'args'}->get_arg_values($calc, $i, 2);
+
+ return if (not (defined($first1) && defined($first2) && defined($second1) && defined($second2)));
+
+ if (($first1 >= $second1) and ($first2 < $second2)) {
$calc->signals->set($self->get_name, $i, 1);
} else {
$calc->signals->set($self->get_name, $i, 0);
}
}
-
-sub detect_interval {
- my ($self, $calc, $first, $last) = @_;
-
- $self->{'f1'}->calculate_interval($calc, $first, $last);
- if ($self->{'temp'})
- {
- $self->{'temp'}->calculate_interval($calc, $first, $last);
- }
-
- GT::Signals::detect_interval(@_);
-}
-
1;
--- /bourse/cvsroot/GT/Signals/Generic/CrossOverUp.pm 2002/12/22 00:55:26 1.12
+++ /bourse/cvsroot/GT/Signals/Generic/CrossOverUp.pm 2003/01/02 22:25:20 1.13
@@ -4,13 +4,14 @@
# This file is distributed under the terms of the General Public License
# version 2 or (at your option) any later version.
+# Standards-Version: 1.0
+
use strict;
use vars qw(@ISA @NAMES);
use Carp::Datum;
use GT::Signals;
use GT::Eval;
-use GT::Indicators qw($GET_LAST);
use GT::Tools qw(:generic);
@ISA = qw(GT::Signals);
@@ -21,80 +22,32 @@
=head2 Overview
This Generic Signal will be able to tell you when a specific indicator is
-crossing an other one.
+crossing down an other one.
=cut
-
-sub new {
- my $type = shift;
- my $class = ref($type) || $type;
- my $args = shift;
-
- my $self = { "args" => $args };
-
- return manage_object(\@NAMES, $self, $class, $self->{'args'}, "");
-}
-
sub initialize {
my ($self) = @_;
- my @args = @{$self->{'args'}};
-
- my @function1 = shift_args_until("(Indicators|I|Limit):", @args);
- $self->{'f1'} = create_standard_object(@function1);
- $self->{'f1_number'} = extract_object_number(@function1);
- $self->add_indicator_dependency($self->{'f1'}, 2);
-
- if (scalar @args)
- {
- if ($args[0] =~ /^Limit:(-?\d+(?:\.\d+)?)/) {
- my $number = $1;
- $self->{'f2'} = sub { return $number };
- } else {
- my @function2 = shift_args_until("", @args);
- $self->{'temp'} = create_standard_object(@function2);
- $self->{'temp_number'} = extract_object_number(@function2);
- $self->{'f2'} = sub {
- $_[0]->indicators->get($self->{'temp'}->get_name(
- $self->{'temp_number'}), $_[1])
- };
- $self->add_indicator_dependency($self->{'temp'}, 2);
- }
- } else {
- $self->{'f2'} = $GET_LAST;
- $self->add_prices_dependency(2);
- }
}
sub detect {
DFEATURE my $f;
my ($self, $calc, $i) = @_;
- my $indic = $calc->indicators;
- my $function1_name = $self->{'f1'}->get_name($self->{'f1_number'});
- my $function2 = $self->{'f2'};
- return DVAL 0 if (! $self->check_dependencies($calc, $i));
+ return if ($calc->signals->is_available($self->get_name, $i));
- if (($indic->get($function1_name, $i - 1) <=
- &$function2($calc, $i - 1)) and
- ($indic->get($function1_name, $i) > &$function2($calc, $i)) )
- {
+ my $first1 = $self->{'args'}->get_arg_values($calc, $i - 1, 1);
+ my $first2 = $self->{'args'}->get_arg_values($calc, $i, 1);
+ my $second1 = $self->{'args'}->get_arg_values($calc, $i - 1, 2);
+ my $second2 = $self->{'args'}->get_arg_values($calc, $i, 2);
+
+ return if (not (defined($first1) && defined($first2) && defined($second1) && defined($second2)));
+
+ if (($first1 <= $second1) and ($first2 > $second2)) {
$calc->signals->set($self->get_name, $i, 1);
} else {
$calc->signals->set($self->get_name, $i, 0);
}
-}
-
-sub detect_interval {
- my ($self, $calc, $first, $last) = @_;
-
- $self->{'f1'}->calculate_interval($calc, $first, $last);
- if ($self->{'temp'})
- {
- $self->{'temp'}->calculate_interval($calc, $first, $last);
- }
-
- GT::Signals::detect_interval(@_);
}
1;
--- /bourse/cvsroot/GT/Signals/Generic/Decrease.pm 2002/12/22 00:55:26 1.3
+++ /bourse/cvsroot/GT/Signals/Generic/Decrease.pm 2003/01/02 22:25:20 1.4
@@ -4,13 +4,14 @@
# This file is distributed under the terms of the General Public License
# version 2 or (at your option) any later version.
+# Standards-Version: 1.0
+
use strict;
use vars qw(@ISA @NAMES);
use Carp::Datum;
use GT::Signals;
use GT::Eval;
-use GT::Indicators qw($GET_LAST);
use GT::Tools qw(:generic);
@ISA = qw(GT::Signals);
@@ -21,51 +22,30 @@
=head2 Overview
This Generic Signal will be able to tell you when a specific indicator is
-decreasing from it's previous level.
+decreasing from its previous level.
=cut
-
-sub new {
- my $type = shift;
- my $class = ref($type) || $type;
- my $args = shift;
-
- my $self = { "args" => $args };
-
- return manage_object(\@NAMES, $self, $class, $self->{'args'}, "");
-}
-
sub initialize {
my ($self) = @_;
- my @args = @{$self->{'args'}};
-
- my @function1 = shift_args_until("(Indicators|I):", @args);
- $self->{'f1'} = create_standard_object(@function1);
- $self->{'f1_number'} = extract_object_number(@function1);
- $self->add_indicator_dependency($self->{'f1'}, 2);
}
sub detect {
- DFEATURE my $f;
my ($self, $calc, $i) = @_;
- my $indic = $calc->indicators;
- my $function1_name = $self->{'f1'}->get_name($self->{'f1_number'});
- return DVAL 0 if (! $self->check_dependencies($calc, $i));
+ return if ($calc->signals->is_available($self->get_name, $i));
+ return if ($i < 1);
- if ($indic->get($function1_name, $i) < $indic->get($function1_name, $i - 1)) {
+ my $first = $self->{'args'}->get_arg_values($calc, $i - 1, 1);
+ my $second = $self->{'args'}->get_arg_values($calc, $i, 1);
+
+ return if (not (defined($first) && defined($second)));
+
+ if ($first < $second) {
$calc->signals->set($self->get_name, $i, 1);
} else {
$calc->signals->set($self->get_name, $i, 0);
}
-}
-
-sub detect_interval {
- my ($self, $calc, $first, $last) = @_;
-
- $self->{'f1'}->calculate_interval($calc, $first, $last);
- GT::Signals::detect_interval(@_);
}
1;
--- /bourse/cvsroot/GT/Signals/Generic/Equal.pm 2002/12/22 00:55:26 1.3
+++ /bourse/cvsroot/GT/Signals/Generic/Equal.pm 2003/01/02 22:25:20 1.4
@@ -4,13 +4,14 @@
# This file is distributed under the terms of the General Public License
# version 2 or (at your option) any later version.
+# Standards-Version: 1.0
+
use strict;
use vars qw(@ISA @NAMES);
use Carp::Datum;
use GT::Signals;
use GT::Eval;
-use GT::Indicators qw($GET_LAST);
use GT::Tools qw(:generic);
@ISA = qw(GT::Signals);
@@ -24,74 +25,25 @@
equal to something else which could be an other indicator, a limit or current prices.
=cut
-
-sub new {
- my $type = shift;
- my $class = ref($type) || $type;
- my $args = shift;
-
- my $self = { "args" => $args };
-
- return manage_object(\@NAMES, $self, $class, $self->{'args'}, "");
-}
-
sub initialize {
my ($self) = @_;
- my @args = @{$self->{'args'}};
-
- my @function1 = shift_args_until("(Indicators|I|Limit):", @args);
- $self->{'f1'} = create_standard_object(@function1);
- $self->{'f1_number'} = extract_object_number(@function1);
- $self->add_indicator_dependency($self->{'f1'}, 1);
-
- if (scalar @args)
- {
- if ($args[0] =~ /^Limit:(-?\d+(?:\.\d+)?)/) {
- my $number = $1;
- $self->{'f2'} = sub { return $number };
- } else {
- my @function2 = shift_args_until("", @args);
- $self->{'temp'} = create_standard_object(@function2);
- $self->{'temp_number'} = extract_object_number(@function2);
- $self->{'f2'} = sub {
- $_[0]->indicators->get($self->{'temp'}->get_name(
- $self->{'temp_number'}), $_[1])
- };
- $self->add_indicator_dependency($self->{'temp'}, 1);
- }
- } else {
- $self->{'f2'} = $GET_LAST;
- $self->add_prices_dependency(1);
- }
}
sub detect {
- DFEATURE my $f;
my ($self, $calc, $i) = @_;
- my $indic = $calc->indicators;
- my $function1_name = $self->{'f1'}->get_name($self->{'f1_number'});
- my $function2 = $self->{'f2'};
-
- return DVAL 0 if (! $self->check_dependencies($calc, $i));
+ return if ($calc->signals->is_available($self->get_name, $i));
- if ($indic->get($function1_name, $i) eq &$function2($calc, $i)) {
- $calc->signals->set($self->get_name, $i, 1);
+ my $first = $self->{'args'}->get_arg_values($calc, $i, 1);
+ my $second = $self->{'args'}->get_arg_values($calc, $i, 2);
+
+ return if (not (defined($first) && defined($second)));
+
+ if ($first == $second) {
+ $calc->signals->set($self->get_name, $i, 1);
} else {
$calc->signals->set($self->get_name, $i, 0);
}
-}
-
-sub detect_interval {
- my ($self, $calc, $first, $last) = @_;
-
- $self->{'f1'}->calculate_interval($calc, $first, $last);
- if ($self->{'temp'})
- {
- $self->{'temp'}->calculate_interval($calc, $first, $last);
- }
-
- GT::Signals::detect_interval(@_);
}
1;
--- /bourse/cvsroot/GT/Signals/Generic/False.pm 2002/10/06 15:39:27 1.2
+++ /bourse/cvsroot/GT/Signals/Generic/False.pm 2003/01/02 22:25:20 1.3
@@ -4,6 +4,8 @@
# This file is distributed under the terms of the General Public License
# version 2 or (at your option) any later version.
+# Standards-Version: 1.0
+
use strict;
use vars qw(@ISA @NAMES);
@@ -20,16 +22,6 @@
Always return false.
=cut
-
-sub new {
- my $type = shift;
- my $class = ref($type) || $type;
-
- my $self = { "args" => [] };
-
- return manage_object(\@NAMES, $self, $class, $self->{'args'}, "");
-}
-
sub initialize {
my ($self) = @_;
--- /bourse/cvsroot/GT/Signals/Generic/Increase.pm 2002/12/22 00:55:26 1.3
+++ /bourse/cvsroot/GT/Signals/Generic/Increase.pm 2003/01/02 22:25:20 1.4
@@ -4,13 +4,14 @@
# This file is distributed under the terms of the General Public License
# version 2 or (at your option) any later version.
+# Standards-Version: 1.0
+
use strict;
use vars qw(@ISA @NAMES);
use Carp::Datum;
use GT::Signals;
use GT::Eval;
-use GT::Indicators qw($GET_LAST);
use GT::Tools qw(:generic);
@ISA = qw(GT::Signals);
@@ -21,51 +22,30 @@
=head2 Overview
This Generic Signal will be able to tell you when a specific indicator is
-increasing from it's previous level.
+increasing from its previous level.
=cut
-
-sub new {
- my $type = shift;
- my $class = ref($type) || $type;
- my $args = shift;
-
- my $self = { "args" => $args };
-
- return manage_object(\@NAMES, $self, $class, $self->{'args'}, "");
-}
-
sub initialize {
my ($self) = @_;
- my @args = @{$self->{'args'}};
-
- my @function1 = shift_args_until("(Indicators|I):", @args);
- $self->{'f1'} = create_standard_object(@function1);
- $self->{'f1_number'} = extract_object_number(@function1);
- $self->add_indicator_dependency($self->{'f1'}, 2);
}
sub detect {
- DFEATURE my $f;
my ($self, $calc, $i) = @_;
- my $indic = $calc->indicators;
- my $function1_name = $self->{'f1'}->get_name($self->{'f1_number'});
- return DVAL 0 if (! $self->check_dependencies($calc, $i));
+ return if ($calc->signals->is_available($self->get_name, $i));
+ return if ($i < 1);
- if ($indic->get($function1_name, $i) > $indic->get($function1_name, $i - 1)) {
+ my $first = $self->{'args'}->get_arg_values($calc, $i - 1, 1);
+ my $second = $self->{'args'}->get_arg_values($calc, $i, 1);
+
+ return if (not (defined($first) && defined($second)));
+
+ if ($first > $second) {
$calc->signals->set($self->get_name, $i, 1);
} else {
$calc->signals->set($self->get_name, $i, 0);
}
-}
-
-sub detect_interval {
- my ($self, $calc, $first, $last) = @_;
-
- $self->{'f1'}->calculate_interval($calc, $first, $last);
- GT::Signals::detect_interval(@_);
}
1;
--- /bourse/cvsroot/GT/Signals/Generic/Or.pm 2002/10/06 15:39:27 1.2
+++ /bourse/cvsroot/GT/Signals/Generic/Or.pm 2003/01/02 22:25:20 1.3
@@ -4,6 +4,8 @@
# This file is distributed under the terms of the General Public License
# version 2 or (at your option) any later version.
+# Standards-Version: 1.0
+
use strict;
use vars qw(@ISA @NAMES);
@@ -23,62 +25,30 @@
mentionned signals also give a positive signal.
=cut
-sub new {
- my $type = shift;
- my $class = ref($type) || $type;
- my $args = shift;
-
- my $self = { "args" => $args, "signals" => [], "sig_numner" => [] };
-
- return manage_object(\@NAMES, $self, $class, $self->{'args'}, "");
-}
-
sub initialize {
my ($self) = @_;
-
- my @args = @{$self->{'args'}};
-
- my ($re) = ($args[0] =~ /^([^:]+:)/);
- while (@args)
- {
- my @function = shift_args_until($re, @args);
- $function[0] =~ s/^$re/Signals:/;
- my $sig = create_standard_object(@function);
- push @{$self->{'signals'}}, $sig;
- push @{$self->{'sig_number'}}, extract_object_number(@function);
- $self->add_signal_dependency($sig, 1);
- }
}
sub detect {
my ($self, $calc, $i) = @_;
- my $indic = $calc->indicators;
my $signals = $calc->signals;
return if ($calc->signals->is_available($self->get_name, $i));
- return if (! $self->check_dependencies($calc, $i));
- for (my $n = 0; $n < scalar(@{$self->{'signals'}}); $n++)
+ my $defined = 0;
+ for (my $n = 1; $n < $self->{'args'}->get_nb_args; $n++)
{
- my $signame = $self->{'signals'}[$n]->get_name(
- $self->{'sig_number'}[$n]);
- if ($signals->get($signame, $i))
- {
+ my $value = $self->{'args'}->get_arg_values($calc, $i, $n);
+ next if (! defined($value));
+ $defined = 1;
+ if ($value) {
$signals->set($self->get_name, $i, 1);
return;
}
}
- $signals->set($self->get_name, $i, 0);
-}
-
-sub detect_interval {
- my ($self, $calc, $first, $last) = @_;
-
- foreach (@{$self->{'signals'}})
- {
- $_->detect_interval($calc, $first, $last);
+ if ($defined) {
+ $signals->set($self->get_name, $i, 0);
}
- GT::Signals::detect_interval(@_);
}
1;
--- /bourse/cvsroot/GT/Signals/Generic/True.pm 2002/10/06 15:39:27 1.2
+++ /bourse/cvsroot/GT/Signals/Generic/True.pm 2003/01/02 22:25:20 1.3
@@ -4,6 +4,8 @@
# This file is distributed under the terms of the General Public License
# version 2 or (at your option) any later version.
+# Standards-Version: 1.0
+
use strict;
use vars qw(@ISA @NAMES);
@@ -20,16 +22,6 @@
Always return true.
=cut
-
-sub new {
- my $type = shift;
- my $class = ref($type) || $type;
-
- my $self = { "args" => [] };
-
- return manage_object(\@NAMES, $self, $class, $self->{'args'}, "");
-}
-
sub initialize {
my ($self) = @_;
|
|
From: GeniusTrader C. r. <ra...@ge...> - 2003-01-02 23:27:49
|
Update of /bourse/cvsroot/GT
In directory p200:/scratch/tmp/cvs-serv8538
Modified Files:
ArgsTree.pm Indicators.pm Signals.pm
Log Message:
- Add precalculation system for ArgsTree.
- Make Signals use ArgsTree by default.
- Converted all Signals/Generic/*.pm to use ArgsTree.
--- /bourse/cvsroot/GT/ArgsTree.pm 2002/12/28 20:16:09 1.8
+++ /bourse/cvsroot/GT/ArgsTree.pm 2003/01/02 22:25:19 1.9
@@ -375,7 +375,45 @@
return DARY @res;
}
-=pod
+=item C<< $args->prepare($calc, $day) >>
+
+Precalculate all possible values for the given day.
+
+=cut
+sub prepare {
+ DFEATURE my $f;
+ my ($self, $calc, $day) = @_;
+ for(my $i = 1; $i < scalar(@{$self}); $i++) {
+ next if $self->is_constant($i);
+ my $object = $self->[$i][0]{"object"};
+ if (ref($object) =~ /GT::Indicators/) {
+ $object->calculate($calc, $day);
+ } elsif (ref($object) =~ /GT::Signals/) {
+ $object->detect($calc, $day);
+ }
+ }
+ return DVOID;
+}
+
+=item C<< $args->prepare_interval($calc, $first, $last) >>
+
+Precalculate all possible values for the given interval.
+
+=cut
+sub prepare_interval {
+ DFEATURE my $f;
+ my ($self, $calc, $first, $last) = @_;
+ for(my $i = 1; $i < scalar(@{$self}); $i++) {
+ next if $self->is_constant($i);
+ my $object = $self->[$i][0]{"object"};
+ if (ref($object) =~ /GT::Indicators/) {
+ $object->calculate_interval($calc, $first, $last);
+ } elsif (ref($object) =~ /GT::Signals/) {
+ $object->detect_interval($calc, $first, $last);
+ }
+ }
+ return DVOID;
+}
=back
--- /bourse/cvsroot/GT/Indicators.pm 2002/10/06 15:39:24 1.4
+++ /bourse/cvsroot/GT/Indicators.pm 2003/01/02 22:25:19 1.5
@@ -139,6 +139,9 @@
sub calculate_interval {
my ($self, $calc, $first, $last) = @_;
+ if (ref($self->{'args'}) =~ /GT::ArgsTree/) {
+ $self->{'args'}->prepare_interval($calc, $first, $last);
+ }
for (my $i = $first; $i <= $last; $i++)
{
$self->calculate($calc, $i);
@@ -170,6 +173,5 @@
=cut
# Those functions are exported by GT::Registry
-
1;
--- /bourse/cvsroot/GT/Signals.pm 2002/10/06 15:39:25 1.4
+++ /bourse/cvsroot/GT/Signals.pm 2003/01/02 22:25:19 1.5
@@ -38,7 +38,20 @@
=item C<< $sig->get_name or $sig->get_name($i) >>
-Returns the name of the signal specified.
+Get the name of the signal. If the signal returns several values,
+you can get the name corresponding to any value, you just have to
+precise in the parameters the index of the value that you're interested
+in.
+
+=item C<< $sig->get_nb_values >>
+
+Return the number of different values produced by this signal that are
+available for use.
+
+=item C<< $sig->initialize() >>
+
+This callback function is called at creating time. Since the "new" function
+is inherited, you should do the initialization via this function.
=item C<< $sig->detect($calc, $i) >>
@@ -82,10 +95,41 @@
}
-# Default methods for objects
+# DEFAULT FUNCTIONS FOR SIGNALS
+sub new {
+ my ($type, $args, $key, $func) = @_;
+ my $class = ref($type) || $type;
+
+ no strict "refs";
+
+ my $self = { };
+ if (defined($args)) {
+ $self->{'args'} = GT::ArgsTree->new(@{$args});
+ } elsif (defined (@{"$class\::DEFAULT_ARGS"})) {
+ $self->{'args'} = GT::ArgsTree->new(@{"$class\::DEFAULT_ARGS"});
+ } else {
+ $self->{'args'} = GT::ArgsTree->new(); # no args
+ }
+
+ if (defined($func)) {
+ $self->{'func'} = $func;
+ }
+
+ return manage_object(\@{"$class\::NAMES"}, $self, $class, $self->{'args'}, $key);
+}
+
+# Provide a default non-optimized version of detect_interval that
+# calls detect once for each day.
+#
+# Real signals are encouraged to override this function to provide an
+# optimized version of the detection algorithm by possibly reusing
+# the result of previous days.
sub detect_interval {
my ($self, $calc, $first, $last) = @_;
+ if (ref($self->{'args'}) =~ /GT::ArgsTree/) {
+ $self->{'args'}->prepare_interval($calc, $first, $last);
+ }
for (my $i = $first; $i <= $last; $i++)
{
$self->detect($calc, $i);
|
|
From: Raphael H. <rhe...@hr...> - 2003-01-01 14:34:05
|
Happy New Year to everyone ! Best wishes, I hope you will have success in trading with GeniusTrader. ;-) Cheers, -- Raphaël Hertzog -+- http://www.ouaza.com Formation Linux et logiciel libre : http://www.logidee.com |
|
From: GeniusTrader C. r. <ra...@ge...> - 2002-12-28 21:39:25
|
Update of /bourse/cvsroot/Scripts
In directory p200:/scratch/tmp/cvs-serv24304
Modified Files:
display_indicator.pl display_signal.pl
Log Message:
- Update scripts to be able to use the new aliases. The change
is not backward compatible. Before you typed "module" as parameter
now you have to type "I:module" or "S:module" or "@I:alias"
or "@S:alias"...
--- /bourse/cvsroot/Scripts/display_indicator.pl 2002/10/06 15:40:35 1.8
+++ /bourse/cvsroot/Scripts/display_indicator.pl 2002/12/28 20:34:05 1.9
@@ -41,7 +41,7 @@
my $indicator_module = shift;
my $code = shift;
-my $indicator = create_standard_object("Indicators::$indicator_module",
+my $indicator = create_standard_object("$indicator_module",
@ARGV);
# Il faut créer tout le framework
--- /bourse/cvsroot/Scripts/display_signal.pl 2002/10/06 15:40:35 1.6
+++ /bourse/cvsroot/Scripts/display_signal.pl 2002/12/28 20:34:06 1.7
@@ -40,7 +40,7 @@
my $signal_module = shift;
my $code = shift;
-my $signal = create_standard_object("Signals::$signal_module", @ARGV);
+my $signal = create_standard_object("$signal_module", @ARGV);
# Create the complete framework
my $db = create_standard_object("DB::" . GT::Conf::get("DB::module"));
|
|
From: GeniusTrader C. r. <ra...@ge...> - 2002-12-28 21:17:49
|
Update of /bourse/cvsroot/GT
In directory p200:/scratch/tmp/cvs-serv23900
Modified Files:
ArgsTree.pm Eval.pm Tools.pm
Log Message:
- Share more code between modules.
- Documentation updates.
- Some fixes in GT::ArgsTree::parse_args.
--- /bourse/cvsroot/GT/ArgsTree.pm 2002/12/28 18:30:23 1.7
+++ /bourse/cvsroot/GT/ArgsTree.pm 2002/12/28 20:16:09 1.8
@@ -301,7 +301,7 @@
# Retrieve all arguments of this new object
my $args = "";
my $count = 1;
- while (@l) {
+ while (scalar(@l)) {
$_ = shift @l;
$count++ if /^\s*{\s*$/;
$count-- if /^\s*}\s*$/;
@@ -314,13 +314,7 @@
my ($n, @args) = parse_args($args);
DTRACE "Left to parse: @l\n";
- my (@names) = map {
- if (ref($_) =~ /ARRAY/) {
- $_->[0]{'standard_name'}||$_->[0]{'full_name'};
- } else {
- $_;
- }
- } @args;
+ my (@names) = args_to_ascii(@args);
# If the object is an alias, resolve it
if ($obj =~ /^@(\S+)$/) {
@@ -331,8 +325,8 @@
}
# Add the new object
- $full_name .= " { $obj $n } ";
- push @objects, [ { "full_name" => $full_name, "name" => $obj }, @args ];
+ $full_name .= " {$obj $n}";
+ push @objects, [ { "full_name" => "{$obj $n}", "name" => $obj }, @args ];
DTRACE "New argument: $objects[$#objects]\n";
DTRACE "Current list of argument: @objects\n";
@@ -360,6 +354,25 @@
}
return DARY ($full_name, @objects);
+}
+
+=item C<< GT::ArgsTree::args_to_ascii(@args) >>
+
+Return the ascii representation of all the parameters described in
+@args.
+
+=cut
+sub args_to_ascii {
+ DFEATURE my $f;
+ my @args = @_;
+ my @res = map {
+ if (ref($_) =~ /ARRAY/) {
+ $_->[0]{'standard_name'}||$_->[0]{'full_name'}
+ } else {
+ $_
+ }
+ } @args;
+ return DARY @res;
}
=pod
--- /bourse/cvsroot/GT/Eval.pm 2002/12/28 18:30:23 1.8
+++ /bourse/cvsroot/GT/Eval.pm 2002/12/28 20:16:10 1.9
@@ -9,6 +9,7 @@
use Carp::Datum;
use GT::Conf;
+use GT::ArgsTree;
use GT::Tools qw(:conf);
require Exporter;
@@ -35,25 +36,34 @@
=cut
sub create_standard_object {
DFEATURE my $f;
- my ($type, @params) = @_;
+ my ($type, @rawparams) = @_;
$type = long_name($type);
-
$type =~ s#/\d+##g;
- # TODO
- # Look for aliases first
- #my $def = resolve_object_alias($type, @params);
-
+ my ($name, @args) = GT::ArgsTree::parse_args(join(" ", @rawparams));
+ if ($type =~ /^@(\S+)$/) {
+ my $def = resolve_object_alias(long_name($1), @args);
+ DTRACE "Alias $1 maps to $def\n";
+ if ($def =~ /^\s*{(.*)}\s*$/) {
+ $def = $1;
+ }
+ if ($def =~ /^\s*(\S+)\s*(.*)\s*$/) {
+ $type = long_name($1);
+ ($name, @args) = GT::ArgsTree::parse_args($2);
+ }
+ }
+
my $object;
my $eval = "use GT::$type;\n";
$eval .= "\$object = GT::$type->new(";
- if (scalar(@params))
+ if (scalar(@args))
{
$eval .= "[" . join(",", map { if (/^\d+$/) { $_ } else { "'$_'" } }
- @params) . "]";
+ GT::ArgsTree::args_to_ascii(@args)) . "]";
}
$eval .= ");";
+ DTRACE "create_standard_object with: $eval";
eval $eval;
die $@ if ($@);
--- /bourse/cvsroot/GT/Tools.pm 2002/12/28 18:30:23 1.13
+++ /bourse/cvsroot/GT/Tools.pm 2002/12/28 20:16:10 1.14
@@ -18,6 +18,8 @@
use GT::Prices;
use GT::Eval;
+use GT::ArgsTree;
+
use Carp qw(cluck);
=head1 NAME
@@ -148,9 +150,9 @@
}
my $sysname = '';
if (scalar @param) {
- $sysname = GT::Conf::get("Aliases::$name" . "[]");
+ $sysname = GT::Conf::get("Aliases::Global::$name" . "[]");
} else {
- $sysname = GT::Conf::get("Aliases::$name");
+ $sysname = GT::Conf::get("Aliases::Global::$name");
}
if (! $sysname)
{
@@ -182,11 +184,25 @@
return $sysname;
}
-=over
-
=item C<< resolve_object_alias($alias, @param) >>
-Return the complete description of the object designed by "alias".
+Return the complete description of the object designed by "alias". @param
+is the array of parameters as returned by GT::ArgsTree::parse_args().
+
+Object aliases can be defined in global files
+(/usr/share/geniustrader/aliases/indicators for example) or in custom
+files (~/.gt/aliases/indicators) or in the standard configuration file
+with entries like this one :
+
+ Aliases::Indicators::MyMean { I:Generic:Eval ( #1 + #2 ) / 2 }
+
+Then you can use this alias in any other place where you could have used
+a standard indicator as argument. Here's how you would reference it with
+custom parameters :
+
+ { @I:MyMean 50 {I:RSI} }
+
+If you don't need any parameters then you can just say "@I:MyMean".
=cut
sub resolve_object_alias {
@@ -221,9 +237,9 @@
my $def = GT::Conf::get("Aliases::$alias");
my $n = 1;
- foreach (@param)
+ foreach my $arg (GT::ArgsTree::args_to_ascii(@param))
{
- $def =~ s/#$n/$_/g;
+ $def =~ s/#$n/$arg/g;
$n++;
}
@@ -241,6 +257,28 @@
=item C<< my $l = long_name($short) >>
=item C<< my $s = short_name($long) >>
+
+Most module names can be shortened with some standard abreviations. Those
+functions let you switch between the long and the short version of the
+names. The recognized abreviations are :
+
+=over
+
+=item Indicators:: = I:
+
+=item Signals:: = S:
+
+=item Systems:: = SY:
+
+=item CloseStrategy:: = CS:
+
+=item OrderFactory:: = OF:
+
+=item TradeFilters:: = TF:
+
+=item MoneyManagement:: = MM:
+
+=back
=cut
sub long_name {
|
|
From: Raphael H. <ra...@ge...> - 2002-12-28 20:35:23
|
Hello,
as you can have seen, I've setup the CVS repository so that each time
that something is committed, the log message and the diff are sent to the
list. I hope it will help you follow more closely the development of GT.
;-)
There are 15 people subscribed to this list, I'd like to get more
contributions. Don't hesitate to tell me what else you need to
work, etc.
Le Sat, Dec 28, 2002 at 07:30:24PM +0100, GeniusTrader CVS rhertzog écrivait:
> Modified Files:
> ArgsTree.pm Eval.pm TODO Tools.pm
> Log Message:
> - Add support of Aliases in ArgsTree. You can now have aliases
> of Indicators/Signals/Systems/etc.
> - Aliases can be defined in global files like
> /usr/share/geniustrader/aliases/indicators or in custom file
> ~/.gt/aliases/indicators or directly in ~/.gt/options with
> "Aliases::Indicators::name ...".
> - Many changes needed for that.
I made those changes since I like the idea of Oliver avout having
aliases for signals, indicators, etc. in order to facilitate the use
of the Generic modules ... however it has not been easy and I'm not
completely satisfied with the result but at least it seems to work.
Here's an example of an alias for an indicator :
Aliases::Indicators::Mean { I:Generic:Eval ( #1 + #2 ) / 2 }
Here's an example of an alias for a signal (and you can see how you can
use aliases within other aliases) :
Aliases::Signals::AboveMean { S:Generic:Above #1 { @I:Mean #2 50 } }
(this signal doesn't work yet since Generic/Above has not been updated
to use GT::ArgsTree)
Cheers,
--
Raphaël Hertzog -+- http://www.ouaza.com
Formation Linux et logiciel libre : http://www.logidee.com
|
|
From: GeniusTrader C. r. <ra...@ge...> - 2002-12-28 19:39:29
|
Update of /bourse/cvsroot/GT
In directory p200:/scratch/tmp/cvs-serv21666
Modified Files:
ArgsTree.pm Eval.pm TODO Tools.pm
Log Message:
- Add support of Aliases in ArgsTree. You can now have aliases
of Indicators/Signals/Systems/etc.
- Aliases can be defined in global files like
/usr/share/geniustrader/aliases/indicators or in custom file
~/.gt/aliases/indicators or directly in ~/.gt/options with
"Aliases::Indicators::name ...".
- Many changes needed for that.
--- /bourse/cvsroot/GT/ArgsTree.pm 2002/12/23 23:20:19 1.6
+++ /bourse/cvsroot/GT/ArgsTree.pm 2002/12/28 18:30:23 1.7
@@ -8,7 +8,7 @@
use vars qw();
use GT::Eval;
-use GT::Tools qw(:generic);
+use GT::Tools qw(:generic :conf);
use Carp::Datum;
@@ -60,76 +60,14 @@
DFEATURE my $f;
my ($self, @args) = @_;
- my @names = ("");
- my @objects = ($self);
- my @l = split(/(\s*[\{\}]\s*|\"|\s+)/, join(" ", @args));
- my $started = 0;
- my $in_quote = 0;
- my $string = "";
+ my ($name, @objects) = parse_args(join(" ", @args));
- # Remove leading/trailing empty elements
- while (scalar(@l) > 0) {
- if ($l[0] =~ m/^\s*$/) {
- shift @l;
- } else {
- last;
- }
- }
- while (scalar(@l) > 0) {
- if ($l[$#l] =~ m/^\s*$/) {
- pop @l;
- } else {
- last;
- }
- }
- # Treatment
- while (defined($_ = shift @l)) {
- DTRACE "Treating part of argument list: « $_ »\n";
- if ($in_quote) {
- $names[$#names] .= $_;
- if (/^"$/) { #end of string
- push @{$objects[$#objects]}, $string;
- $in_quote = 0;
- DTRACE "Full string argument: $string";
- } else {
- $string .= $_;
- }
- } else {
- if (/^\s*{\s*$/) { # New complex subargument
- $names[$#names] .= " { ";
- push @names, "";
- push @objects, [ { "full_name" => undef } ];
- $started = 1;
- } elsif (/^\s*}\s*$/) { # End of subargument
- my $subname = pop(@names);
- my $subarg = pop(@objects);
- $subarg->[0]{"full_name"} = "{$subname}";
- $names[$#names] .= $subname . " } ";
- push @{$objects[$#objects]}, $subarg;
- DTRACE "Nouvel argument pour objet $#objects : $subarg";
- DTRACE "Objet $#objects : @{$objects[$#objects]}";
- } elsif (/^\s*$/) { # New argument
- $names[$#names] .= " ";
- } elsif (/^"$/) {
- $in_quote = 1;
- $string = "";
- $names[$#names] .= '"';
- } else { # New data
- $names[$#names] .= $_;
- if ($started) {
- $objects[$#objects][0]{"name"} = $_;
- $started = 0;
- } else {
- push @{$objects[$#objects]}, $_;
- DTRACE "Nouvel argument pour objet $#objects : $_";
- DTRACE "Objet $#objects : @{$objects[$#objects]}";
- }
- }
- }
+ push @{$self}, @objects;
+ if ($self->[0]{"full_name"}) {
+ $self->[0]{"full_name"} .= " $name";
+ } else {
+ $self->[0]{"full_name"} = $name;
}
- DENSURE scalar(@objects) <= 1, "Unmatched brackets during creation of ArgsTree";
-
- $self->[0]{"full_name"} .= $names[0];
$self->create_objects(); # Update the associated objects
return DVOID;
}
@@ -305,6 +243,123 @@
my ($self) = @_;
my $res = scalar(@{$self}) - 1;
return DVAL $res;
+}
+
+=item C<< my ($full_name, @args) = GT::ArgsTree::parse_args($args) >>
+
+Parse the arguments in $args and return the parsed content in the form
+of two arrays (list of arguments).
+
+=cut
+sub parse_args {
+ DFEATURE my $f;
+
+ my ($args) = @_;
+
+ my (@objects) = ();
+ my $full_name = "";
+
+ my @l = split(/(\s*[\{\}]\s*|\"|\s+)/, $args);
+
+ my $started = 0;
+ my $in_quote = 0;
+ my $string = "";
+
+ # Remove leading/trailing empty elements
+ while (scalar(@l) > 0) {
+ if ($l[0] =~ m/^\s*$/) {
+ shift @l;
+ } else {
+ last;
+ }
+ }
+ while (scalar(@l) > 0) {
+ if ($l[$#l] =~ m/^\s*$/) {
+ pop @l;
+ } else {
+ last;
+ }
+ }
+ # Treatment
+ DTRACE "Parse args : @l\n";
+ while (scalar(@l)) {
+ $_ = shift @l;
+ DTRACE "Treating part of argument list: « $_ »\n";
+ if ($in_quote) {
+ $full_name .= $_;
+ if (/^"$/) { #end of string
+ push @objects, $string;
+ $in_quote = 0;
+ DTRACE "Full string argument: $string";
+ } else {
+ $string .= $_;
+ }
+ } else {
+ if (/^\s*{\s*$/) { # New complex subargument
+ my $obj = shift @l;
+
+ # Retrieve all arguments of this new object
+ my $args = "";
+ my $count = 1;
+ while (@l) {
+ $_ = shift @l;
+ $count++ if /^\s*{\s*$/;
+ $count-- if /^\s*}\s*$/;
+ last if $count == 0;
+ $args .= $_;
+ }
+ DENSURE $count == 0, "Unmatched brackets in arg processing\n";
+
+ # Parse the arguments ///
+ my ($n, @args) = parse_args($args);
+ DTRACE "Left to parse: @l\n";
+
+ my (@names) = map {
+ if (ref($_) =~ /ARRAY/) {
+ $_->[0]{'standard_name'}||$_->[0]{'full_name'};
+ } else {
+ $_;
+ }
+ } @args;
+
+ # If the object is an alias, resolve it
+ if ($obj =~ /^@(\S+)$/) {
+ my $def = resolve_object_alias(long_name($1), @names);
+ DTRACE "Alias $1 maps to $def\n";
+ unshift @l, split(/(\s*[\{\}]\s*|\"|\s+)/, $def);
+ next;
+ }
+
+ # Add the new object
+ $full_name .= " { $obj $n } ";
+ push @objects, [ { "full_name" => $full_name, "name" => $obj }, @args ];
+ DTRACE "New argument: $objects[$#objects]\n";
+ DTRACE "Current list of argument: @objects\n";
+
+ } elsif (/^\s*$/) { # New argument
+ # Nothing
+ $full_name .= " ";
+ } elsif (/^"$/) {
+ $in_quote = 1;
+ $string = "";
+ $full_name .= '"';
+ } else { # New data
+ if (/^@(\S+)$/) {
+ my $def = resolve_object_alias(long_name($1));
+ DTRACE "Alias $1 maps to $def\n";
+ unshift @l, split(/(\s*[\{\}]\s*|\"|\s+)/, $def);
+ next;
+ } else {
+ $full_name .= $_;
+ push @objects, $_;
+ DTRACE "New argument: $_\n";
+ DTRACE "Current list of argument: @objects\n";
+ }
+ }
+ }
+ }
+
+ return DARY ($full_name, @objects);
}
=pod
--- /bourse/cvsroot/GT/Eval.pm 2002/10/06 15:39:24 1.7
+++ /bourse/cvsroot/GT/Eval.pm 2002/12/28 18:30:23 1.8
@@ -8,6 +8,9 @@
use vars qw(@EXPORT @ISA);
use Carp::Datum;
+use GT::Conf;
+use GT::Tools qw(:conf);
+
require Exporter;
@ISA = qw(Exporter);
@@ -34,21 +37,17 @@
DFEATURE my $f;
my ($type, @params) = @_;
- $type =~ s/CS::?/CloseStrategy::/g;
- $type =~ s/OF::?/OrderFactory::/g;
- $type =~ s/TF::?/TradeFilters::/g;
- $type =~ s/MM::?/MoneyManagement::/g;
- $type =~ s/S::?/Systems::/g;
- $type =~ s/I::?/Indicators::/g;
- $type =~ s/:+/::/g;
-
+ $type = long_name($type);
+
$type =~ s#/\d+##g;
- $type = "GT::$type";
+ # TODO
+ # Look for aliases first
+ #my $def = resolve_object_alias($type, @params);
my $object;
- my $eval = "use $type;\n";
- $eval .= "\$object = $type->new(";
+ my $eval = "use GT::$type;\n";
+ $eval .= "\$object = GT::$type->new(";
if (scalar(@params))
{
$eval .= "[" . join(",", map { if (/^\d+$/) { $_ } else { "'$_'" } }
@@ -75,13 +74,7 @@
$n =~ s/GT:://g;
if ($shorten)
{
- $n =~ s/Indicators::/I:/g;
- $n =~ s/Systems::/S:/g;
- $n =~ s/TradeFilters::/TF:/g;
- $n =~ s/CloseStrategy::/CS:/g;
- $n =~ s/MoneyManagement::/MM:/g;
- $n =~ s/OrderFactory::/OF:/g;
- $n =~ s/::/:/g;
+ $n = short_name($n);
}
if (ref($object->{'args'}) =~ /GT::ArgsTree/) {
$n .= " " . join(" ", $object->{'args'}->get_arg_names());
--- /bourse/cvsroot/GT/TODO 2002/12/22 00:55:49 1.44
+++ /bourse/cvsroot/GT/TODO 2002/12/28 18:30:23 1.45
@@ -7,7 +7,11 @@
- update all indicators/signals for GT::ArgsTree support
(add "standards-version: 1.0" header when done to remember
that it has been done)
-
+
+- Add a system of alias for Indicators/Signals/Systems/etc. and not
+ only complete trading system as is the case currently. Add a system-wide
+ list of aliases (which is overrided by the user's list of aliases).
+
- Add a new MoneyManagement module enabling us to multiply the quantity
of shares when a TradeFilter answers "accept trade". The idea is to
augment the position when market conditions are favorable instead
@@ -37,7 +41,7 @@
of Ralph Vince f*. (cf book of Béchu)
- Create a script like analyze_backtest.pl which puts all results on
- some web pages with graphics ("quity curve" and "underwater equity curve").
+ some web pages with graphics ("equity curve" and "underwater equity curve").
- Rehash how money management works. Ideas :
1. Decide how much money is available (we really need both money available
--- /bourse/cvsroot/GT/Tools.pm 2002/10/06 15:39:25 1.12
+++ /bourse/cvsroot/GT/Tools.pm 2002/12/28 18:30:23 1.13
@@ -10,10 +10,10 @@
require Exporter;
@ISA = qw(Exporter);
@EXPORT_OK = qw(min max shift_args_until extract_object_number resolve_alias
- PI sign);
+ resolve_object_alias PI sign long_name short_name);
%EXPORT_TAGS = ("math" => [qw(min max PI sign)],
"generic" => [qw(shift_args_until extract_object_number)],
- "conf" => [qw(resolve_alias)]
+ "conf" => [qw(resolve_alias resolve_object_alias long_name short_name)]
);
use GT::Prices;
@@ -180,6 +180,96 @@
die "The alias '$alias' is lacking the parameter number $1.\n";
}
return $sysname;
+}
+
+=over
+
+=item C<< resolve_object_alias($alias, @param) >>
+
+Return the complete description of the object designed by "alias".
+
+=cut
+sub resolve_object_alias {
+ my ($alias, @param) = (@_);
+
+ # Load the various definition of aliases
+ GT::Conf::default('Path::Aliases::Signals', '/usr/share/geniustrader/aliases/signals');
+ GT::Conf::default('Path::Aliases::Indicators', '/usr/share/geniustrader/aliases/indicators');
+ GT::Conf::default('Path::Aliases::Systems', '/usr/share/geniustrader/aliases/systems');
+ GT::Conf::default('Path::Aliases::CloseStrategy', '/usr/share/geniustrader/aliases/closestrategy');
+ GT::Conf::default('Path::Aliases::MoneyManagement', '/usr/share/geniustrader/aliases/moneymanagement');
+ GT::Conf::default('Path::Aliases::TradeFilters', '/usr/share/geniustrader/aliases/tradefilters');
+ GT::Conf::default('Path::Aliases::OrderFactory', '/usr/share/geniustrader/aliases/orderfactory');
+
+ foreach my $kind ("Signals", "Indicators", "Systems", "CloseStrategy",
+ "MoneyManagement", "TradeFilters", "OrderFactory")
+ {
+ foreach my $file ($ENV{'HOME'}."/.gt/aliases/".lc($kind), GT::Conf::get("Path::Aliases::$kind"))
+ {
+ next if not -e $file;
+ open(ALIAS, "<$file") || die "Can't open $file : $!\n";
+ while (defined($_=<ALIAS>)) {
+ if (/^\s*(\S+)\s+(.*)$/) {
+ GT::Conf::default("Aliases::$kind\::$1", $2);
+ }
+ }
+ close ALIAS;
+ }
+ }
+
+ # Lookup the alias
+ my $def = GT::Conf::get("Aliases::$alias");
+
+ my $n = 1;
+ foreach (@param)
+ {
+ $def =~ s/#$n/$_/g;
+ $n++;
+ }
+
+ # Take care about operators + - / * in a string like #1+#2
+ eval {
+ $def =~ s|(\d+)\*(\d+)| $1 * $2 |eg;
+ $def =~ s|(\d+)\/(\d+)| $1 / $2 |eg;
+ $def =~ s|(\d+)\+(\d+)| $1 + $2 |eg;
+ $def =~ s|(\d+)\-(\d+)| $1 - $2 |eg;
+ };
+
+ return $def;
+}
+
+=item C<< my $l = long_name($short) >>
+
+=item C<< my $s = short_name($long) >>
+
+=cut
+sub long_name {
+ my ($name) = @_;
+
+ $name =~ s/CS::?/CloseStrategy::/g;
+ $name =~ s/OF::?/OrderFactory::/g;
+ $name =~ s/TF::?/TradeFilters::/g;
+ $name =~ s/MM::?/MoneyManagement::/g;
+ $name =~ s/SY::?/Systems::/g;
+ $name =~ s/S::?/Signals::/g;
+ $name =~ s/I::?/Indicators::/g;
+ $name =~ s/:+/::/g;
+
+ return $name;
+}
+sub short_name {
+ my ($name) = @_;
+
+ $name =~ s/Iname dicators::/I:/g;
+ $name =~ s/Systems::/SY:/g;
+ $name =~ s/Signame als::/S:/g;
+ $name =~ s/TradeFilters::/TF:/g;
+ $name =~ s/CloseStrategy::/CS:/g;
+ $name =~ s/Moname eyManame agemename t::/MM:/g;
+ $name =~ s/OrderFactory::/OF:/g;
+ $name =~ s/::/:/g;
+
+ return $name;
}
=back
|
|
From: Raphael H. <ra...@ge...> - 2002-12-24 15:47:24
|
Le Tue, Dec 24, 2002 at 09:42:48AM +0100, ol...@ol... écrivait:
> Hi Raphael,
Hi Oliver,
> is a really powerful feature - but I will need some time to really get
> through it and get it managed. :-)
Sure ... each time I write a new indicator I have to look again how it
works because I forgot part of it. :)
> I included two small patches for the graphic-functions to avoid div0`s.
> I noticed that these files produce an error if an indicator is constant
> zero (this should usually not occur and was due to an implementation-error
> in an indicator) :-)
Applied with changes. Just take care with your "&&". The && operator has
high precedence so you must usually use bracket to define the scope
correctly. Otherwise you can use the "and" operator. You also used "&"
which is the "binary and" ... I don't think you wanted to use that.
Also get_value_from_coordinate is meant to return a pair of values
and not just 0...
> And one last question before Xmas: What is the easiest way to combine
> serveral systems according to your design?
You should be more precise in what you mean with "combine several
systems"...
When you tell me combine signals I think about : Signals::Generic::And
and Signals::Generic::Or. Then you can use those signals with
Systems::Generic ...
This will correctly work once we have converted those modules to use
Gt::ArgsTree. Right now it can't work because both Systems::Generic and
Signals::Generic::{And,Or} expect parameters with "Signals:" and thus
they can't be differentiated. This is fixed with the nesting that is
possible with the "{ object args }" syntax of GT::ArgsTree.
> I did it like that: I created two signals for each Indicator I want to
> use (for example CCIUp, CCIDown, SMACrossUp, SMACrossDown). I next used
> these signals in the Systems for that indicator alone (Systems::CCI)
> and also in the combined System (Systems::CCIandSMA).
> When I define the System as an Alias it is not possible to visualize it
> as BuySellArrows in the chart and by using generic signals instead of
> the specifically created ones I would have to do every codechange in all
> modules using this signal ... is this the right way or is this the way to
> the dark side of the code?
You're right here in several points :
- we can't have alias of signals alone (aliases exist only for Systems
at the current time)
- the result of the backtest doesn't integrate nicely with the graphic
stuff, we can only display signal on the graphic and not information
extracted from the result of a backtest
This ought to be fixed but right now it's not. You'll have to live with
this little pain until then ... :)
> Joyeux Noelle!
Joyeux Noël ! Fröhliche Weihnacht !
Cheers,
--
Raphaël Hertzog -+- http://www.ouaza.com
Formation Linux et logiciel libre : http://www.logidee.com
|
|
From: <ol...@ol...> - 2002-12-24 09:44:19
|
Hi Raphael, > Ok applied. BTW, please try to respect my "coding-style" : > - indent of 4 spaces (tabs are like 8 spaces) > - block start at the same level than if/while/etc No problem. > Ok here are my comments : [...] > Otherwise you're not using the new GT::ArgsTree. I suggest that any new > indicator should use it to manage the parameters instead of the simple > parameters we always used. [...] > I suggest that you adapt your two indicators based on those remarks > (including the ones about coding style :)) and I'll take another look > once those changes are implemented. Thank you very much for your comments. I will adapt the indicators to the GT::ArgsTree-architecture (and your coding-style :) ). The GT::ArgsTree is a really powerful feature - but I will need some time to really get through it and get it managed. :-) I included two small patches for the graphic-functions to avoid div0`s. I noticed that these files produce an error if an indicator is constant zero (this should usually not occur and was due to an implementation-error in an indicator) :-) And one last question before Xmas: What is the easiest way to combine serveral systems according to your design? I did it like that: I created two signals for each Indicator I want to use (for example CCIUp, CCIDown, SMACrossUp, SMACrossDown). I next used these signals in the Systems for that indicator alone (Systems::CCI) and also in the combined System (Systems::CCIandSMA). When I define the System as an Alias it is not possible to visualize it as BuySellArrows in the chart and by using generic signals instead of the specifically created ones I would have to do every codechange in all modules using this signal ... is this the right way or is this the way to the dark side of the code? Joyeux Noelle! Olf |
|
From: Raphael H. <ra...@ge...> - 2002-12-24 00:22:51
|
Le Mon, Dec 23, 2002 at 02:57:55PM +0100, ol...@ol... écrivait:
> Hi,
Hi,
> will have to place a lot of unsophisticated questions before i really
> understand the system. So please be patient... :-)
Sure ... I didn't understand correctly my own system at the beginning
:-) the actual design is the sum of dozen of little design changes
because it's totally impossible to get it right the first time.
> I append two small patches: One fixes an error introduced by my last
> patch for graphic.pl: When you use the Getopt::Long-Package you have
> first enable the "pass_through"-mode, then check for a single
Ok applied. BTW, please try to respect my "coding-style" :
- indent of 4 spaces (tabs are like 8 spaces)
- block start at the same level than if/while/etc
> parameter and then process the rest. The second one is one single
> additional line for the ZigZag-Indicator after "=cut". My version of
> pod2text did not recognized the end of the POD-documentation. But maybe
> this is only due to my version...
No, I have the same problem here. Applied. There are other mistakes like
this one.
> I also implemented two simple indicators. I did not have the
> possibility to test their behaviour other than comparing them
> visual. But the signals seems reasonable :)
>
> I`m not sure if I understood the hole structure right and would be
> glad about any comment, correction or simplification.
Ok here are my comments :
TRIX.pm :
| my $self = { 'args' => defined($args) ? $args : [12,26,9] };
This line doesn't make sense if you want default arg to be 5 ... just
replace [12,26,9] by [5]...
Otherwise you're not using the new GT::ArgsTree. I suggest that any new
indicator should use it to manage the parameters instead of the simple
parameters we always used.
The benefit is that we can have parameters whose value is always
evolving. The drawback is that we must manage the fact that the value is
changing and that we may not be able to calculate a 9-day SMA on day 6
but we could calculate the 4-day SMA on day 5 ...
I suggest you take a closer look to EMA.pm and RSI.pm (and in fact to
any module which has "# Standards-Version: 1.0" included in its body
somewhere). The test is_constand lets you check if the parameters have
a value that is evolving over the time or not. Depending on that the
dependencies can be calculated sooner or later. For "evolving values" we
add special "volatile dependencies" at calculation time that are removed
for the next calculation. But of course we keep "fixed dependencies"
(that are added at initialization time).
You should not fear to create indicators multiple times since they are
"cached" at the GT::Indicators level by the manage_object function. So
if you try to create a specific indicator a second time it will simply
return you the indicator that you created before.
This is a bit difficult but it makes the whole system so much more
powerful. But it also simplifies other part of the work. For example
we don't need the "new" function any more because we can always use the
standard "new" provided by GT::Indicators (and this is where the
@DEFAULT_ARGS is used ... if you provide your own new function then it's
useless).
I suggest that you adapt your two indicators based on those remarks
(including the ones about coding style :)) and I'll take another look
once those changes are implemented.
> BTW: It is not so important, but maybe it would be a good idea to
> include a text-version of the GPL in the main-directory (the standard
> COPYING-file)...I don't know much about the law in the US or in France
> but in Germany it would be very hard to enforce the use of a licence
> without including it in the "product". ...but this is a formal thing
> and not so important at all.
By default no license means "all rights reserved". So if someone goes to a
court and manages to annoy everyone the code will officially be
recognized as restricted to use ... at which time we'll add this COPYING
file that clutters the directory. Until then I prefer to leave
it "uncluttered". ;-)
Cheers,
--
Raphaël Hertzog -+- http://www.ouaza.com
Formation Linux et logiciel libre : http://www.logidee.com
|
|
From: <ol...@ol...> - 2002-12-23 15:00:00
|
Hi, > This indicator does much more than "Constant.pm" but it can do as few as > Constant.pm ... :) you can calculate almost anything with it (cf its POD > documentation). I think that all the "Generic" modules are very > powerful and make GT a pleasure to use. You are absolute right. The more code I read and the more I play around with the system, the more impressed I get. Sometimes it is hard to find the nifty way to do use some special functions and I fear I will have to place a lot of unsophisticated questions before i really understand the system. So please be patient... :-) I append two small patches: One fixes an error introduced by my last patch for graphic.pl: When you use the Getopt::Long-Package you have first enable the "pass_through"-mode, then check for a single parameter and then process the rest. The second one is one single additional line for the ZigZag-Indicator after "=cut". My version of pod2text did not recognized the end of the POD-documentation. But maybe this is only due to my version... I also implemented two simple indicators. I did not have the possibility to test their behaviour other than comparing them visual. But the signals seems reasonable :) I`m not sure if I understood the hole structure right and would be glad about any comment, correction or simplification. > Great ! Also if you think that the POD documentation is not good enough > in some modules, feel free to provide patches. I think, that the POD-documentation is really good - the more code you read the more familiar you get with the structures. But IMO for someone who starts using GT, some paperwork would help a lot. Sure: after looking at the sources, reading the Getopt:Long-docs and thinking some minutes about it, I realized that the --volume-option of graphic.pl switches the volume on and _--novolume_ switches the volume-zone off. Because I`m a little bit oblivious I fear that I`ve to repeat this process the next time I work with the program and on the other hand it is maybe useful for other people starting to work with GT. CU, Olf BTW: It is not so important, but maybe it would be a good idea to include a text-version of the GPL in the main-directory (the standard COPYING-file)...I don't know much about the law in the US or in France but in Germany it would be very hard to enforce the use of a licence without including it in the "product". ...but this is a formal thing and not so important at all. |
|
From: Raphael H. <rhe...@hr...> - 2002-12-22 12:54:41
|
Le Sun, Dec 22, 2002 at 07:03:18AM +0100, ol...@ol... écrivait:
> Hi all,
Hi,
> I now hoepefull got the right mailinglist.
Yes. :)
> But when you later on call the "new"-constructor, the subdirectory
> "Systems" lacks:
>
> 26 $self->{'macddiff'} = GT::Signals::MacdDiff->new([12,26,4]);
Oh right. Fixed.
> > There's no need for a new indicator for that. You can use the
> > "Generic:Eval" indicator (just give the number you want as argument).
>
> Great. Thank you. I didn`t noticed this indicator yet.
This indicator does much more than "Constant.pm" but it can do as few as
Constant.pm ... :) you can calculate almost anything with it (cf its POD
documentation). I think that all the "Generic" modules are very
powerful and make GT a pleasure to use.
The syntax of those Generic modules are just a bit weird.
Generic/Eval.pm is ok since it's quite recent but the other Generic
modules use a silly mechanism to parse their arguments (cf function
shift_args_until). They ought to be all modified to use the new
GT::ArgsTree which I find much more elegant and powerful.
> So the Systems ony provide the signal to buy or sell by the functions
> long_signal and short_signal. The Closestrategy contains the functions
> manage_{long,short}_position and detect_{buy,sell}_opportunity are
> deprecated. -- that`s right?
Right. But the CloseStrategy can contain more than the
manage_{long,short}_position. It can also have those functions (taken from
CloseStrategy.pm POD documentation) :
| =item C<< $cs->get_indicative_stop($calc, $i, $order, $pf_man, $sys_man) >>
|
| =item C<< $cs->get_indicative_long_stop($calc, $i, $order, $pf_man, $sys_man) >>
|
| =item C<< $cs->get_indicative_short_stop($calc, $i, $order, $pf_man, $sys_man) >>
|
| This function returns an indicative stop level that should be set for the
| indicated day. It is used before a position is opened to evaluate
| a stop level that may be used by a MoneyManagement rule.
|
| =item C<< $cs->position_opened($calc, $i, $position, $pf_man, $sys_man) >>
|
| =item C<< $cs->short_position_opened($calc, $i, $position, $pf_man, $sys_man) >>
|
| =item C<< $cs->long_position_opened($calc, $i, $position, $pf_man, $sys_man) >>
|
| Those functions are callback that are launched when a position has been
| opened. It can be used to place order on a target that will be valid until
| they are executed (ie no_discard=1). $cs->position_opened will
| call the right callback depending on the the position (short or long).
| It can also be used to set an initial stop level.
(position_opened and get_indicative_stop have a default behaviour which
is to delegate the work to the functions specific to long/short position)
> I would like to start with a collection of questions that arose when I
> worked on the program. I don`t know if it is getting a real "manual" but I
> need these notes for myself so that I can remember the things I`ve found
> out in a couple of months. We`ll see... :-)
Great ! Also if you think that the POD documentation is not good enough
in some modules, feel free to provide patches.
Cheers,
--
Raphaël Hertzog -+- http://www.ouaza.com
Formation Linux et logiciel libre : http://www.logidee.com
|
|
From: <ol...@ol...> - 2002-12-22 07:06:29
|
Hi all,
> [ Reply private since the list on SF is dead and should not be used ]
I now hoepefull got the right mailinglist.
> For Systems/MacdDiff.pm it looks like the path is ok :
> rhertzog@xp:~/bourse/GT$ ls -l Signals/Systems
> total 8
> drwxr-sr-x 2 rhertzog rhertzog 4096 2002-10-06 17:39 CVS
> -rw-r--r-- 1 rhertzog rhertzog 1849 2002-10-06 17:29 MacdDiff.pm
> Ie the required module exists...
Yes. The required module exist and is also included with the right path in
the header:
1 package GT::Systems::MacdDiff;
10 use GT::Signals::Systems::MacdDiff;
But when you later on call the "new"-constructor, the subdirectory
"Systems" lacks:
26 $self->{'macddiff'} = GT::Signals::MacdDiff->new([12,26,4]);
> There's no need for a new indicator for that. You can use the
> "Generic:Eval" indicator (just give the number you want as argument).
Great. Thank you. I didn`t noticed this indicator yet.
> Your patch is a reverse patch ... please take care to generate it in
the
> good way next time :
> diff -u originalfile newfile >patch
ok. Thank you for this hint.
> Anyway, I applied your patch.
> Systems should only provide long_signal and short_signal. The other
> functions (some of which are still in some modules because they have
> never been updated ...) are no more part of the Systems. They should be
> part of some CloseStrategy module (and some functions have been
> removed/renamed: detect_{buy,sell}_opportunity).
So the Systems ony provide the signal to buy or sell by the functions
long_signal and short_signal. The Closestrategy contains the functions
manage_{long,short}_position and detect_{buy,sell}_opportunity are
deprecated. -- that`s right?
> Concerning your system it can be easily described as :
[...]
> Nice isn't it ?
It is really nice. :)
> > Last thing: What do you think about a "Getting started.."-Guide or
> > anything similar? I think this would be very usefull for those poeple
who
> > want to use GT without looking at the sources...
>
> Sure ... but I don't like much writing that kind of documentation. Do
> don't expect something like that from me anytime soon. But I'd accept
> any contributed documentation of course.
I would like to start with a collection of questions that arose when I
worked on the program. I don`t know if it is getting a real "manual" but I
need these notes for myself so that I can remember the things I`ve found
out in a couple of months. We`ll see... :-)
CU, Olf
|
|
From: <ol...@ol...> - 2002-12-21 22:18:58
|
Hi all,
I started some weeks ago to play around with GT. I have some Questions and
some patches:
* In the Closingstrategy VAR.pm and in MacdDiff.pm there is a wrong Path
to an Indiactor -- IMO the result of restructuring the Indicators.
* I was looking for a possibility to include signal-lines (p.e. 20 and 80
for the Stochastic). Because I found no possiblity in the program, i
simply worte the Indicator Constant.pm. It delivers always a constant
value, but it produces an error if called with parameter 0.
Maybe someone can tell me a more sophisticated way to do this :)
* I did several small additions to graphics.pl:
* With the --file parameter it is possible to read parameters from a
file. This was usefull for me when experimenting with this file.
* %c in the title is replaced by $code
* It is possible to include parameters for a System
* I also included a Sample System which I wrote to understand how these
Systems work. Can anyone explain me the different meaning of the
manage_long_position in a Close-Strategy-File and in a System?
Please excuse my bad programming-style. I write my normal programs in Java
and use perl only ocassionaly for "quick-and-dirty-hacks" so I will need
some time to get used to this "nice and clear"-perl-style :-)
Last thing: What do you think about a "Getting started.."-Guide or
anything similar? I think this would be very usefull for those poeple who
want to use GT without looking at the sources...
CU, Olf
|
|
From: <ol...@ol...> - 2002-12-21 22:15:28
|
Hi all,
I started some weeks ago to play around with GT. I have some Questions and
some patches:
* In the Closingstrategy VAR.pm and in MacdDiff.pm there is a wrong Path
to an Indiactor -- IMO the result of restructuring the Indicators.
* I was looking for a possibility to include signal-lines (p.e. 20 and 80
for the Stochastic). Because I found no possiblity in the program, i
simply worte the Indicator Constant.pm. It delivers always a constant
value, but it produces an error if called with parameter 0.
Maybe someone can tell me a more sophisticated way to do this :)
* I did several small additions to graphics.pl:
* With the --file parameter it is possible to read parameters from a
file. This was usefull for me when experimenting with this file.
* %c in the title is replaced by $code
* It is possible to include parameters for a System
* I also included a Sample System which I wrote to understand how these
Systems work. Can anyone explain me the different meaning of the
manage_long_position in a Close-Strategy-File and in a System?
Please excuse my bad programming-style. I write my normal programs in Java
and use perl only ocassionaly for "quick-and-dirty-hacks" so I will need
some time to get used to this "nice and clear"-perl-style :-)
Last thing: What do you think about a "Getting started.."-Guide or
anything similar? I think this would be very usefull for those poeple who
want to use GT without looking at the sources...
CU, Olf
|
|
From: Raphael H. <ra...@ge...> - 2002-12-20 00:53:19
|
Le Wed, Dec 18, 2002 at 09:00:31PM +0000, Raghavendra Gowkanapalli écrivait: > Greetings: Hi, > Does GT support intra-day strategy testing, like running back tests on > 5-minute data etc.... GT can work on any series of prices provided that they are under the form [open, high, low, close, volume, time] (ie it doesn't work with [bid, ask, time] or [price, quantity, time]). But with the last form it's easy to generate a serie of "bars"... Cheers, -- Raphaël Hertzog -+- http://www.ouaza.com Formation Linux et logiciel libre : http://www.logidee.com |
|
From: Raghavendra G. <rg...@ho...> - 2002-12-18 22:07:03
|
Greetings: Does GT support intra-day strategy testing, like running back tests on 5-minute data etc.... thanks _________________________________________________________________ Add photos to your e-mail with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail |
|
From: Raphael H. <ra...@ge...> - 2002-12-17 01:06:56
|
Hi, Le Mon, Dec 16, 2002 at 01:44:35PM -0500, rgowka1 écrivait: > Thanks for releasing such an wonderful framework.... You're welcome ! > I was wondering if you guys maintain an archive of this mailing list > somewhere.. If you do, could you please let me know where I can access > it. The mailing list managers keeps an archive of course. Send "help" to sy...@ge... to discover the available commands and you'll find the commands related to the retrieval of the archives. Cheers, -- Raphaël Hertzog -+- http://www.ouaza.com Formation Linux et logiciel libre : http://www.logidee.com |
|
From: rgowka1 <rg...@ho...> - 2002-12-16 19:46:32
|
Thanks for releasing such an wonderful framework.... I was wondering if you guys maintain an archive of this mailing list somewhere.. If you do, could you please let me know where I can access it. |
|
From: Raphael H. <ra...@ge...> - 2002-11-08 17:59:13
|
Hi, Le Fri, Nov 08, 2002 at 01:34:41AM +0100, Dennis Fantoni écrivait: > I joined this list to see if any interesting discussions show up. Welcome ! > woild like to to discuss and evaluate overall design and architecture, use Great, I always wanted to be able to discuss GeniusTrader's architecture with other people ... it's very difficult to build an architecture in which everything imaginable fits nicely. And I do have more design decisions to take in the near future ... I asked input a few weeks ago but I didn't receive much feedback. Maybe this will change now ... :-) I'll bounce ot you my last messages asking for input. > I have 4 weeks of totally dedicated time just to planning and building > framework arhitecture. You're lucky... my life keeps me busy enough to not have progressed wrt GeniusTrader in several weeks. :-/ > I know You guys use perl, but arhcitecture probably couildn't care less what > OO capable langage you implement with ;-) Sure. Cheers, -- Raphaël Hertzog -+- http://www.ouaza.com Formation Linux et logiciel libre : http://www.logidee.com |
|
From: Dennis F. <df...@im...> - 2002-11-08 01:42:11
|
I joined this list to see if any interesting discussions show up. I am working on a private project - a java based framework for backtesting, built on the ideas of r-quant and other existing systems. Right now I am in the planning stages. woild like to to discuss and evaluate overall design and architecture, use of OO in this particular field, fancy ways of speeding things up, interesting implementations of common problems. I have 4 weeks of totally dedicated time just to planning and building framework arhitecture. I know You guys use perl, but arhcitecture probably couildn't care less what OO capable langage you implement with ;-) Regards Dennis |
|
From: Raphael H. <ra...@ge...> - 2002-10-22 23:29:58
|
Le Tue, Oct 22, 2002 at 10:22:50PM +0200, Martin Walenta écrivait: > # On Sun, 20 Oct 2002 16:46:29 +0200 Raphael Hertzog <ra...@ge...> wrote: > # Should the indice be stored or can it be calculated each time ? > > About every official index is modified from time to time. For example, > when weighting depends on the freefloat and that changes. Or when some > index members are exchanged. Such kind of rules might be hard to > program when the index shall be calculated from scratch each time > again. So, in my eyes: storing old index data looks like a good idea. > It would then just be an additional "market". Yes, but we do not need anything new for that. Indices prices are already provided everywhere and it's just like any other equity out there. The problem with this is that you should also store the history of any "market indicator" since the members change and that you can't be sure of your figures otherwise. This is something painful ... BTW, having official indices stored doesn't mean we do not want the code to be able to create our own "indices" that would be calculated each time. > # ... about portfolio indicators ... > > -> Well, what are your favourite indicators? It's not about my preferences, it's about letting the possibility to create any reasonable "portfolio indicator" that anyone can imagine. I could hack up something for my own needs, but I try to have a prospective overview in order to avoid to have to redesign everything later. Cheers, -- Raphaël Hertzog -+- http://www.ouaza.com Formation Linux et logiciel libre : http://www.logidee.com |