----- Original Message -----
Sent: Sunday, May 21, 2006 1:24 PM
Subject: Re: [amibroker] COM/OLE
question
You must not call AA.Optimize while you are in optimize
mode. You are creating indirect loop that way:
you press "Optimize" button -> AmiBroker calls
optimization then your formula calls optimization
and again optimization and again and again and
again.....infinite nesting.
BTW: it is not necessary to use jscript anymore as AFL has
full OLE support.
Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message -----
Sent: Sunday, May 21, 2006 6:33
PM
Subject: [amibroker] COM/OLE
question
Hi All - I wonder if someone who is good with
COM/OLE interface could take a look at the small code below and see if there
is anything wrong? I am trying to call the individual optimizer via COM/OLE,
and I am getting the Amibroker error message "Can not create that many
optimization variables", but I am only using one optimization variable.
Can anyone see some problem with the code that is causing this? Thanks
very much!
Steve
// enable an AFL scripting host
EnableScript
( "jscript" );
// AFL code
pds =
Optimize(
"Periods",
6, 3, 9, 3 );
Buy = Cover =
Cross( Close, MA( Close, pds ) );
Sell = Short =
Cross( MA( Close, pds ), Close
);
// begin script
<%
// create AmiBroker object
AB = new ActiveXObject(
"Broker.Application" );
// retrieve
analysis
object
AA = AB.Analysis;
// set which tickers to run on
AA.ApplyTo =
1;
// 1=current ticker
// set range
AA.RangeN =
15;
// last 15 quotes
// set range
type
AA.RangeMode =
1;
// 1=n last quotes
// select which module to run
AA.Optimize(
1 );
// 1=individual
// report results
AA.Report(
"" );
// display report if "path/filename"
is empty string
// end script
%>