Math::Business::ParabolicSAR - Technical Analysis: Stop and Reversal


NAME

Math::Business::ParabolicSAR - Technical Analysis: Stop and Reversal (aka SAR)


SYNOPSIS

  use Math::Business::ParabolicSAR;
  my $sar = new Math::Business::ParabolicSAR;
     $sar->set_alpha(0.02, 0.2);
  # alternatively/equivilently
  my $sar = new Math::Business::ParabolicSAR(0.02, 0.2);
  # or to just get the recommended model ... (0.02, 0.2)
  my $sar = Math::Business::ParabolicSAR->recommended;
  my @data_points = (
      ["35.0300", "35.1300", "34.3600", "34.3900"],
      ["34.6400", "35.0000", "34.2100", "34.7400"],
      ["34.6900", "35.1400", "34.3800", "34.7900"],
      ["35.2900", "35.7900", "35.0800", "35.5200"],
      ["35.9000", "36.0600", "35.7500", "36.0600"],
      ["36.1300", "36.7200", "36.0500", "36.5800"],
      ["36.4100", "36.6400", "36.2600", "36.6100"],
      ["36.3500", "36.5500", "35.9400", "35.9700"],
  );
  # choose one:
  $sar->insert( @data_points );
  $sar->insert( $_ ) for @data_points;
  my $sar = $sar->query;
  print "SAR: $sar\n";
  # Briefly, the SAR is below the price data when you're meant to
  # be holding stocks (long) and above it when you're meant to be
  # on margin (short).
  print "The SAR is long  today.\n" if $sar->long;
  print "The SAR is short today.\n" if $sar->short;


RESEARCHER

The Parabolic Stop and Reversal was designed by J. Welles Wilder Jr circa 1978.

The SAR is meant to be used to "stop loss" on a position. It assumes you always have a position in the market (long if you're holding stocks and short when you're on margin). When the SAR crosses the price data, it signals a sell (when you're long) or a buy (when you're short).

Wilder himself felt the SAR was particularly vulnerable to "whipsaws" and recommended only using the SAR when the ADX is above 30 -- that is, when there is a strong trend going.


THANKS

Gustav <gustavf@gmail.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.

I normally hang out on #perl on freenode, so you can try to get immediate gratification there if you like. irc://irc.freenode.net/perl

There is also a mailing list with very light traffic that you might want to join: http://groups.google.com/group/stockmonkey/.


COPYRIGHT

Copyright (c) 2008 Paul Miller -- LGPL [Software::License::LGPL_2_1]

    perl -MSoftware::License::LGPL_2_1 \
         -e '$l = Software::License::LGPL_2_1->new({
             holder=>"Paul Miller"});
             print $l->fulltext' | less


SEE ALSO

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

http://en.wikipedia.org/wiki/Parabolic_SAR

The Encyclopedia of Technical Market Indicators - Page 495