[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GT] logarithmic values and scale.pm
subject: logarithmic values and scale.pm
gters
i've run into this error on a number of occasions:
% graphic -f=sys_2.gconf CLX >! graphs/CLX.png
Can't take log of -1.74815 at ../GT/Graphics/Scale.pm line 91.
from ../GT/Graphics/Scale.pm
89 sub convert_to_coordinate {
90 my ($self, $x, $y) = @_;
91 return ($self->{'x_log'} ? int($self->{'x_a'} * log($x -
$self->{'x_b'})) :
92 int($self->{'x_a'} * $x + $self->{'x_b'}),
93 $self->{'y_log'} ? int($self->{'y_a'} * log($y -
$self->{'y_b'})) :
94 int($self->{'y_a'} * $y + $self->{'y_b'}));
95 }
i'm thinking it is caused by either plotting RSI or SMA curves on a log price
plot.
credit w.j. o'neil for explaining why price plots should be logarithmic ...
without giving it much thought (non-sequitur since i am thinking about it)
a solution (practical) might be if the value is 0 or negative, make
it a very small number (how small is small enough) ... but, the solution
may be far afield from the error location. the solution is likely dependent
on how scale is actually doing its thing.
thanks for any help
aloha
ras