Math::Business::Stochastic - Perl extension for calculate stochastic oscillator
use Math::Business::Stochastic; my $stoc = new Math::Business::Stochastic; my ($k, $d, $sd) = (5, 3, 3); set_days $stoc $k, $d, $sd; my @high_values = qw( 3 5 5 6 6 5 7 5 8 5 7 8 6 8 6 8 7 8 8 9 8 9 ); my @low_values = qw( 2 4 3 5 3 5 3 4 5 3 4 4 5 6 6 6 6 6 7 7 6 7 ); my @close_values = qw( 3 4 4 5 6 5 6 5 5 5 5 6 6 6 6 7 7 7 8 8 8 8 ); for(my $i=0 ; $i<int(@close_values) ; $i++) { $stoc->insert( $high_values[$i], $low_values[$i], $close_values[$i] ); if( defined $stoc->query_k ) { print "Stochastic k: ", $stoc->query_k, "\n"; } else { print "Stochastic k: n/a\n"; } if( defined $stoc->query_d ) { print "Stochastic d: ", $stoc->query_d, "\n"; } else { print "Stochastic d: n/a\n"; } if( defined $stoc->query_sd ) { print "Stochastic sd: ", $stoc->query_sd, "\n"; } else { print "Stochastic sd: n/a\n"; } } # you may use this to kick start $stoc->start_with( [@high_values], [@low_values], [@close_values] );
perl(1), Math::Business::MACD(3).
Jettero Heller <jettero@cpan.org>
Copyright (C) 2008 by NAGAYASU Yukinobu <nagayasu@yukinobu.jp>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.7 or, at your option, any later version of Perl 5 you may have available.
To install Math::Business::Stochastic, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Math::Business::Stochastic
CPAN shell
perl -MCPAN -e shell install Math::Business::Stochastic
For more information on module installation, please visit the detailed CPAN module installation guide.