NAGAYASU Yukinobu > Math-Business-Stochastic-0.03 > Math::Business::Stochastic

Download:
Math-Business-Stochastic-0.03.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.03   Source  

NAME ^

Math::Business::Stochastic - Perl extension for calculate stochastic oscillator

SYNOPSIS ^

  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] );

SEE ALSO ^

perl(1), Math::Business::MACD(3).

THANKS ^

Jettero Heller <jettero@cpan.org>

COPYRIGHT AND LICENSE ^

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.

syntax highlighting: