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

[amibroker] Puzzled about ParamOptimize()



PureBytes Links

Trading Reference Links

I'm using the ParamOptimize function in the following form:

function popt( Titlename, default, minv, maxv, step )
{
return Optimize( Titlename, 
Param( Titlename, default, minv, maxv, step ),
minv, maxv, step );
}

I included it, e.g., in the T3 formula:

#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") ); 

... and it plots perfectly okay.

However, if I include it in the Hull MA formula like this:
#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;

... and I try to plot this indicator I get the following error:

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


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


------------------------ Yahoo! Groups Sponsor --------------------~--> 
Check out the new improvements in Yahoo! Groups email.
http://us.click.yahoo.com/4It09A/fOaOAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html
 
Yahoo! Groups - Join or create groups, clubs, forums &amp; communities. Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups - Join or create groups, clubs, forums &amp; communities. is subject to:
    http://docs.yahoo.com/info/terms/