PureBytes Links
Trading Reference Links
|
Ross,
The denominator does not need to be zero to get a divide by zero (overflow)
error. If the denominator is extremely small while simultaneously the
numerator is extremely large, the ratio will create an overflow error.
If you do not expect the denominator to be extremely small, then break out
the numerator and denominator into separate variables, say NUM and DEN.
Then use the following...
result = iff ( absvalue(DEN) > 0.00001, NUM/DEN,
whatever_you_want_as_error_default ) ;
Regards,
Mark Jurik
-----Original Message-----
From: Ross Clark [SMTP:rclark@xxxxxxxxxxxxxxx]
Sent: Thursday, November 12, 1998 12:34 PM
To: Omega list
Subject: True Strength Indicator
I'm having problems with a divide by zero calculation my formula for the
True Strength Indicator as attempted from articles I've seen in TASC.
Even when I use the conplete denominator as part of the If statement it
still comes up with divide by 0 problems.
This code works about 80% of the time.
Does anyone have a working version of this indicator?
{True Strength Indicator}
input: length1(34), length2(8),length3(5);
If(absvalue(c-c[1])<>0) then begin;
Plot1(100*(xaverage(xaverage(c-c[1],length1),length2)/(xaverage(xaverage
(absvalue(c-c[1]),length1),length2))),"Plot1");
Plot2(xaverage(100*(xaverage(xaverage(c-c[1],length1),length2)/(xaverage
(xaverage(absvalue(c-c[1]),length1),length2))),length3),"Plot2");
Plot3((0),"Plot3");
end;
|