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: <ol...@ol...> - 2003-02-27 08:58:11
|
Hi,
I was very happy to notice that we're now at least three people
actively discussing on this list. Welcome, Olaf! :-)
The key is the "name" of the function (it is used for caching). func is
the parameter returning the source on which the indicator is used. At the
moment I've some problems with this parameter:
I started to convert some more indicators to work within the
ArgsTree-architecture and to support different sources of data. I'm a
little bit unsure waht to do with the $self->{'func'}-Function. It is not
really needed anymore except for compatibility reasons. Instead of
creating a SMA with a func-parameter you can simply handle the datasource
as a parameter.
One solution for a soft migration could be to include in all new
Indicators a variable $VERSION and to check this within the
GT::Indicators::new - function. If ($VERSION >= 1) the $self->{'func'}
could be set to a sub returning the value of the last parameter. Do you
think that this would work or do you have a better idea?
BTW: Maybe it would be a good idea to branch a 'stable' version of GT if
we have finished the complete conversion to ArgsTree :-?
CU, Olf
|
|
From: Raphael H. <ra...@ge...> - 2003-02-26 19:47:07
|
Le Wed, Feb 26, 2003 at 05:25:50PM +0100, Olaf Dietsche écrivait: > As before, here is the first cut: I copied new() from Indicators.pm to > Systems.pm and removed the new() from ADX.pm and added the > @DEFAULT_ARGS. I wouldn't use "our" since this has been added recently to perl. Better stay with the use vars qw(... @DEFAULT_ARGS) like it's done everywhere else (check I:RSI again for example). > I'll continue with the rest, when I have either your no or go. Otherwise it looks ok. However with GT::ArgsTree we're trying to make all parameters variable in the sens that they can be an other indicator. For this to work, you have to take special consideration in mind. Instead of using $args->get_arg_constant() you must use $args->get_arg_values() and you can't use at initializa time but at calculation time since you don't know the value of the parameter yet. And because of that you can't use fixed dependencies but you need what I call volatile dependencies. This is not so important right now, but I just wanted to let you know. > As for the @NAMES, I've seen names like "ADX" and names like > "SMA[#1,#2,#3]". What do these #1,#2, ... mean? Parameters? Yes. > If so, some of the system names miss them. If they have [#*] then it's ok. This is a catchup for all parameters. If they have nothing like that but they don't use any parameter, then it's ok to. :) Otherwise it's a bug. Cheerrs, -- Raphaël Hertzog -+- http://www.ouaza.com Formation Linux et logiciel libre : http://www.logidee.com |
|
From: Raphael H. <ra...@ge...> - 2003-02-26 19:36:06
|
Le Wed, Feb 26, 2003 at 04:43:56PM +0100, Olaf Dietsche écrivait: > Analysis of the portfolio (2000-10-12 / 2002-10-04) : > ----------------------------------------------------- > Performance : 126.3% ( 50.4%) Buy & Hold : -96.6% (-81.5%) () => by year > MaxDrawDown : 890.6% B&H MaxDrawDown : 97.6% MaxDrawDown > 100% ... this is a problem caused by the fact that the simulation always plays the same sum of money whatever the history was. In real life, you're already out of the game. :) here we lost 8 times our portfolio and managed to come back to an incredible result of 126% :-) > ## Theoretical analysis (10keuros, full portfolio reinvested) > Analysis of the portfolio (2000-10-12 / 2002-10-04) : > ----------------------------------------------------- > Performance : -19915 ( nan%) Buy & Hold : -96.6% (-81.5%) () => by year > MaxDrawDown : 19915. B&H MaxDrawDown : 97.6% Here it's a bit strange. Because we only play the money left ... so we can't go in a negative portfolio value. However when you have so many losses, you're reaching the zero limit and the money required by the brokerage may be enough to get you into the world of negative portfolio value. And GT doesn't manage very well negative sums ... he'll try to reinvest negative sums and you get those fantastic results. :-) Instead of worrying about those numbers, you should make your system better. :-) > Another point: the trades are in a random order, it seems. Is this > intentional? Nope, the trades are in the order in which they were closed afaik. Cheers, -- Raphaël Hertzog -+- http://www.ouaza.com Formation Linux et logiciel libre : http://www.logidee.com |
|
From: Olaf D. <olaf.dietsche#<lis...@t-...> - 2003-02-26 17:54:03
|
I just tried: $ ./backtest.pl --system=MacdDiff --close-strategy=Stop::ExtremePrices 13000 which gives a lot of trades and this report: ## Global analysis (each position is 10keuros, value of portfolio) Analysis of the portfolio (2000-10-12 / 2002-10-04) : ----------------------------------------------------- Performance : 126.3% ( 50.4%) Buy & Hold : -96.6% (-81.5%) () => by year MaxDrawDown : 890.6% B&H MaxDrawDown : 97.6% Best performance : 126.3% Worst performance : -890.6 Net gain : 12630.58 Gross gain : 32898.76 Trades statistics : Number of gains : 80 Number of losses : 190 Win. ratio : 29.6% Max consec. win : 18 Max consec. loss : 40 Average gain : 25.73% Average loss : -11.09% Avg. perf : 0.30% Biggest gain : 64.76% Biggest loss : -30.99% Profit fac : 2.32 Sum of gains : 218752.32 Sum of losses : -206121.74 Risk of ruin : 66.9% ## Theoretical analysis (10keuros, full portfolio reinvested) Analysis of the portfolio (2000-10-12 / 2002-10-04) : ----------------------------------------------------- Performance : -19915 ( nan%) Buy & Hold : -96.6% (-81.5%) () => by year MaxDrawDown : 19915. B&H MaxDrawDown : 97.6% Best performance : 0.0% Worst performance : -19915 Net gain : -1991591.74 Gross gain : -1971323.56 Trades statistics : Number of gains : 111 Number of losses : 159 Win. ratio : 41.1% Max consec. win : 18 Max consec. loss : 23 Average gain : 22.52% Average loss : nan% Avg. perf : nan% Biggest gain : 156.73% Biggest loss : -237.66% Profit fac : nan Sum of gains : -3559827.7 Sum of losses : 1568236.00 Risk of ruin : 66.7% Looks like an overflow somewhere. Another point: the trades are in a random order, it seems. Is this intentional? Regards, Olaf. |
|
From: Olaf D. <olaf.dietsche#<lis...@t-...> - 2003-02-26 17:32:14
|
Raphael Hertzog <ra...@ge...> writes: > Le Wed, Feb 26, 2003 at 01:40:48PM +0100, Olaf Dietsche écrivait: >> Alright, the next step would be this common new, right? I looked at >> the "new()s" in GT/Systems and they seem to be the same except the >> default parameters. >> >> How are these default parameters supposed to come into existence? >> Should they be set in initialize() somewhere? > > Nope. They should be set in a global variable called @DEFAULT_ARGS. > Check any up-to-date indicator, for example RSI.pm. And the common new > uses this variable to setup the default values... > >> For the new in GT/Systems.pm: shall I copy the one from Signals.pm? Or >> is the new from Indicators.pm the preferred one? > > The new from Indicators is better. As before, here is the first cut: I copied new() from Indicators.pm to Systems.pm and removed the new() from ADX.pm and added the @DEFAULT_ARGS. I'll continue with the rest, when I have either your no or go. As for the @NAMES, I've seen names like "ADX" and names like "SMA[#1,#2,#3]". What do these #1,#2, ... mean? Parameters? If so, some of the system names miss them. Regards, Olaf. |
|
From: Raphael H. <ra...@ge...> - 2003-02-26 16:36:35
|
Le Wed, Feb 26, 2003 at 01:40:48PM +0100, Olaf Dietsche écrivait: > Alright, the next step would be this common new, right? I looked at > the "new()s" in GT/Systems and they seem to be the same except the > default parameters. > > How are these default parameters supposed to come into existence? > Should they be set in initialize() somewhere? Nope. They should be set in a global variable called @DEFAULT_ARGS. Check any up-to-date indicator, for example RSI.pm. And the common new uses this variable to setup the default values... > For the new in GT/Systems.pm: shall I copy the one from Signals.pm? Or > is the new from Indicators.pm the preferred one? The new from Indicators is better. > Beside the args, what are $key and $func good for? Some indicators might not use prices as their main sources of data, and you can give them your own source of data (the $func function) ... and to be able to differentiate a single indicator run on non-prices data from the same indicator run on prices we add "$key" to the indicator name. Thus $key and $func are tightly related. Cheers, -- Raphaël Hertzog -+- http://www.ouaza.com Formation Linux et logiciel libre : http://www.logidee.com |
|
From: Olaf D. <olaf.dietsche#<lis...@t-...> - 2003-02-26 13:49:21
|
Raphael Hertzog <ra...@ge...> writes: > Le Tue, Feb 25, 2003 at 07:50:13PM +0100, Olaf Dietsche écrivait: >> > No, it's still used. It's called by >> > PositionManager::precalculate_interval ... >> >> Ok, here is the remaining part of GT/Systems/* for reviewing. > > Applied in CVS. Alright, the next step would be this common new, right? I looked at the "new()s" in GT/Systems and they seem to be the same except the default parameters. How are these default parameters supposed to come into existence? Should they be set in initialize() somewhere? For the new in GT/Systems.pm: shall I copy the one from Signals.pm? Or is the new from Indicators.pm the preferred one? Beside the args, what are $key and $func good for? Regards, Olaf. |
|
From: Raphael H. <ra...@ge...> - 2003-02-26 10:10:43
|
Le Tue, Feb 25, 2003 at 07:50:13PM +0100, Olaf Dietsche écrivait: > > No, it's still used. It's called by > > PositionManager::precalculate_interval ... > > Ok, here is the remaining part of GT/Systems/* for reviewing. Applied in CVS. Cheers, -- Raphaël Hertzog -+- http://www.ouaza.com Formation Linux et logiciel libre : http://www.logidee.com |
|
From: GeniusTrader C. r. <ra...@ge...> - 2003-02-26 10:10:41
|
Update of /bourse/cvsroot/GT/Systems
In directory arrakis:/scratch/tmp/cvs-serv29820
Modified Files:
ADX2.pm MacdDiff.pm SMA.pm Stochastic.pm
Log Message:
- More Systems cleanup. [Olaf Dietsche]
--- /bourse/cvsroot/GT/Systems/ADX2.pm 2002/10/06 15:39:28 1.3
+++ /bourse/cvsroot/GT/Systems/ADX2.pm 2003/02/26 09:06:58 1.4
@@ -54,9 +54,9 @@
return DVOID;
}
-sub detect_buy_opportunity {
+sub long_signal {
DFEATURE my $f;
- my ($self, $calc, $i, $manager) = @_;
+ my ($self, $calc, $i) = @_;
my $adx_name = $self->{'adx'}->get_name(0);
my $positive_di_name = $self->{'adx'}->get_name(1);
my $negative_di_name = $self->{'adx'}->get_name(2);
@@ -65,7 +65,7 @@
$self->{'adx'}->calculate_interval($calc, $i-1, $i);
$self->{'adxr'}->calculate($calc, $i);
- return DVOID if (!($calc->indicators->is_available($adx_name, $i-1) &&
+ return DVAL 0 if (!($calc->indicators->is_available($adx_name, $i-1) &&
$calc->indicators->is_available($adx_name, $i) &&
$calc->indicators->is_available($positive_di_name, $i) &&
$calc->indicators->is_available($negative_di_name, $i) &&
@@ -80,15 +80,14 @@
($calc->indicators->get($adxr_name, $i) > 25)
)
{
- my $order = $manager->buy_market_price($calc, $self->get_name);
- $manager->submit_order($order, $i, $calc);
+ return DVAL 1;
}
- return DVOID;
+ return DVAL 0;
}
-sub detect_sell_opportunity {
+sub short_signal {
DFEATURE my $f;
- my ($self, $calc, $i, $manager) = @_;
+ my ($self, $calc, $i) = @_;
my $adx_name = $self->{'adx'}->get_name(0);
my $positive_di_name = $self->{'adx'}->get_name(1);
@@ -98,7 +97,7 @@
$self->{'adx'}->calculate_interval($calc, $i-1, $i);
$self->{'adxr'}->calculate($calc, $i);
- return DVOID if (!($calc->indicators->is_available($adx_name, $i-1) &&
+ return DVAL 0 if (!($calc->indicators->is_available($adx_name, $i-1) &&
$calc->indicators->is_available($adx_name, $i) &&
$calc->indicators->is_available($positive_di_name, $i) && $calc->indicators->is_available($negative_di_name, $i) && $calc->indicators->is_available($adxr_name, $i)));
@@ -111,65 +110,7 @@
($calc->indicators->get($adxr_name, $i) > 25)
)
{
- my $order = $manager->buy_market_price($calc, $self->get_name);
- $manager->submit_order($order, $i, $calc);
+ return DVAL 1;
}
- return DVOID;
+ return DVAL 0;
}
-
-sub long_position_opened {
- DFEATURE my $f;
- my ($self, $calc, $i, $position, $manager) = @_;
-
- $position->{'stop'} = $position->{'initial_price'} * 0.94;
-
- return DVOID;
-}
-
-sub short_position_opened {
- DFEATURE my $f;
- my ($self, $calc, $i, $position, $manager) = @_;
-
- $position->{'stop'} = $position->{'initial_price'} * 1.06;
-
- return DVOID;
-}
-
-sub manage_long_position {
- DFEATURE my $f;
- my ($self, $calc, $i, $position, $manager) = @_;
-
- $self->{'adx'}->calculate_interval($calc, $i-1, $i);
-
- # Eventually close the position or invert it
- if (($calc->indicators->get($self->{'adx'}->get_name(1), $i - 1) >=
- $calc->indicators->get($self->{'adx'}->get_name(2), $i - 1)) &&
- ($calc->indicators->get($self->{'adx'}->get_name(1), $i) <
- $calc->indicators->get($self->{'adx'}->get_name(2), $i))
- )
- {
- my $order = $manager->sell_market_price($calc, $self->get_name);
- $manager->submit_order_in_position($position, $order, $i, $calc);
- }
- return DVOID;
-}
-
-sub manage_short_position {
- DFEATURE my $f;
- my ($self, $calc, $i, $position, $manager) = @_;
-
- $self->{'adx'}->calculate_interval($calc, $i-1, $i);
-
- # Eventually close the position or invert it
- if (($calc->indicators->get($self->{'adx'}->get_name(2), $i - 1) >=
- $calc->indicators->get($self->{'adx'}->get_name(1), $i - 1)) &&
- ($calc->indicators->get($self->{'adx'}->get_name(2), $i) <
- $calc->indicators->get($self->{'adx'}->get_name(1), $i))
- )
- {
- my $order = $manager->sell_market_price($calc, $self->get_name);
- $manager->submit_order_in_position($position, $order, $i, $calc);
- }
- return DVOID;
-}
-
--- /bourse/cvsroot/GT/Systems/MacdDiff.pm 2003/02/24 08:16:26 1.5
+++ /bourse/cvsroot/GT/Systems/MacdDiff.pm 2003/02/26 09:06:58 1.6
@@ -44,104 +44,28 @@
}
-sub detect_buy_opportunity {
+sub long_signal {
DFEATURE my $f;
- my ($self, $calc, $i, $manager) = @_;
+ my ($self, $calc, $i) = @_;
- return DVOID if (! $self->check_dependencies($calc, $i));
+ return DVAL 0 if (!$self->check_dependencies($calc, $i));
if ($calc->signals->get($self->{'macddiff'}->get_name(1), $i))
{
- my $order = $manager->buy_conditional($calc, $self->get_name,
- $calc->prices->at($i)->[$HIGH] * 1.005,
- $calc->prices->at($i)->[$HIGH] * 1.01);
- $manager->submit_order($order, $i, $calc);
+ return DVAL 1;
}
- return DVOID;
+ return DVAL 0;
}
-sub detect_sell_opportunity {
+sub short_signal {
DFEATURE my $f;
- my ($self, $calc, $i, $manager) = @_;
+ my ($self, $calc, $i) = @_;
- return DVOID if (! $self->check_dependencies($calc, $i));
+ return DVAL 0 if (!$self->check_dependencies($calc, $i));
if ($calc->signals->get($self->{'macddiff'}->get_name(0), $i))
{
- my $order = $manager->sell_conditional($calc, $self->get_name,
- $calc->prices->at($i)->[$LOW] * 0.995,
- $calc->prices->at($i)->[$LOW] * 0.99);
- $manager->submit_order($order, $i, $calc);
+ return DVAL 1;
}
- return DVOID;
+ return DVAL 0;
}
-
-sub long_position_opened {
- DFEATURE my $f;
- my ($self, $calc, $i, $position, $manager) = @_;
-
- return DVOID;
-}
-
-sub short_position_opened {
- DFEATURE my $f;
- my ($self, $calc, $i, $position, $manager) = @_;
-
- return DVOID;
-}
-
-sub manage_long_position {
- DFEATURE my $f;
- my ($self, $calc, $i, $position, $manager) = @_;
-
- return DVOID if (! $self->check_dependencies($calc, $i));
-
- # Update the stop
- my $newstop = $calc->prices->at($i)->[$HIGH] -
- $calc->indicators->get($self->{'atr'}->get_name, $i) * 1.3;
- #my $newstop = ($limit > $position->{'initial_price'} * 0.96) ?
- # $limit : $position->{'initial_price'} * 0.96;
-
- $position->{'stop'} = $newstop if (! defined($position->{'stop'}));
- #if ($newstop > $position->{'stop'}) {
- $position->{'stop'} = $newstop;
- #}
-
- # Eventually close the position or invert it
- if ($calc->signals->get($self->{'macddiff'}->get_name(0), $i))
- {
- my $order = $manager->sell_conditional($calc, $self->get_name,
- $calc->prices->at($i)->[$LOW] * 0.995,
- $calc->prices->at($i)->[$LOW] * 0.99);
- $manager->submit_order_in_position($position, $order, $i, $calc);
- }
- return DVOID;
-}
-
-sub manage_short_position {
- DFEATURE my $f;
- my ($self, $calc, $i, $position, $manager) = @_;
-
- return DVOID if (! $self->check_dependencies($calc, $i));
-
- # Update the stop
- my $newstop = $calc->prices->at($i)->[$LOW] +
- $calc->indicators->get($self->{'atr'}->get_name, $i) * 1.3;
- #my $newstop = ($limit < $position->{'initial_price'} * 1.04) ?
- # $limit : $position->{'initial_price'} * 1.04;
- $position->{'stop'} = $newstop if (! defined($position->{'stop'}));
- #if ($newstop < $position->{'stop'}) {
- $position->{'stop'} = $newstop;
- #}
-
- # Eventually close the position or invert it
- if ($calc->signals->get($self->{'macddiff'}->get_name(1), $i))
- {
- my $order = $manager->buy_conditional($calc, $self->get_name,
- $calc->prices->at($i)->[$HIGH] * 1.005,
- $calc->prices->at($i)->[$HIGH] * 1.01);
- $manager->submit_order_in_position($position, $order, $i, $calc);
- }
- return DVOID;
-}
-
--- /bourse/cvsroot/GT/Systems/SMA.pm 2002/10/06 15:39:28 1.3
+++ /bourse/cvsroot/GT/Systems/SMA.pm 2003/02/26 09:06:58 1.4
@@ -46,12 +46,12 @@
}
-sub detect_buy_opportunity {
+sub long_signal {
DFEATURE my $f;
- my ($self, $calc, $i, $manager) = @_;
+ my ($self, $calc, $i) = @_;
my $indic = $calc->indicators;
- return DVOID if (! $self->check_dependencies($calc, $i));
+ return DVAL 0 if (!$self->check_dependencies($calc, $i));
if ( ( $indic->get($self->{'sma1'}->get_name, $i - 1) <
$indic->get($self->{'sma2'}->get_name, $i - 1)) &&
@@ -59,62 +59,15 @@
$indic->get($self->{'sma2'}->get_name, $i) )
)
{
- my $order = $manager->buy_market_price($calc, $self->get_name);
- $manager->submit_order($order, $i, $calc);
+ return DVAL 1;
}
- return DVOID;
+ return DVAL 0;
}
-sub detect_sell_opportunity {
+sub short_signal {
DFEATURE my $f;
- my ($self, $calc, $i, $manager) = @_;
+ my ($self, $calc, $i) = @_;
my $indic = $calc->indicators;
- return DVOID;
+ return DVAL 0;
}
-
-sub long_position_opened {
- DFEATURE my $f;
- my ($self, $calc, $i, $position, $manager) = @_;
-
- $position->{'stop'} = $position->{'initial_price'} * 0.96;
- return DVOID;
-}
-
-sub short_position_opened {
- DFEATURE my $f;
- my ($self, $calc, $i, $position, $manager) = @_;
-
- $position->{'stop'} = $position->{'initial_price'} * 1.04;
- return DVOID;
-}
-
-sub manage_long_position {
- DFEATURE my $f;
- my ($self, $calc, $i, $position, $manager) = @_;
- my $indic = $calc->indicators;
-
- return DVOID if (! $self->check_dependencies($calc, $i));
-
- # Eventually close the position or invert it
-
- if ( ( $indic->get($self->{'sma1'}->get_name, $i - 1) >
- $indic->get($self->{'sma3'}->get_name, $i - 1)) &&
- ( $indic->get($self->{'sma1'}->get_name, $i) <
- $indic->get($self->{'sma3'}->get_name, $i) )
- )
- {
- my $order = $manager->sell_market_price($calc, $self->get_name);
- $manager->submit_order_in_position($position, $order, $i, $calc);
- }
- return DVOID;
-}
-
-sub manage_short_position {
- DFEATURE my $f;
- my ($self, $calc, $i, $position, $manager) = @_;
- my $indic = $calc->indicators;
-
- return DVOID;
-}
-
--- /bourse/cvsroot/GT/Systems/Stochastic.pm 2002/10/06 15:39:28 1.3
+++ /bourse/cvsroot/GT/Systems/Stochastic.pm 2003/02/26 09:06:58 1.4
@@ -42,93 +42,36 @@
}
-sub detect_buy_opportunity {
+sub long_signal {
DFEATURE my $f;
- my ($self, $calc, $i, $manager) = @_;
+ my ($self, $calc, $i) = @_;
my $indic = $calc->indicators;
- return DVOID if (! $self->check_dependencies($calc, $i));
+ return DVAL 0 if (!$self->check_dependencies($calc, $i));
if ( ( $indic->get($self->{'sto'}->get_name(2), $i) < 80 ) &&
( $indic->get($self->{'sto'}->get_name(1), $i) >
$indic->get($self->{'sto'}->get_name(3), $i) )
)
{
- my $order = $manager->buy_market_price($calc, $self->get_name);
- $manager->submit_order($order, $i, $calc);
+ return DVAL 1;
}
- return DVOID;
+ return DVAL 0;
}
-sub detect_sell_opportunity {
+sub short_signal {
DFEATURE my $f;
- my ($self, $calc, $i, $manager) = @_;
+ my ($self, $calc, $i) = @_;
my $indic = $calc->indicators;
- return DVOID if (! $self->check_dependencies($calc, $i));
+ return DVAL 0 if (!$self->check_dependencies($calc, $i));
if ( ( $indic->get($self->{'sto'}->get_name(2), $i) > 20 ) &&
( $indic->get($self->{'sto'}->get_name(1), $i) <
$indic->get($self->{'sto'}->get_name(3), $i) )
)
{
- my $order = $manager->sell_market_price($calc, $self->get_name);
- $manager->submit_order($order, $i, $calc);
+ return DVAL 1;
}
- return DVOID;
+ return DVAL 0;
}
-
-sub long_position_opened {
- DFEATURE my $f;
- my ($self, $calc, $i, $position, $manager) = @_;
-
- $position->{'stop'} = $position->{'initial_price'} * 0.96;
- return DVOID;
-}
-
-sub short_position_opened {
- DFEATURE my $f;
- my ($self, $calc, $i, $position, $manager) = @_;
-
- $position->{'stop'} = $position->{'initial_price'} * 1.04;
- return DVOID;
-}
-
-sub manage_long_position {
- DFEATURE my $f;
- my ($self, $calc, $i, $position, $manager) = @_;
- my $indic = $calc->indicators;
-
- return DVOID if (! $self->check_dependencies($calc, $i));
-
- # Eventually close the position or invert it
-
- if ( ( $indic->get($self->{'sto'}->get_name(2), $i) > 80 ) &&
- ( $indic->get($self->{'sto'}->get_name(1), $i) <=
- $indic->get($self->{'sto'}->get_name(3), $i) )
- )
- {
- my $order = $manager->sell_market_price($calc, $self->get_name);
- $manager->submit_order_in_position($position, $order, $i, $calc);
- }
- return DVOID;
-}
-
-sub manage_short_position {
- DFEATURE my $f;
- my ($self, $calc, $i, $position, $manager) = @_;
- my $indic = $calc->indicators;
-
- return DVOID if (! $self->check_dependencies($calc, $i));
-
- if ( ( $indic->get($self->{'sto'}->get_name(2), $i) < 20 ) &&
- ( $indic->get($self->{'sto'}->get_name(1), $i) >=
- $indic->get($self->{'sto'}->get_name(3), $i) )
- )
- {
- my $order = $manager->buy_market_price($calc, $self->get_name);
- $manager->submit_order_in_position($position, $order, $i, $calc);
- }
- return DVOID;
-}
-
|
|
From: GeniusTrader C. r. <ra...@ge...> - 2003-02-26 10:10:35
|
Update of /bourse/cvsroot/GT/Systems/Swing
In directory arrakis:/scratch/tmp/cvs-serv29820/Swing
Modified Files:
Trend.pm
Log Message:
- More Systems cleanup. [Olaf Dietsche]
--- /bourse/cvsroot/GT/Systems/Swing/Trend.pm 2002/10/06 15:39:28 1.3
+++ /bourse/cvsroot/GT/Systems/Swing/Trend.pm 2003/02/26 09:06:58 1.4
@@ -43,99 +43,30 @@
}
-sub detect_buy_opportunity {
+sub long_signal {
DFEATURE my $f;
- my ($self, $calc, $i, $manager) = @_;
+ my ($self, $calc, $i) = @_;
- return DVOID if (! $self->check_dependencies($calc, $i));
+ return DVAL 0 if (!$self->check_dependencies($calc, $i));
if ($calc->signals->get($self->{'trend'}->get_name(1), $i) ||
$calc->signals->get($self->{'trendending'}->get_name(1), $i))
{
- my $order = $manager->buy_conditional($calc, $self->get_name,
- $calc->prices->at($i)->[$HIGH] * 1.005,
- $calc->prices->at($i)->[$HIGH] * 1.01);
- $manager->submit_order($order, $i, $calc);
+ return DVAL 1;
}
- return DVOID;
+ return DVAL 0;
}
-sub detect_sell_opportunity {
+sub short_signal {
DFEATURE my $f;
- my ($self, $calc, $i, $manager) = @_;
+ my ($self, $calc, $i) = @_;
- return DVOID if (! $self->check_dependencies($calc, $i));
+ return DVAL 0 if (!$self->check_dependencies($calc, $i));
if ($calc->signals->get($self->{'trend'}->get_name(0), $i) ||
$calc->signals->get($self->{'trendending'}->get_name(0), $i))
{
- my $order = $manager->sell_conditional($calc, $self->get_name,
- $calc->prices->at($i)->[$LOW] * 0.995,
- $calc->prices->at($i)->[$LOW] * 0.99);
- $manager->submit_order($order, $i, $calc);
+ return DVAL 1;
}
- return DVOID;
-}
-
-sub long_position_opened {
- DFEATURE my $f;
- my ($self, $calc, $i, $position, $manager) = @_;
-
- # Sell half of the position with 7% gain
- my $order = $manager->sell_limited_price($calc, $self->get_name,
- $position->{'initial_price'} * 1.07);
- $manager->set_order_no_discard($order);
- $manager->set_order_partial($order, 0.5, $position);
- $manager->submit_order_in_position($position, $order, $i, $calc);
- return DVOID;
-}
-
-sub short_position_opened {
- DFEATURE my $f;
- my ($self, $calc, $i, $position, $manager) = @_;
-
- # Buy half of the position with 7% gain
- my $order = $manager->buy_limited_price($calc, $self->get_name,
- $position->{'initial_price'} * 0.93);
- $manager->set_order_no_discard($order);
- $manager->set_order_partial($order, 0.5, $position);
- $manager->submit_order_in_position($position, $order, $i, $calc);
- return DVOID;
-}
-
-sub manage_long_position {
- DFEATURE my $f;
- my ($self, $calc, $i, $position, $manager) = @_;
-
- # Update the stop
- my $newstop = ($calc->prices->at($i)->[$LOW] * 0.995 >
- $position->{'initial_price'} * 0.96) ?
- $calc->prices->at($i)->[$LOW] * 0.995 :
- $position->{'initial_price'} * 0.96;
-
- $position->{'stop'} = $newstop if (! defined($position->{'stop'}));
- if ($newstop > $position->{'stop'}) {
- $position->{'stop'} = $newstop;
- }
-
- # Eventually close the position or invert it
- return DVOID;
-}
-
-sub manage_short_position {
- DFEATURE my $f;
- my ($self, $calc, $i, $position, $manager) = @_;
-
- # Update the stop
- my $newstop = ($calc->prices->at($i)->[$LOW] * 1.005 <
- $position->{'initial_price'} * 1.04) ?
- $calc->prices->at($i)->[$LOW] * 1.005 :
- $position->{'initial_price'} * 1.04;
- $position->{'stop'} = $newstop if (! defined($position->{'stop'}));
- if ($newstop < $position->{'stop'}) {
- $position->{'stop'} = $newstop;
- }
-
- # Eventually close the position or invert it
- return DVOID;
+ return DVAL 0;
}
|
|
From: Olaf D. <olaf.dietsche#<lis...@t-...> - 2003-02-25 19:51:53
|
Raphael Hertzog <ra...@ge...> writes: > Le Tue, Feb 25, 2003 at 04:02:12PM +0100, Olaf Dietsche écrivait: >> I attached a patch for GT/Systems/ADX.pm as an example. If it's >> correct this way, I'll continue with the rest of GT/Systems/*. > > Looks like good. I'll apply it. > >> What about precalculate_interval()? Can I remove it too? > > No, it's still used. It's called by > PositionManager::precalculate_interval ... Ok, here is the remaining part of GT/Systems/* for reviewing. >> What is "DFEATURE my $f;"? > > It's nothing but a trick used by Carp::Datum to track the imbrication of > functions. Read the Carp::Datum man page and check the output of one of > the scripts with the environment variable GTDEBUG set to 1. > > $ GTDEBUG=1 ./backtest.pl .... Thanks, I'll look into this. Regards, Olaf. |
|
From: GeniusTrader C. r. <ra...@ge...> - 2003-02-25 18:16:10
|
Update of /bourse/cvsroot/GT/Systems
In directory arrakis:/scratch/tmp/cvs-serv26353/Systems
Modified Files:
ADX.pm
Log Message:
- Remove cruft in ADX system. [Olaf Dietsche]
--- /bourse/cvsroot/GT/Systems/ADX.pm 2002/10/06 15:39:28 1.3
+++ /bourse/cvsroot/GT/Systems/ADX.pm 2003/02/25 17:14:05 1.4
@@ -48,12 +48,12 @@
return DVOID;
}
-sub detect_buy_opportunity {
+sub long_signal {
DFEATURE my $f;
- my ($self, $calc, $i, $manager) = @_;
+ my ($self, $calc, $i) = @_;
my $adxname = $self->{'adx'}->get_name;
- return DVOID if (! $self->check_dependencies($calc, $i));
+ return DVAL 0 if (!$self->check_dependencies($calc, $i));
if (($calc->indicators->get($adxname, $i) < 15)
&&
@@ -61,52 +61,14 @@
$calc->indicators->get($adxname, $i))
)
{
- my $order = $manager->buy_market_price($calc, $self->get_name);
- $manager->submit_order($order, $i, $calc);
+ return DVAL 1;
}
- return DVOID;
+ return DVAL 0;
}
-sub detect_sell_opportunity {
+sub short_signal {
DFEATURE my $f;
- my ($self, $calc, $i, $manager) = @_;
+ my ($self, $calc, $i) = @_;
- return DVOID;
+ return DVAL 0;
}
-
-sub long_position_opened {
- DFEATURE my $f;
- my ($self, $calc, $i, $position, $manager) = @_;
-
- return DVOID;
-}
-
-sub short_position_opened {
- DFEATURE my $f;
- my ($self, $calc, $i, $position, $manager) = @_;
-
- return DVOID;
-}
-
-sub manage_long_position {
- DFEATURE my $f;
- my ($self, $calc, $i, $position, $manager) = @_;
-
- $self->{'adx'}->calculate($calc, $i);
-
- # Eventually close the position or invert it
- if ($calc->indicators->get($self->{'adx'}->get_name, $i) > 35)
- {
- my $order = $manager->sell_market_price($calc, $self->get_name);
- $manager->submit_order_in_position($position, $order, $i, $calc);
- }
- return DVOID;
-}
-
-sub manage_short_position {
- DFEATURE my $f;
- my ($self, $calc, $i, $position, $manager) = @_;
-
- return DVOID;
-}
-
|
|
From: GeniusTrader C. r. <ra...@ge...> - 2003-02-25 18:16:08
|
Update of /bourse/cvsroot/GT
In directory arrakis:/scratch/tmp/cvs-serv26353
Modified Files:
TODO
Log Message:
- Remove cruft in ADX system. [Olaf Dietsche]
--- /bourse/cvsroot/GT/TODO 2003/01/16 22:42:21 1.46
+++ /bourse/cvsroot/GT/TODO 2003/02/25 17:14:05 1.47
@@ -8,10 +8,6 @@
(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
|
|
From: Raphael H. <ra...@ge...> - 2003-02-25 18:00:26
|
Le Tue, Feb 25, 2003 at 04:02:12PM +0100, Olaf Dietsche écrivait: > I attached a patch for GT/Systems/ADX.pm as an example. If it's > correct this way, I'll continue with the rest of GT/Systems/*. Looks like good. I'll apply it. > What about precalculate_interval()? Can I remove it too? No, it's still used. It's called by PositionManager::precalculate_interval ... > What is GT/Systems/Generic.pm good for? Is it just an example system? It's not a example system, it's a system where you can define the signals on the command line directly : SY:Generic Signals:Prices:GapUp Signals:Prices:GapDown for example ... But this one should really be converted to use GT::ArgsTree to avoid the use of this horrible hack that is shift_args_until ... > What is "DFEATURE my $f;"? It's nothing but a trick used by Carp::Datum to track the imbrication of functions. Read the Carp::Datum man page and check the output of one of the scripts with the environment variable GTDEBUG set to 1. $ GTDEBUG=1 ./backtest.pl .... > What is "return DVAL 0 if (! $self->check_dependencies($calc, $i));"? DVAL just means that we return a scalar value, it's used by Carp::Datum. check_dependencies is just a way to check if we have all the required data of all the required indicators/signals used by the system. Cheers, -- Raphaël Hertzog -+- http://www.ouaza.com Formation Linux et logiciel libre : http://www.logidee.com |
|
From: Olaf D. <olaf.dietsche#<lis...@t-...> - 2003-02-25 16:33:44
|
Raphael Hertzog <ra...@ge...> writes: > Le Mon, Feb 24, 2003 at 07:15:32PM +0100, Olaf Dietsche écrivait: >> I was looking through the source tree and found, that some of the >> systems (their methods) in GT/Systems are not used anywhere. AFAICS, >> this means you can remove these systems or at least most of their >> methods. >> >> This would mean, remove long/short_position_opened() and >> manage_long/short_position() and rename detect_buy/sell_opportunity() >> to long/short_signal(). >> [...] > Also you can't just rename detect_buy/sell_opportunity to > long/short_signal because the content needs to be changed. > In the first case, nothing was returned and we used $manager > to submit orders ... now we just return 1 or 0 and let the > PortfolioManager manage the order. Ok, I start with the easy part: removing the unused methods and changing detect_*_opportunity() to *_signal(). I attached a patch for GT/Systems/ADX.pm as an example. If it's correct this way, I'll continue with the rest of GT/Systems/*. Some questions, though: What about precalculate_interval()? Can I remove it too? What is GT/Systems/Generic.pm good for? Is it just an example system? What is "DFEATURE my $f;"? What is "return DVAL 0 if (! $self->check_dependencies($calc, $i));"? Regards, Olaf. |
|
From: Raphael H. <ra...@ge...> - 2003-02-25 08:56:48
|
Le Mon, Feb 24, 2003 at 07:15:32PM +0100, Olaf Dietsche écrivait:
> I was looking through the source tree and found, that some of the
> systems (their methods) in GT/Systems are not used anywhere. AFAICS,
> this means you can remove these systems or at least most of their
> methods.
>
> This would mean, remove long/short_position_opened() and
> manage_long/short_position() and rename detect_buy/sell_opportunity()
> to long/short_signal().
>
> Anything I'm missing here?
Nope, you're right. If you're doing that, you may convert the
systems like I did for the Indicators and Signals :
- remove the new function and provide a standard "new" in GT::Systems
(and this new would use GT::ArgsTree) that all system could
inherit
Also you can't just rename detect_buy/sell_opportunity to
long/short_signal because the content needs to be changed.
In the first case, nothing was returned and we used $manager
to submit orders ... now we just return 1 or 0 and let the
PortfolioManager manage the order.
Those items were in the TODO already :
- Update the actual GT::Systems and remove the useless $manager
- Use everywhere GT::ArgsTree.
- reproduce the changes made for Indicators & Signals to Systems
- update all indicators/signals for GT::ArgsTree support
(add "Standards-Version: 1.0" header when done to remember
that it has been done)
Cheers,
--
Raphaël Hertzog -+- http://www.ouaza.com
Formation Linux et logiciel libre : http://www.logidee.com
|
|
From: Olaf D. <olaf.dietsche#<lis...@t-...> - 2003-02-24 19:20:56
|
I was looking through the source tree and found, that some of the systems (their methods) in GT/Systems are not used anywhere. AFAICS, this means you can remove these systems or at least most of their methods. This would mean, remove long/short_position_opened() and manage_long/short_position() and rename detect_buy/sell_opportunity() to long/short_signal(). Anything I'm missing here? Regards, Olaf. |
|
From: Raphael H. <ra...@ge...> - 2003-02-24 17:10:33
|
Le Mon, Feb 24, 2003 at 03:58:24PM +0100, Olaf Dietsche écrivait: > > use GT::Indicators qw($GET_LOW $GET_HIGH); > > Ok, here's my next try. Thanks, applied. Cheers, -- Raphaël Hertzog -+- http://www.ouaza.com Formation Linux et logiciel libre : http://www.logidee.com |
|
From: GeniusTrader C. r. <ra...@ge...> - 2003-02-24 17:05:23
|
Update of /bourse/cvsroot/GT/Systems In directory arrakis:/scratch/tmp/cvs-serv26178/Systems Modified Files: TTS.pm Log Message: - Several fixes for undefined symbol $GET_LOW/$GET_HIGH. Thanks to Olaf Dietsche. --- /bourse/cvsroot/GT/Systems/TTS.pm 2003/01/21 21:15:25 1.4 +++ /bourse/cvsroot/GT/Systems/TTS.pm 2003/02/24 16:02:38 1.5 @@ -10,6 +10,7 @@ use Carp::Datum; use GT::Prices; use GT::Systems; +use GT::Indicators qw($GET_LOW $GET_HIGH); use GT::Indicators::Generic::MinInPeriod; use GT::Indicators::Generic::MaxInPeriod; |
|
From: GeniusTrader C. r. <ra...@ge...> - 2003-02-24 17:05:20
|
Update of /bourse/cvsroot/GT/Signals/Prices In directory arrakis:/scratch/tmp/cvs-serv26178/Signals/Prices Modified Files: RecordPriceLow.pm Log Message: - Several fixes for undefined symbol $GET_LOW/$GET_HIGH. Thanks to Olaf Dietsche. --- /bourse/cvsroot/GT/Signals/Prices/RecordPriceLow.pm 2003/01/21 21:15:25 1.4 +++ /bourse/cvsroot/GT/Signals/Prices/RecordPriceLow.pm 2003/02/24 16:02:38 1.5 @@ -9,6 +9,7 @@ use GT::Signals; use GT::Prices; +use GT::Indicators qw($GET_LOW); use GT::Indicators::Generic::MinInPeriod; @ISA = qw(GT::Signals); |
|
From: GeniusTrader C. r. <ra...@ge...> - 2003-02-24 17:05:18
|
Update of /bourse/cvsroot/GT/CloseStrategy/Stop In directory arrakis:/scratch/tmp/cvs-serv26178/CloseStrategy/Stop Modified Files: KeepRunUp.pm Log Message: - Several fixes for undefined symbol $GET_LOW/$GET_HIGH. Thanks to Olaf Dietsche. --- /bourse/cvsroot/GT/CloseStrategy/Stop/KeepRunUp.pm 2003/01/21 21:15:25 1.4 +++ /bourse/cvsroot/GT/CloseStrategy/Stop/KeepRunUp.pm 2003/02/24 16:02:37 1.5 @@ -8,6 +8,7 @@ use vars qw(@ISA @NAMES); use GT::CloseStrategy; +use GT::Indicators qw($GET_LOW $GET_HIGH); use GT::Indicators::Generic::MaxInPeriod; use GT::Indicators::Generic::MinInPeriod; use GT::Prices; |
|
From: Olaf D. <olaf.dietsche#<lis...@t-...> - 2003-02-24 16:04:18
|
Raphael Hertzog <ra...@ge...> writes: > Le Mon, Feb 24, 2003 at 01:54:58PM +0100, Olaf Dietsche écrivait: >> I looked through the sources for $GET_LOW and tried to fix the other >> users. > > Unfortunately the fix is not so good. use GT::Indicators will import > the definition of manage_object from Indicators ... this is acceptable > only for indicators. If you need GET_LOW in an object that is not > an indicator you should import only the required symbol with > something like that : > > use GT::Indicators qw($GET_LOW $GET_HIGH); Ok, here's my next try. Regards, Olaf. |
|
From: Raphael H. <ra...@ge...> - 2003-02-24 15:37:41
|
Le Mon, Feb 24, 2003 at 01:54:58PM +0100, Olaf Dietsche écrivait: > I looked through the sources for $GET_LOW and tried to fix the other > users. Unfortunately the fix is not so good. use GT::Indicators will import the definition of manage_object from Indicators ... this is acceptable only for indicators. If you need GET_LOW in an object that is not an indicator you should import only the required symbol with something like that : use GT::Indicators qw($GET_LOW $GET_HIGH); Cheers, -- Raphaël Hertzog -+- http://www.ouaza.com Formation Linux et logiciel libre : http://www.logidee.com |
|
From: Olaf D. <olaf.dietsche#<lis...@t-...> - 2003-02-24 13:56:07
|
Raphael Hertzog <ra...@ge...> writes: > Le Mon, Feb 24, 2003 at 01:06:37AM +0100, Olaf Dietsche écrivait: > >> Whats wrong with the above backtest? > > Nothing, that's what we call a bug. I fixed it in CVS. I looked through the sources for $GET_LOW and tried to fix the other users. Regards, Olaf. |
|
From: Olaf D. <olaf.dietsche#<lis...@t-...> - 2003-02-24 11:52:28
|
Raphael Hertzog <ra...@ge...> writes: > Le Mon, Feb 24, 2003 at 10:59:38AM +0100, Olaf Dietsche écrivait: >> Same error message as before. I use debian unstable perl 5.8.0-15 > > Did you update your copy of the repository ? > > $ md5sum ~/bourse/GT/CloseStrategy/Stop/ExtremePrices.pm > b770a58a669fb678c4292d98f910582c Please ignore my previous post. It was my stupidity, I had an old version lying around in ../../, which caused the error message. I updated geniustrader from CVS and now the backtest gives a proper report. Sorry for the confusion and thanks for your help. Regards, Olaf. |