PureBytes Links
Trading Reference Links
|
Sno:
You have solved your own problem, although it may not be obvious
to you. :-)
My guess is Jurik's advice
>iff
> (md > .00001, diff / MD, 0 ) which is the suggested code.
is (part of) the correct solution.
It is not the complete solution however.
Why?
TS2K is believed to support about 8 significant places of
precision. That would make the smallest recognizable value to be
0.000,000,1.
However, note that Jurik chose 0.000,01 which is 2 orders of
magnitude LARGER.
Why?
His function must use exponential smoothing internally or some
other calculation involving a square root thereby loosing some
precision. Thus, the conservative value that he suggests.
What to do???
If you are trading currencies, and set your display value to
1/10,000 then this could be quite an annoyance.
(1) Multiply your value by display value than divide out the
display value afterwards.
(2) Multiply by 10,000 then after the compare multiply by 0.0001
(3) Multiply by Big Point Value then divide by Big Point Value
after the comparison.
You get the idea...
It would be a smart game plan to first
(a) getSymbolName
(b) display value
and shift the decimal place only for relevant markets.
You do not want to multiply by 10,000 if you trade the DJ
contract!
Enjoy,
Leslie
Snosnosnow@xxxxxxx wrote:
>
> 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 ) ;
--
Regards,
Leslie Walko
610-688-2442
--
"Life is a tragedy for those who feel, a comedy for those who
think"
Horace Walpole, 4th earl of Orford, in a letter dated about 1770
|