I had actually asked this question a couple of weeiks ago but hadn't got an
answer. Maybe this time someone has an idea - TJ???
I'm using the ParamOptimize function in the following form:
[quote]
function popt( Titlename, default, minv, maxv, step )
{
return Optimize( Titlename,
Param( Titlename, default, minv, maxv, step ),
minv, maxv, step );
}
[/quote]
I included it, e.g., in the T3 formula:
[quote]
#include <Paramoptimize.afl>
function T3(price,periods)
{
s = popt("s",0.8,0.2,2,0.1);
e1=EMA(price,periods);
e2=EMA(e1,Periods);
e3=EMA(e2,Periods);
e4=EMA(e3,Periods);
e5=EMA(e4,Periods);
e6=EMA(e5,Periods);
c1=-s*s*s;
c2=3*s*s+3*s*s*s;
c3=-6*s*s-3*s-3*s*s*s;
c4=1+3*s+s*s*s+3*s*s;
Ti3=c1*e6+c2*e5+c3*e4+c4*e3;
return ti3;
}
P = ParamField("Price field",-1);
Periods = popt("Periods", 15, 2, 200, 1 );
Plot(t3(p,periods),_DEFAULT_NAME(), ParamColor( "Color", colorCycle ),
ParamStyle("Style") );
[/quote]
... and it plots perfectly okay.
However, if I include it in the Hull MA formula like this:
[quote]
#include <ParamOptimize.afl>
P = ParamField("Price field",-1);
HullMA = HullMaFunction( P, Periods, Delay );
Periods = popt("Periods", 15, 2, 200, 1 );
Delay = popt("Delay", 0, 0, 10, 1 );
X = 2 * WMA(P,round(Periods/2)) - WMA(P,Periods);
HullMA = WMA(X,round(sqrt(Periods)));
HullMA = Ref(HullMA,-Delay);Plot( HullMA, _DEFAULT_NAME(),
ParamColor( "Color", colorCycle ),ParamStyle("Style") );
space = Param("Graph Space", 10, 0, 25, 1);
GraphXSpace = space;
[/quote]
... and I try to plot this indicator I get the following error:
[quote]
Price:
return Optimize(Titlename,
Param(Titlename, default, minv, maxv, step),
minv, maxv, step);
}
^
Error 32.
Syntax error, probably missing semicolon at the end of the previous line
[/quote]
I'm probably blind but I'm not able to see why the same function works in one
formula but doesn't work in the other. By the way: If I click the "Verify
syntax" button in the editor for the Hull MA fomula I don't get any error
message.
Any idea what's going on here?
Regards,
Thomas