App/Chart/StockMonkey.pm untested

filter: Statementstmt 0.0% 0 / 7 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 2 Podpod n/a totaltotal 0.0% 0 / 9 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 # Copyright 2009 Kevin Ryde
2  
3 # This file is part of Chart.
4 #
5 # Chart is free software; you can redistribute it and/or modify it under the
6 # terms of the GNU General Public License as published by the Free Software
7 # Foundation; either version 3, or (at your option) any later version.
8 #
9 # Chart is distributed in the hope that it will be useful, but WITHOUT ANY
10 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12 # details.
13 #
14 # You should have received a copy of the GNU General Public License along
15 # with Chart. If not, see <http://www.gnu.org/licenses/>.
16  
17 package App::Chart::StockMonkey;
18 use strict;
19 use warnings;
20  
21 # my @averages = qw(Math::Business::SMA
22 # Math::Business::EMA
23 # Math::Business::WMA
24 # Math::Business::HMA
25 #
26 # my $avg = new Math::Business::EMA;
27 # $avg->set_days(7);
28 #
29 # my @closing_values = qw(
30 # 3 4 4 5 6 5 6 5 5 5 5
31 # 6 6 6 6 7 7 7 8 8 8 8
32 # );
33 #
34 # # choose one:
35 # $avg->insert( @closing_values );
36 # $avg->insert( $_ ) for @closing_values;
37 #
38 # if( defined(my $q = $avg->query) ) {
39 #
40 # Math::Business::LaguerreFilter
41 # my $avg = new Math::Business::LaguerreFilter;
42 # $avg->set_days(9);
43 # $avg->set_alpha(0.2); # same (roughly)
44 #
45 # my @closing_values = qw(
46 # 3 4 4 5 6 5 6 5 5 5 5
47 # 6 6 6 6 7 7 7 8 8 8 8
48 # );
49 #
50 # # choose one:
51 # $avg->insert( @closing_values );
52 # $avg->insert( $_ ) for @closing_values;
53 #
54 # if( defined(my $q = $avg->query) ) {
55 #
56 # Math::Business::MACD
57 # print " MACD: ", scalar $macd->query, "\n",
58 # "Trigger EMA: ", $macd->query_trig_ema, "\n",
59 # " Fast EMA: ", $macd->query_fast_ema, "\n",
60 # " Slow EMA: ", $macd->query_slow_ema, "\n";
61 # " Histogram: ", $macd->query_histogram, "\n";
62 #
63 # Math::Business::RSI
64 # my $rsi = Math::Business::RSI->recommended;
65 #
66 # Math::Business::BollingerBands
67 #
68 # Math::Business::ATR
69 # [ 5, 3, 4 ], # high, low, close
70 # [ 6, 4, 5 ],
71 # [ 5, 4, 4.5 ],
72 # );
73 #
74 # # choose one:
75 # $atr->insert( @data_points );
76 # $atr->insert( $_ ) for @data_points;
77 #
78 # Math::Business::DMI
79 # my @data_points = (
80 # [ 5, 3, 4 ], # high, low, close
81 # [ 6, 4, 5 ],
82 # [ 5, 4, 4.5 ],
83 # );
84 #
85 # # choose one:
86 # $dmi->insert( @data_points );
87 # $dmi->insert( $_ ) for @data_points;
88 #
89 # Math::Business::ParabolicSAR
90 # my @data_points = (
91 # ["35.0300", "35.1300", "34.3600", "34.3900"],
92 # ["34.6400", "35.0000", "34.2100", "34.7400"],
93 # ["34.6900", "35.1400", "34.3800", "34.7900"],
94 # ["35.2900", "35.7900", "35.0800", "35.5200"],
95 # ["35.9000", "36.0600", "35.7500", "36.0600"],
96 # ["36.1300", "36.7200", "36.0500", "36.5800"],
97 # ["36.4100", "36.6400", "36.2600", "36.6100"],
98 # ["36.3500", "36.5500", "35.9400", "35.9700"],
99 # );
100 #
101 # # choose one:
102 # $sar->insert( @data_points );
103 # $sar->insert( $_ ) for @data_points;
104 #
105 # my $sar = $sar->query;
106 # print "SAR: $sar\n";
107  
108 1;
109 __END__