The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Math::Business::LaguerreFilter - Technical Analysis: Laguerre Filter

SYNOPSIS

  use Math::Business::LaguerreFilter;

  my $avg = new Math::Business::LaguerreFilter;
     $avg->set_days(9);
     $avg->set_alpha(0.2); # same (roughly)

  my @closing_values = qw(
      3 4 4 5 6 5 6 5 5 5 5
      6 6 6 6 7 7 7 8 8 8 8
  );

  # choose one:
  $avg->insert( @closing_values );
  $avg->insert( $_ ) for @closing_values;

  if( defined(my $q = $avg->query) ) {
      print "value: $q.\n";

  } else {
      print "value: n/a.\n";
  }

For short, you can skip the set_alpha() by suppling the setting to new():

  my $avg = new Math::Business::LaguerreFilter(0.2); # same as set_alpha(0.2)

Ehlers actually uses the high and low price, rather than the closing price, in his book. The insert method takes either a closing price or the high and low price as a two-tuple.

    $avg->insert( $close );       # correct
    $avg->insert( [$high,$low] ); # also correct

RESEARCHER

John F. Ehlers talked about how to adapt Laguerre Polynomials to technical analysis in an engineering-oriented 2004 book titled Cybernetic Analysis for Stocks and Futures: Cutting-Edge DSP Technology to Improve Your Trading.

This technique appears in a chapter with the unlikely title Time Warp - Without Space Travel.

If you locate the chapter or the book, you should read it. It's written well and it's a unique way to look at moving averages in general (e.g. there are filter schematics of each equation).

THANKS

John Baker <johnb@listbrokers.com>

AUTHOR

Paul Miller <jettero@cpan.org>

I am using this software in my own projects... If you find bugs, please please please let me know. There is a mailing list with very light traffic that you might want to join: http://groups.google.com/group/stockmonkey/.

COPYRIGHT

Copyright © 2013 Paul Miller

LICENSE

This is released under the Artistic License. See perlartistic.

SEE ALSO

perl(1), Math::Business::StockMonkey, Math::Business::StockMonkey::FAQ, Math::Business::StockMonkey::CookBook