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

Re: dividing by zero



PureBytes Links

Trading Reference Links

In a message dated 99-07-17 20:16:21 EDT, editorial@xxxxxxxxxxxxx writes:

> Input: length(13),XAVlen(3);
>  
>  Var: DMIMin(1);
>  
>  
>  DMIMin = DMIMinus(Length);
>  If DMIMin = 0 then DMIMin = .001;
>  
>  Plot1(XAverage(DMIPlus(LENGTH)/DMIMin,XAVlen),"Plot1");
>  Plot2(0, "Zero");
>  
>  IF CheckAlert Then Begin
>      IF Plot1 Crosses Above Plot2 or Plot1 Crosses Below Plot2 Then Alert =
>  TRUE;
>  End;

While that will work, the very small value can cause a spike in the results.  
Why not do the standard, that Omega uses, and is used in a lot  of EL code

Input: length(13),XAVlen(3);

Var: DMIMin(1);


DMIMin = DMIMinus(Length);

If DMIMin > 0 then begin

Plot1(XAverage(DMIPlus(LENGTH)/DMIMin,XAVlen),"Plot1");
Plot2(0, "Zero");

IF CheckAlert Then Begin
    IF Plot1 Crosses Above Plot2 or Plot1 Crosses Below Plot2 Then Alert =
TRUE;
End;
End;