NAME
Math::Business::RSI - Technical Analysis: Relative Strength Index
SYNOPSIS
use Math::Business::RSI;
my $rsi = new Math::Business::RSI;
$rsi->set_days(14);
# alternatively/equivilently
my $rsi = new Math::Business::RSI(14);
# or to just get the recommended model ... (14)
my $rsi = Math::Business::RSI->recommended;
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:
$rsi->insert( @closing_values );
$rsi->insert( $_ ) for @closing_values;
if( defined(my $q = $rsi->query) ) {
print "RSI: $q.\n";
} else {
print "RSI: n/a.\n";
}
# you may use this to kick start
$rsi->start_with( $U, $D, $cy );
# you may fetch those values with these
my $U = $rsi->query_EMA_U;
my $D = $rsi->query_EMA_D;
my $cy = $rsi->query_cy; # (close yesterday)
RESEARCHER
The RSI was designed by J. Welles Wilder Jr in 1978.
According to Wilder, a security is "overbought" it the RSI reaches an upper bound of 0.70 and is "oversold" when it moves below 0.30. Some sources also use thresholds of 80 and 20.
NOTE: The result returned by this RSI module is a probability ranging from 0 to 1. Most sources seem to show the RSI as a number ranging from 0 to 100. If you wish to have this effect Simply multiply the numbers by 100 to get this result.
my $rsi = 100 * $rsi->query;
Thanks
Todd Litteken PhD <cl@xganon.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
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)