SI
SI
discoversearch

We've detected that you're using an ad content blocking browser plug-in or feature. Ads provide a critical source of revenue to the continued operation of Silicon Investor.  We ask that you disable ad blocking while on Silicon Investor in the best interests of our community.  If you are not using an ad blocker but are still receiving this message, make sure your browser's tracking protection is set to the 'standard' level.
Strategies & Market Trends : TA-Quotes Plus -- Ignore unavailable to you. Want to Upgrade?


To: gonzongo who wrote (4978)6/28/1998 7:40:00 PM
From: Roy Yorgensen  Read Replies (1) | Respond to of 11149
 
gonzongo, Re: Division by zero

In one of you posts (#4978) you had the following line:

prtosales:=close(-374)/((qtrrev(-6)*4/1000)/(sharesout+.00001)+.000001)

I assume (I know that's bad) you included the +.000001s in the divisor to eliminate the dreaded Div by zero error.

This seems to be a valid solution, but when used to compare (as a %) the volume of one day to another, I get a VERY large number when the volume was zero. (see example below)

I did find that including an extra conditional statement seemed to solve the problem, altough it can eliminate some possible hits on certain scans.

Integer I;
For i = -2 to -32 step -1
Do
If
Close(i)>1 and
Close(i)100000
Then
If
Vol(i-1)>0 // Eliminate the zero problem before it is used as a divisor
Then
If
vol(i)/Vol(i-1)>30
Then
PrintLn Symbol:-9,date(i):-12;
EndIf;
EndIf;
EndIf;
Next i;

Just a thought
Roy