[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

division by zero error



PureBytes Links

Trading Reference Links

Hello Omega List,

I'm trying to write a version of McClellan Oscillator that uses the
ratio of Up Volume to Down Volume instead of the difference.  This
code keeps giving a division by zero error--but I can't see it.
Suggestions?   thanks.

{---------------------------}
{ bars above 0 are plotted green and below 0 are plotted red.}

Inputs: UpVol(close of data2), DnVol(close of data3), FstLen(19),
SlwLen(39);

Vars: McOsc(0);


McOsc = IFF(DnVol <> 0, XAverage(UpVol / DnVol, FstLen) -
XAverage(UpVol / DnIss, SlwLen), 0);


If McOsc >= McOsc[1] then
Plot1(McOsc,"McOsc");

If McOsc < McOsc[1] then        
Plot2(McOsc, "McOsc.");

Plot3(0, "ZLine");

{-----------------------------}


-- 
Best regards,
 Jim Johnson                         mailto:jejohn@xxxxxxxxxxx