PureBytes Links
Trading Reference Links
|
Peter writes:
> 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;
>
The spike is actually less than it would otherwise be. The value of the
denominator was 0 and I caused it to be .001. Thus, I cause an infinite
value of DMIPlus/DMIMinus to be brought down to something not infinite.
The problem with your code, above, is that you allow DMIMin to be 0. You
just don't call the plot function when it is 0. But, remember, the plot is
not of DMIPlus/DMIMinus. The plot is of XAverage(DMIPlus/DMIMinus). Thus,
you need to ensure that not only is DMIMinus non-zero on the current bar,
but also that it does not have zeros in its history.
|