PureBytes Links
Trading Reference Links
|
I have incorporated the latest corrections which
Clyde Lee has made to the EL version of the Ploynomial
Fitting Function into the code for my DLL of this
function.
You will see differences in the results of the DLL versus
the ELA code as you choose higher order polynomials
(i.e.: larger degree), It would appear that these differences
are due to the difference in precision used in the calculations.
The DLL uses double precision whereas EL uses only
32bit precision.
Below is the EL code for an Indicator which makes use
of a call to a Wrapper Function which provides the
proper interface to the DLL.
You can bypass the wrapper function altogether and
insert the code from the function directly into your own
systems or indicators if you choose to save on overhead.
However, if you do so then you probably should perform
an initialization similar to that which was programmed
by Clyde in the wrapper function.
This is one of two messages on this matter. One is
for TS4 (16 bit) version and the other is for TS2000
(32 bit) version. Please DO NOT MIX UP ! ! ! !
DLL is Attached.
{----------------------------------------------------------------}
{================================================================
Indicator: PlyFit32_DLL_Ind
Date: 9 November 1999
================================================================}
Inputs: Price(Close),
NDegree(3),
NPoints(25),
NProjct(1);
Vars: PolyFit(0);
PolyFit = PlyFit32_DLL_Func(Price, NDegree, NPoints, NProjct);
Plot1[-Nprojct] (PolyFit, "PF_Proj");
{----------------------------------------------------------------}
{----------------------------------------------------------------}
{================================================================
Function: PolyFit_ProjDLL
Date: 9 November 1999
Purpose: A 'wrapper' for DLL call to make it simple for users.
Notes: Users should be directed to save 'PlyFit32.DLL' at:
'C:\Program Files\Omega Research\program\PlyFit32.DLL'
which is what is referenced here.
================================================================}
Inputs: Price(NumericSeries),
NDegree(Numeric),
NPoints(Numeric),
NProjct(Numeric);
VARS: PolyFit (0); { OUTPUT FROM the DLL function. }
DefineDLLFunc: "C:\Program Files\Omega Research\program\PlyFit32.DLL",
INT, "PolyNomialFit",
FLOAT, {Price}
FLOAT, {Degree of Polynomial to Fit -- Max Value = 7}
FLOAT, {Number of DATA points TO use IN fit}
FLOAT, {Number of points forward TO predict price}
LPFLOAT; {Address}
{//////////////////////
This section of code is needed for proper initialization of the
DLL and will properly set your max bars back if you use auto
detect. If you use the function call directly in your signals
or indicators make sure you include this initialization routine.
\\\\\\\\\\\\\\\\\\\\\\}
IF ( BarNumber = 1 ) THEN
BEGIN
FOR Value2 = ( NPoints - 1 ) DownTO 0
BEGIN
Value1 =
PolyNomialFit(Price[Value2],NDegree,NPoints,NProjct,&PolyFit);
END;
END;
Value1 = PolyNomialFit(Price, NDegree, NPoints, NProjct, &PolyFit );
PlyFit32_DLL_Func = PolyFit;
{----------------------------------------------------------------}
Enjoy .....
Regards,
Andrew
Attachment Converted: "c:\eudora\attach\PlyFit32.DLL"
|