blib/lib/Math/Business/SM/Stochastic.pm

filter: Statementstmt 80.9% 166 / 205 Branchbran 62.5% 50 / 80 Conditioncond 55.8% 38 / 68 MC/DCmcdc 17.9% 7 / 39 Subroutinesub 88.0% 22 / 25 Podpod 0.0% 0 / 17 totaltotal 65.2% 283 / 434 CC 80 SCAR 43.1
CC
80
Cov
72%
insert_lane
363.6
insert_full
16.4
insert_slow
15.2
CRAP 74.2
↑ Summary blib/lib/Math/Business/ParabolicSAR.pm »
1 package Math::Business::SM::Stochastic;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 ▶use Math::Business::SMA;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 1 1;
10  
11 0 ▶sub tag { (shift)->{tag} }
Subroutine tag: not called CC=1 SCAR=6.9
Pod undocumented
12  
13 1 ▶use constant METHOD_LANE => 0;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 1 ▶use constant METHOD_FAST => 1;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 1 ▶use constant METHOD_SLOW => 2;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 1 ▶use constant METHOD_FULL => 3;
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 0 ▶sub recommended { my $class = shift; return $class->new(METHOD_LANE,5,3); }
Subroutine recommended: not called CC=1 SCAR=6.9
Pod undocumented
19  
20 1 ▶sub method_slow { my $class = shift; return $class->new(METHOD_SLOW,$_[0]||14,$_[1]||3); }
Subroutine method_slow: called CC=3 SCAR=12.0
Pod undocumented
Condition50%2/4
$_[0] || 14
l!l
10
$_[1] || 3
l!l
10
MC/DC0%0/1
$_[0] || 14
$_[0]
MC/DC0%0/1
$_[1] || 3
$_[1]
Truth table50%1/2
A
A= $_[0]
Aresult
11
00
Truth table50%1/2
A
A= $_[1]
Aresult
11
00
21 1 ▶sub method_fast { my $class = shift; return $class->new(METHOD_FAST,$_[0]||14,$_[1]||3); }
Subroutine method_fast: called CC=3 SCAR=12.0
Pod undocumented
Condition50%2/4
$_[0] || 14
l!l
10
$_[1] || 3
l!l
10
MC/DC0%0/1
$_[0] || 14
$_[0]
MC/DC0%0/1
$_[1] || 3
$_[1]
Truth table50%1/2
A
A= $_[0]
Aresult
11
00
Truth table50%1/2
A
A= $_[1]
Aresult
11
00
22 1 ▶sub method_full { my $class = shift; return $class->new(METHOD_FULL,$_[0]||14,$_[1]||3,$_[2]||3); }
Subroutine method_full: called CC=4 SCAR=15.8
Pod undocumented
Condition50%3/6
$_[0] || 14
l!l
10
$_[1] || 3
l!l
10
$_[2] || 3
l!l
10
MC/DC0%0/1
$_[0] || 14
$_[0]
MC/DC0%0/1
$_[1] || 3
$_[1]
MC/DC0%0/1
$_[2] || 3
$_[2]
Truth table50%1/2
A
A= $_[0]
Aresult
11
00
Truth table50%1/2
A
A= $_[1]
Aresult
11
00
Truth table50%1/2
A
A= $_[2]
Aresult
11
00
23  
24 3 ▶sub new {
Subroutine new: called CC=5 SCAR=16.3
Pod undocumented
25 3 my $class = shift;
26 3 ▶ my $meth = shift || METHOD_LANE;
Condition50%1/2
shift() || 0
l!l
30
MC/DC0%0/1
shift() || 0
shift()
Truth table50%1/2
A
A= shift()
Aresult
11
00
27 3 ▶ my $kp = shift || 5;
Condition50%1/2
shift() || 5
l!l
30
MC/DC0%0/1
shift() || 5
shift()
Truth table50%1/2
A
A= shift()
Aresult
11
00
28 3 ▶ my $dp = shift || 3;
Condition50%1/2
shift() || 3
l!l
30
MC/DC0%0/1
shift() || 3
shift()
Truth table50%1/2
A
A= shift()
Aresult
11
00
29 3 ▶ my $xp = shift || 3;
Condition100%2/2
shift() || 3
l!l
12
MC/DC100%1/1
shift() || 3
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
30  
31 3 my $this = bless {}, $class;
32  
33 3 $this->set_method( $meth );
34 3 $this->set_days( $kp );
35 3 $this->set_dperiod( $dp );
36 3 $this->set_xperiod( $xp );
37  
38 3 return $this;
39 }
40  
41 3 ▶sub set_days {
Subroutine set_days: called CC=2 SCAR=7.0
Pod undocumented
42 3 my $this = shift;
43 3 my $arg = shift;
44  
45 3 ▶ croak "days must be a positive non-zero integer" if $arg <= 0;
Branch: 1 branch
BranchTrueFalseTotal
if $arg <= 0 0 3 3
46  
47 3 $this->{kp} = $arg;
48 3 $this->set_tag;
49 }
50  
51 3 ▶sub set_dperiod {
Subroutine set_dperiod: called CC=2 SCAR=7.0
Pod undocumented
52 3 my $this = shift;
53 3 my $arg = shift;
54  
55 3 ▶ croak "days must be a positive non-zero integer" if $arg <= 0;
Branch: 1 branch
BranchTrueFalseTotal
if $arg <= 0 0 3 3
56  
57 3 $this->{dp} = $arg;
58 3 $this->set_tag;
59 }
60  
61 3 ▶sub set_xperiod {
Subroutine set_xperiod: called CC=2 SCAR=7.0
Pod undocumented
62 3 my $this = shift;
63 3 my $arg = shift;
64  
65 3 ▶ croak "days must be a positive non-zero integer" if $arg <= 0;
Branch: 1 branch
BranchTrueFalseTotal
if $arg <= 0 0 3 3
66  
67 3 $this->{xp} = $arg;
68 3 $this->set_tag;
69 }
70  
71 3 ▶sub set_method {
Subroutine set_method: called CC=2 SCAR=6.9
Pod undocumented
72 3 my $this = shift;
73 3 my $meth = shift;
74  
75 3 ▶ croak "method not known" unless grep {$meth == $_} (METHOD_LANE, METHOD_FAST, METHOD_SLOW, METHOD_FULL);
Branch: 1 branch
BranchTrueFalseTotal
unless grep {$meth == $_;} 0, 1, 2, 3 0 3 3
76  
77 3 $this->{m} = $meth;
78  
79 3 delete $this->{ksma};
80 3 delete $this->{dsma};
81  
82 3 $this->set_tag;
83  
84 3 return;
85 }
86  
87 12 ▶sub set_tag {
Subroutine set_tag: called CC=5 SCAR=16.2
Pod undocumented
88 12 my $this = shift;
89  
90 12 ▶ return if grep { not defined } @$this{qw(kp dp xp)};
Branch: 1 branch
BranchTrueFalseTotal
if grep {not defined $_;} @$this{"kp", "dp", "xp"} 9 3 12
91  
92 3 ▶ if( $this->{m} == METHOD_FULL ) {
Branch: 3 branches
BranchTrueFalseTotal
if ($this->{'m'} == 3) { } 1 2 3
elsif ($this->{'m'} == 1) { } 1 1 2
elsif ($this->{'m'} == 2) { } 1 0 1
93 1 $this->{tag} = "FullSTO($this->{kp},$this->{dp},$this->{xp})";
94  
95 } elsif( $this->{m} == METHOD_FAST ) {
96 1 $this->{tag} = "FSTO($this->{kp},$this->{dp})";
97  
98 } elsif( $this->{m} == METHOD_SLOW ) {
99 1 $this->{tag} = "SSTO($this->{kp},$this->{dp})";
100  
101 } else {
102 0 $this->{tag} = "STO($this->{kp},$this->{dp})";
103 }
104 }
105  
106 {
107 1 my $method = {
108 METHOD_LANE() => \&insert_lane,
109 METHOD_FAST() => \&insert_fast,
110 METHOD_SLOW() => \&insert_slow,
111 METHOD_FULL() => \&insert_full,
112 };
113  
114 90 ▶ sub insert {
Subroutine insert: called CC=1 SCAR=0.0
Pod undocumented
115 90 my $this = shift;
116 90 my $m = $method->{$this->{m}};
117  
118 90 return $this->$m( @_ );
119 }
120 }
121  
122 # {{{ sub insert_lane
123 1 ▶sub insert_lane {
Subroutine insert_lane: not called CC=19 SCAR=59.0
Pod undocumented
124 0 my $this = shift;
125  
126 0 ▶ my $l = ($this->{low_hist} ||= []);
Condition0%0/2
$this->{"low_hist"} ||= []
l!l
00
MC/DC0%0/1
$this->{"low_hist"} ||= []
$this->{"low_hist"}
Truth table0%0/2
A
A= $this->{"low_hist"}
Aresult
11
00
127 0 ▶ my $h = ($this->{high_hist} ||= []);
Condition0%0/2
$this->{"high_hist"} ||= []
l!l
00
MC/DC0%0/1
$this->{"high_hist"} ||= []
$this->{"high_hist"}
Truth table0%0/2
A
A= $this->{"high_hist"}
Aresult
11
00
128 0 my $kp = $this->{kp};
129 0 my $dp = $this->{dp};
130  
131 0 my ($K, $D);
132 0 ▶ while( defined( my $point = shift ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $point = shift())) 0 0 0
133 0 ▶ croak "insert takes three tuple (high, low, close)" unless ref $point eq "ARRAY" and @$point == 3;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $point eq "ARRAY" and @$point == 3 0 0 0
Condition0%0/3
ref $point eq "ARRAY" and @$point == 3
!ll&&!rl&&r
000
MC/DC0%0/2
ref $point eq "ARRAY" and @$point == 3
ref $point eq "ARRAY" @$point == 3
Truth table0%0/3
A and B
A= ref $point eq "ARRAY"B= @$point == 3
ABresult
0X0
100
111
134 0 my ($t_high, $t_low, $t_close) = @$point;
135  
136 0 ▶ push @$l, $t_low; shift @$l while @$l > $kp;
Branch: 1 branch
BranchTrueFalseTotal
@$l > $kp and do { shift @$l } 0 0 0
137 0 ▶ push @$h, $t_high; shift @$h while @$h > $kp;
Branch: 1 branch
BranchTrueFalseTotal
@$h > $kp and do { shift @$h } 0 0 0
138  
139 0 ▶ if( @$l == $kp ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@$l == $kp) 0 0 0
140 0 ▶ my $L = $l->[0]; for( 1 .. $#$l ) { $L = $l->[$_] if $l->[$_] < $L };
Branch: 1 branch
BranchTrueFalseTotal
if $l->[$_] < $L 0 0 0
141 0 ▶ my $H = $h->[0]; for( 1 .. $#$h ) { $H = $h->[$_] if $h->[$_] > $H };
Branch: 1 branch
BranchTrueFalseTotal
if $h->[$_] > $H 0 0 0
142  
143 0 ▶ if( $H != $L ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($H != $L) { } 0 0 0
144 0 $K = 100 * ($t_close - $L)/($H-$L);
145 } else {
146 # added 2018-06-10 per Marcel Ebbrecht, to avoid division by
147 # zero we don't really have any notes from Lane on this, so
148 # K=100 seems reasonable; but I admit I have no idea what the
149 # the "correct" behavior might be, if there is one.
150 0 $K = 100;
151 }
152  
153 0 ▶ $L = $l->[-$dp]; for( (-$dp+1) .. -1 ) { $L = $l->[$_] if $l->[$_] < $L };
Branch: 1 branch
BranchTrueFalseTotal
if $l->[$_] < $L 0 0 0
154 0 ▶ $H = $h->[-$dp]; for( (-$dp+1) .. -1 ) { $H = $h->[$_] if $h->[$_] > $H };
Branch: 1 branch
BranchTrueFalseTotal
if $h->[$_] > $H 0 0 0
155  
156 0 ▶ if( $L != 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($L != 0) { } 0 0 0
157 0 $D = 100 * $H / $L;
158 } else {
159 # also added 2018-06-10 (see above comment)
160 0 $D = 100;
161 }
162 }
163 }
164  
165 0 $this->{K} = $K;
166 0 $this->{D} = $D;
167  
168 0 return;
169 }
170  
171 # }}}
172 # {{{ sub insert_fast
173 30 ▶sub insert_fast {
Subroutine insert_fast: called CC=14 SCAR=26.5
Pod undocumented
174 30 my $this = shift;
175  
176 30 ▶ my $l = ($this->{low_hist} ||= []);
Condition100%2/2
$this->{"low_hist"} ||= []
l!l
291
MC/DC100%1/1
$this->{"low_hist"} ||= []
$this->{"low_hist"}
Truth table100%2/2
A
A= $this->{"low_hist"}
Aresult
11
00
177 30 ▶ my $h = ($this->{high_hist} ||= []);
Condition100%2/2
$this->{"high_hist"} ||= []
l!l
291
MC/DC100%1/1
$this->{"high_hist"} ||= []
$this->{"high_hist"}
Truth table100%2/2
A
A= $this->{"high_hist"}
Aresult
11
00
178 30 my $kp = $this->{kp};
179 30 my $dp = $this->{dp};
180  
181 30 ▶ my $dsma = ($this->{dsma} ||= Math::Business::SMA->new($dp));
Condition66%2/3
$this->{"dsma"} ||= "Math::Business::SMA"->new($dp)
l!l&&r!l&&!r
2910
MC/DC0%0/2
$this->{"dsma"} ||= "Math::Business::SMA"->new($dp)
$this->{"dsma"} "Math::Business::SMA"->new($dp)
Truth table66%2/3
A ||= B
A= $this->{"dsma"}B= "Math::Business::SMA"->new($dp)
ABresult
1X1
011
000
182  
183 30 my ($K, $D);
184 30 ▶ while( defined( my $point = shift ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $point = shift())) 30 30 60
185 30 ▶ croak "insert takes three tuple (high, low, close)" unless ref $point eq "ARRAY" and @$point == 3;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $point eq "ARRAY" and @$point == 3 0 30 30
Condition33%1/3
ref $point eq "ARRAY" and @$point == 3
!ll&&!rl&&r
0030
MC/DC0%0/2
ref $point eq "ARRAY" and @$point == 3
ref $point eq "ARRAY" @$point == 3
Truth table33%1/3
A and B
A= ref $point eq "ARRAY"B= @$point == 3
ABresult
0X0
100
111
186 30 my ($t_high, $t_low, $t_close) = @$point;
187  
188 30 ▶ push @$l, $t_low; shift @$l while @$l > $kp;
Branch: 1 branch
BranchTrueFalseTotal
@$l > $kp and do { shift @$l } 16 30 46
189 30 ▶ push @$h, $t_high; shift @$h while @$h > $kp;
Branch: 1 branch
BranchTrueFalseTotal
@$h > $kp and do { shift @$h } 16 30 46
190  
191 30 ▶ if( @$l == $kp ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@$l == $kp) 17 13 30
192 17 ▶ my $L = $l->[0]; for( 1 .. $#$l ) { $L = $l->[$_] if $l->[$_] < $L };
Branch: 1 branch
BranchTrueFalseTotal
if $l->[$_] < $L 34 187 221
193 17 ▶ my $H = $h->[0]; for( 1 .. $#$h ) { $H = $h->[$_] if $h->[$_] > $H };
Branch: 1 branch
BranchTrueFalseTotal
if $h->[$_] > $H 71 150 221
194  
195 17 $K = 100 * ($t_close - $L)/($H-$L);
196  
197 17 $dsma->insert($K);
198 17 $D = $dsma->query;
199 }
200 }
201  
202 30 $this->{K} = $K;
203 30 $this->{D} = $D;
204  
205 30 return;
206 }
207  
208 # }}}
209 # {{{ sub insert_slow
210 30 ▶sub insert_slow {
Subroutine insert_slow: called CC=15 SCAR=27.2
Pod undocumented
211 30 my $this = shift;
212  
213 30 ▶ my $l = ($this->{low_hist} ||= []);
Condition100%2/2
$this->{"low_hist"} ||= []
l!l
291
MC/DC100%1/1
$this->{"low_hist"} ||= []
$this->{"low_hist"}
Truth table100%2/2
A
A= $this->{"low_hist"}
Aresult
11
00
214 30 ▶ my $h = ($this->{high_hist} ||= []);
Condition100%2/2
$this->{"high_hist"} ||= []
l!l
291
MC/DC100%1/1
$this->{"high_hist"} ||= []
$this->{"high_hist"}
Truth table100%2/2
A
A= $this->{"high_hist"}
Aresult
11
00
215 30 my $kp = $this->{kp};
216 30 my $dp = $this->{dp};
217  
218 30 ▶ my $dsma = ($this->{dsma} ||= Math::Business::SMA->new($dp));
Condition66%2/3
$this->{"dsma"} ||= "Math::Business::SMA"->new($dp)
l!l&&r!l&&!r
2910
MC/DC0%0/2
$this->{"dsma"} ||= "Math::Business::SMA"->new($dp)
$this->{"dsma"} "Math::Business::SMA"->new($dp)
Truth table66%2/3
A ||= B
A= $this->{"dsma"}B= "Math::Business::SMA"->new($dp)
ABresult
1X1
011
000
219 30 ▶ my $ksma = ($this->{ksma} ||= Math::Business::SMA->new($dp));
Condition66%2/3
$this->{"ksma"} ||= "Math::Business::SMA"->new($dp)
l!l&&r!l&&!r
2910
MC/DC0%0/2
$this->{"ksma"} ||= "Math::Business::SMA"->new($dp)
$this->{"ksma"} "Math::Business::SMA"->new($dp)
Truth table66%2/3
A ||= B
A= $this->{"ksma"}B= "Math::Business::SMA"->new($dp)
ABresult
1X1
011
000
220  
221 30 my ($K, $D);
222 30 ▶ while( defined( my $point = shift ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $point = shift())) 30 30 60
223 30 ▶ croak "insert takes three tuple (high, low, close)" unless ref $point eq "ARRAY" and @$point == 3;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $point eq "ARRAY" and @$point == 3 0 30 30
Condition33%1/3
ref $point eq "ARRAY" and @$point == 3
!ll&&!rl&&r
0030
MC/DC0%0/2
ref $point eq "ARRAY" and @$point == 3
ref $point eq "ARRAY" @$point == 3
Truth table33%1/3
A and B
A= ref $point eq "ARRAY"B= @$point == 3
ABresult
0X0
100
111
224 30 my ($t_high, $t_low, $t_close) = @$point;
225  
226 30 ▶ push @$l, $t_low; shift @$l while @$l > $kp;
Branch: 1 branch
BranchTrueFalseTotal
@$l > $kp and do { shift @$l } 16 30 46
227 30 ▶ push @$h, $t_high; shift @$h while @$h > $kp;
Branch: 1 branch
BranchTrueFalseTotal
@$h > $kp and do { shift @$h } 16 30 46
228  
229 30 ▶ if( @$l == $kp ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@$l == $kp) 17 13 30
230 17 ▶ my $L = $l->[0]; for( 1 .. $#$l ) { $L = $l->[$_] if $l->[$_] < $L };
Branch: 1 branch
BranchTrueFalseTotal
if $l->[$_] < $L 34 187 221
231 17 ▶ my $H = $h->[0]; for( 1 .. $#$h ) { $H = $h->[$_] if $h->[$_] > $H };
Branch: 1 branch
BranchTrueFalseTotal
if $h->[$_] > $H 71 150 221
232  
233 17 $ksma->insert( 100 * ($t_close - $L)/($H-$L) );
234 17 $K = $ksma->query;
235  
236 17 $dsma->insert($K);
237 17 $D = $dsma->query;
238 }
239 }
240  
241 30 $this->{K} = $K;
242 30 $this->{D} = $D;
243  
244 30 return;
245 }
246  
247 # }}}
248 # {{{ sub insert_full
249 30 ▶sub insert_full {
Subroutine insert_full: called CC=16 SCAR=28.0
Pod undocumented
250 30 my $this = shift;
251  
252 30 ▶ my $l = ($this->{low_hist} ||= []);
Condition100%2/2
$this->{"low_hist"} ||= []
l!l
291
MC/DC100%1/1
$this->{"low_hist"} ||= []
$this->{"low_hist"}
Truth table100%2/2
A
A= $this->{"low_hist"}
Aresult
11
00
253 30 ▶ my $h = ($this->{high_hist} ||= []);
Condition100%2/2
$this->{"high_hist"} ||= []
l!l
291
MC/DC100%1/1
$this->{"high_hist"} ||= []
$this->{"high_hist"}
Truth table100%2/2
A
A= $this->{"high_hist"}
Aresult
11
00
254 30 my $kp = $this->{kp};
255 30 my $dp = $this->{dp};
256 30 ▶ my $xp = $this->{xp} || $this->{dp};
Condition33%1/3
$this->{'xp'} || $this->{'dp'}
l!l&&r!l&&!r
3000
MC/DC0%0/2
$this->{'xp'} || $this->{'dp'}
$this->{'xp'} $this->{'dp'}
Truth table33%1/3
A || B
A= $this->{'xp'}B= $this->{'dp'}
ABresult
1X1
011
000
257  
258 30 ▶ my $dsma = ($this->{dsma} ||= Math::Business::SMA->new($xp));
Condition66%2/3
$this->{"dsma"} ||= "Math::Business::SMA"->new($xp)
l!l&&r!l&&!r
2910
MC/DC0%0/2
$this->{"dsma"} ||= "Math::Business::SMA"->new($xp)
$this->{"dsma"} "Math::Business::SMA"->new($xp)
Truth table66%2/3
A ||= B
A= $this->{"dsma"}B= "Math::Business::SMA"->new($xp)
ABresult
1X1
011
000
259 30 ▶ my $ksma = ($this->{ksma} ||= Math::Business::SMA->new($xp));
Condition66%2/3
$this->{"ksma"} ||= "Math::Business::SMA"->new($xp)
l!l&&r!l&&!r
2910
MC/DC0%0/2
$this->{"ksma"} ||= "Math::Business::SMA"->new($xp)
$this->{"ksma"} "Math::Business::SMA"->new($xp)
Truth table66%2/3
A ||= B
A= $this->{"ksma"}B= "Math::Business::SMA"->new($xp)
ABresult
1X1
011
000
260  
261 30 my ($K, $D);
262 30 ▶ while( defined( my $point = shift ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $point = shift())) 30 30 60
263 30 ▶ croak "insert takes three tuple (high, low, close)" unless ref $point eq "ARRAY" and @$point == 3;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $point eq "ARRAY" and @$point == 3 0 30 30
Condition33%1/3
ref $point eq "ARRAY" and @$point == 3
!ll&&!rl&&r
0030
MC/DC0%0/2
ref $point eq "ARRAY" and @$point == 3
ref $point eq "ARRAY" @$point == 3
Truth table33%1/3
A and B
A= ref $point eq "ARRAY"B= @$point == 3
ABresult
0X0
100
111
264 30 my ($t_high, $t_low, $t_close) = @$point;
265  
266 30 ▶ push @$l, $t_low; shift @$l while @$l > $kp;
Branch: 1 branch
BranchTrueFalseTotal
@$l > $kp and do { shift @$l } 16 30 46
267 30 ▶ push @$h, $t_high; shift @$h while @$h > $kp;
Branch: 1 branch
BranchTrueFalseTotal
@$h > $kp and do { shift @$h } 16 30 46
268  
269 30 ▶ if( @$l == $kp ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@$l == $kp) 17 13 30
270 17 ▶ my $L = $l->[0]; for( 1 .. $#$l ) { $L = $l->[$_] if $l->[$_] < $L };
Branch: 1 branch
BranchTrueFalseTotal
if $l->[$_] < $L 34 187 221
271 17 ▶ my $H = $h->[0]; for( 1 .. $#$h ) { $H = $h->[$_] if $h->[$_] > $H };
Branch: 1 branch
BranchTrueFalseTotal
if $h->[$_] > $H 71 150 221
272  
273 17 $ksma->insert( 100 * ($t_close - $L)/($H-$L) );
274 17 $K = $ksma->query;
275  
276 17 $dsma->insert($K);
277 17 $D = $dsma->query;
278 }
279 }
280  
281 30 $this->{K} = $K;
282 30 $this->{D} = $D;
283  
284 30 return;
285 }
286  
287 # }}}
288  
289 90 ▶sub query {
Subroutine query: called CC=1 SCAR=0.0
Pod undocumented
290 90 my $this = shift;
291  
292 90 return ($this->{D}, $this->{K});
293 }
294  
295 __END__
↑ Summary blib/lib/Math/Business/ParabolicSAR.pm »