GeniusTrader/Indicators/Generic/Container.pm untested

filter: Statementstmt 0.0% 0 / 25 Branchbran n/a Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 40 CC 1 SCAR 6.9
CC
1
Cov
0%
new
2.0
initialize
2.0
calculate
2.0
CRAP 2.0
1 package Finance::GeniusTrader::Indicators::Generic::Container;
2  
3 # Copyright 2004 Raphaƫl Hertzog
4 # This file is distributed under the terms of the General Public License
5 # version 2 or (at your option) any later version.
6  
7 # Standards-Version: 1.0
8  
9 use strict;
10 use vars qw(@ISA @NAMES);
11  
12 use Finance::GeniusTrader::Indicators;
13  
14 @ISA = qw(Finance::GeniusTrader::Indicators);
15 @NAMES = ("Container[#*]");
16  
17 =head1 NAME
18  
19 Finance::GeniusTrader::Indicators::Generic::Container - Fake indicator which does nothing but acts as a data container
20  
21 =head1 DESCRIPTION
22  
23 This indicator can be used to store arbitrary series of data in particular
24 temporary values used during calculations of complicated indicators. If you
25 need to calculate the SMA of an expression, you can store the result of that
26 expression in that indicator.
27  
28 All arguments passed serves only one purpose : differentiate the
29 various series of data stored. Care should be taken to ensure the
30 uniqueness of the indicator name, if there is a chance that several
31 instances of this indicator are active at the same time (e.g., when
32 used as the long and short signals of a system).
33  
34  
35 =cut
36 sub new {
37 my ($type, $args, $key) = @_;
38 my $class = ref($type) || $type;
39 my $self = { };
40 no strict "refs";
41 $self->{'args'}->[0] = join(" ", @{$args});
42 # Just to avoid problems created by adding of spaces by Finance::GeniusTrader::ArgsTree
43 # parsing ...
44 $self->{'args'}->[0] =~ s/\s+{/{/g;
45 $self->{'args'}->[0] =~ s/}\s+/}/g;
46 return manage_object(\@{"$class\::NAMES"}, $self, $class, $self->{'args'}, $key);
47 }
48  
49 sub initialize {
50 my ($self) = @_;
51  
52 }
53  
54 sub calculate {
55 my ($self, $calc, $i) = @_;
56
57 # Always succeeds !
58 }