I then use this module to open the file and grab the closing price for
the past 28 days and then send that array to rsi-insert.
My question is this. Has anyone else noticed that closing_values
array must have 28 values, anything less will return null value for
$q.
Also, I seem to be getting different values for 14 day RSI. It is not
matching with stockcharts.com or finance.google.com or
finance.yahoo.com
package rsi;
use strict;
use warnings;
use Math::Business::RSI;
sub conrsi {
my $nofile = shift;
my $file = shift;
chomp $file;
my $rsi = new Math::Business::RSI;
$rsi->set_days(14);
open(F, '<', "/tmp/stockdata/$file") || die "Couldn't open the current
file: $file $!";
my @CSV = <F>;
close (F);
my $lines;
my $TOTAL;
my @cvl;
my $q;
my @closing_values;
my $i;
for $i (1 .. 28) {
$lines = $CSV[$i];
@cvl = split(/,/, $lines);
$TOTAL = $cvl[4];
push(@closing_values, $TOTAL);
# print "<br>value $i $TOTAL";
$i++;
}
#@closing_values = reverse(@closing_values);
$rsi->insert( @closing_values );
$q = $rsi->query;
return ($q, $file);
}
1;