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

Re: runtime error divide by 0



PureBytes Links

Trading Reference Links

Best Regards
Jerry
----- Original Message -----
From: <Snosnosnow@xxxxxxx>
To: <omega-list@xxxxxxxxxx>
Sent: Tuesday, June 24, 2003 9:48 PM
Subject: runtime error divide by 0


>   I am using TS2k as the platform.
>
>   When I use a standard cci on the tick ( price goes + and - )
>   it works fine.
>
>   When I use the jurik ccx it will give me a runtime error. Attempted
>   to divide by zero.... . I noticed that the function has jrc.ccx.2k =
> iff
>   (md > .00001, diff / MD, 0 ) which is the suggested code.
>
> I have tried .00000000001 and 1.  Both still give me errors on the tick.
>
> Function is below.
>
>   The ccx is faster than a cci smoothed with the jma.
>
>   Can you suggest how to recode this so I do not get the runtime error.
>
> Please email me direct and the group, I am on the digest.
>
>   Thanks
>   Sno
>
> {
> ============================================================
>
> Function:  JRC.CCX
>
> Purpose:   similar to classic CCI except that the input series
>            is first smoothed by JMA
>
> Note:      Input parameter LENGTH should be greater than 8.0
>
> Note:      Lookback will be 3 TIMES the size of LENGTH
>
> Author:    © 1999 Jurik Research ; www.jurikres.com
> ============================================================
> }
>
> inputs : length(numericsimple);
> vars : diff(0), available.bars(0), MD(0), k(0),
maxDepth(ceiling(3*length));
>
> diff = JRC.JMA.2k( H+L+C, 4, 0 ) - JRC.JMA.2k( H+L+C, length, 0 ) ;
> available.bars = iff( currentbar < maxDepth, currentbar, maxDepth ) ;
>
> MD = 0 ;
> for k = 0 to available.bars-1 begin
>     MD = MD + absvalue ( diff[k] ) ;
>     end ;
>
> MD = MD * 0.015 / available.bars ;
> JRC.CCX.2k = iff ( MD > 0.0000000001, diff / MD, 0 ) ;
>

Attachment:
JRC.CCX.ELA

Attachment: Description: "Description: Binary data"