App-financeta
view release on metacpan or search on metacpan
lib/App/financeta/indicators.pm view on Meta::CPAN
my $period = $args[0];
my $outpdl = PDL::ta_cci($high, $low, $close, @args);
return [
["CCI($period)", $outpdl, undef, "cci_$period"],
];
},
gnuplot => \&_plot_gnuplot_additional,
highcharts => \&_plot_highcharts_additional,
},
cmo => {
name => 'Chande Momentum Oscillator (CMO)',
params => [
# key, pretty name, type, default value
[ 'InTimePeriod', 'Period Window (2 - 100000)', PDL::long, 14],
],
code => sub {
my ($obj, $inpdl, @args) = @_;
$log->debug("Executing ta_cmo with parameters: ", dumper(\@args));
my $period = $args[0];
my $outpdl = PDL::ta_cmo($inpdl, @args);
return [
["CMO($period)", $outpdl, undef, "cmo_$period"],
];
},
gnuplot => \&_plot_gnuplot_additional,
highcharts => \&_plot_highcharts_additional,
},
dx => {
name => 'Directional Movement Index (DX)',
params => [
# key, pretty name, type, default value
[ 'InTimePeriod', 'Period Window (2 - 100000)', PDL::long, 14],
],
input => [qw/high low close/],
code => sub {
my ($obj, $high, $low, $close, @args) = @_;
$log->debug("Executing ta_dx with parameters: ", dumper(\@args));
my $period = $args[0];
my $outpdl = PDL::ta_dx($high, $low, $close, @args);
return [
["DX($period)", $outpdl, undef, "dx_$period"],
];
},
gnuplot => \&_plot_gnuplot_additional,
highcharts => \&_plot_highcharts_additional,
},
macd => {
name => 'Moving Average Convergence/Divergence (MACD)',
params => [
# key, pretty name, type, default value
[ 'InFastPeriod', 'Fast MA Period Window (2 - 100000)', PDL::long, 12],
[ 'InSlowPeriod', 'Slow MA Period Window (2 - 100000)', PDL::long, 26],
[ 'InSignalPeriod', 'Signal Line Smoothing (1 - 100000)', PDL::long, 9],
],
code => sub {
my ($obj, $inpdl, @args) = @_;
$log->debug("Executing ta_macd with parameters ", dumper(\@args));
my $fast = $args[0];
my $slow = $args[1];
my $signal = $args[2];
my ($omacd, $omacdsig, $omacdhist) = PDL::ta_macd($inpdl, @args);
return [
["MACD($fast/$slow/$signal)", $omacd, undef, "macd_$fast\_$slow\_$signal"],
["MACD Signal($fast/$slow/$signal)", $omacdsig, undef, "macdsig_$fast\_$slow\_$signal"],
["MACD Histogram($fast/$slow/$signal)", $omacdhist, { with => 'impulses' }, "macdhist_$fast\_$slow\_$signal"],
];
},
gnuplot => \&_plot_gnuplot_additional,
highcharts => \&_plot_highcharts_additional,
},
macdext => {
name => 'MACD with different Mov. Avg',
params => [
# key, pretty name, type, default value
[ 'InFastPeriod', 'Fast MA Period Window (2 - 100000)', PDL::long, 12],
# this will show up in a combo list
[ 'InFastMAType', 'Fast Moving Average Type', 'ARRAY',
[
'Simple', #SMA
'Exponential', #EMA
'Weighted', #WMA
'Double Exponential', #DEMA
'Triple Exponential', #TEMA
'Triangular', #TRIMA
'Kaufman Adaptive', #KAMA
'MESA Adaptive', #MAMA
'Triple Exponential (T3)', #T3
],
],
[ 'InSlowPeriod', 'Slow MA Period Window (2 - 100000)', PDL::long, 26],
# this will show up in a combo list
[ 'InSlowMAType', 'Slow Moving Average Type', 'ARRAY',
[
'Simple', #SMA
'Exponential', #EMA
'Weighted', #WMA
'Double Exponential', #DEMA
'Triple Exponential', #TEMA
'Triangular', #TRIMA
'Kaufman Adaptive', #KAMA
'MESA Adaptive', #MAMA
'Triple Exponential (T3)', #T3
],
],
[ 'InSignalPeriod', 'Signal Line Smoothing (1 - 100000)', PDL::long, 9],
# this will show up in a combo list
[ 'InSignalMAType', 'Signal Moving Average Type', 'ARRAY',
[
'Simple', #SMA
'Exponential', #EMA
'Weighted', #WMA
'Double Exponential', #DEMA
'Triple Exponential', #TEMA
'Triangular', #TRIMA
'Kaufman Adaptive', #KAMA
'MESA Adaptive', #MAMA
'Triple Exponential (T3)', #T3
],
],
],
code => sub {
my ($obj, $inpdl, @args) = @_;
$log->debug("Executing ta_macdext with parameters ", dumper(\@args));
my $fast = $args[0];
my $slow = $args[2];
my $signal = $args[4];
my ($omacd, $omacdsig, $omacdhist) = PDL::ta_macdext($inpdl, @args);
return [
["MACDEXT($fast/$slow/$signal)", $omacd, undef, "macdext_$fast\_$slow\_$signal"],
["MACDEXT Signal($fast/$slow/$signal)", $omacdsig, undef, "macdextsig_$fast\_$slow\_$signal"],
["MACDEXT Histogram($fast/$slow/$signal)", $omacdhist, { with => 'impulses' }, "macdexthist_$fast\_$slow\_$signal"],
];
},
gnuplot => \&_plot_gnuplot_additional,
highcharts => \&_plot_highcharts_additional,
},
macdfix => {
name => 'MACD Fixed to 12/26',
params => [
# key, pretty name, type, default value
[ 'InSignalPeriod', 'Signal Line Smoothing (1 - 100000)', PDL::long, 9],
],
code => sub {
my ($obj, $inpdl, @args) = @_;
$log->debug("Executing ta_macdfix with parameters ", dumper(\@args));
my $signal = $args[0];
my ($omacd, $omacdsig, $omacdhist) = PDL::ta_macdfix($inpdl, @args);
return [
["MACD(12/26/$signal)", $omacd, undef, "macd_12_26_$signal"],
["MACD Signal(12/26/$signal)", $omacdsig, undef, "macdsig_12_26_$signal"],
["MACD Histogram(12/26/$signal)", $omacdhist, { with => 'impulses' }, "macdhist_12_26_$signal"],
];
},
gnuplot => \&_plot_gnuplot_additional,
highcharts => \&_plot_highcharts_additional,
},
mfi => {
name => 'Money Flow Index (MFI)',
params => [
# key, pretty name, type, default value
[ 'InTimePeriod', 'Period Window(2 - 100000)', PDL::long, 14],
],
input => [qw/high low close volume/],
code => sub {
my ($obj, $high, $low, $close, $volume, @args) = @_;
$log->debug("Executing ta_mfi with parameters ", dumper(\@args));
my $period = $args[0];
my $outpdl = PDL::ta_mfi($high, $low, $close, $volume, @args);
return [
["MFI($period)", $outpdl, undef, "mfi_$period"],
];
},
gnuplot => \&_plot_gnuplot_additional,
highcharts => \&_plot_highcharts_additional,
},
minus_di => {
name => 'Minus Directional Indicator (-DI)',
params => [
# key, pretty name, type, default value
[ 'InTimePeriod', 'Period Window(1 - 100000)', PDL::long, 14],
],
input => [qw/high low close/],
code => sub {
my ($obj, $high, $low, $close, @args) = @_;
$log->debug("Executing ta_minus_di with parameters ", dumper(\@args));
my $period = $args[0];
my $outpdl = PDL::ta_minus_di($high, $low, $close, @args);
return [
["-DI($period)", $outpdl, undef, "minusdi_$period"],
];
},
gnuplot => \&_plot_gnuplot_additional,
highcharts => \&_plot_highcharts_additional,
},
minus_dm => {
name => 'Minus Directional Movement (-DM)',
params => [
# key, pretty name, type, default value
[ 'InTimePeriod', 'Period Window(1 - 100000)', PDL::long, 14],
],
input => [qw/high low/],
code => sub {
my ($obj, $high, $low, @args) = @_;
$log->debug("Executing ta_minus_dm with parameters ", dumper(\@args));
my $period = $args[0];
my $outpdl = PDL::ta_minus_dm($high, $low, @args);
return [
["-DM($period)", $outpdl, undef, "minusdm_$period"],
];
},
( run in 0.341 second using v1.01-cache-2.11-cpan-71847e10f99 )