Sorry, if my questions about that are ignorant, but after many hours of testing, I still don't understand the output.
My understanding is that the optimize function should generate multiple outputs similar to this code:
function run()
{
set(PARAMETERS|LOGFILE);
StartDate=20160106;
EndDate=20160107;
BarPeriod = 1440;
LookBack =0;
int Period;
int Periods[10] = { 10, 20, 50 };
int i;
while(asset(loop("EUR/USD" )))
for (i=0;i<3;i++)
{
Period = Periods[i]; //
print(TO_ANY,"Period: %d, ",Period) ;
}
}
When I press "Trade", the log file looks like that
[1: Thu 07.01.16 00:00] (1.07497)Period: 10, Period: 20, Period: 50,
however the following code :
function run()
{
set(PARAMETERS|LOGFILE);
StartDate=20160106;
EndDate=20160107;
BarPeriod = 1440;
LookBack = 0;
int Periods[10] = { 10, 20, 50 };
while(asset(loop("EUR/USD" )))
{
int Period = Periods[optimize(1,1,3,1)-1];
print(TO_ANY,"Period: %d, ",Period) ;
}
}
generates:
[1: Thu 07.01.16 00:00] (1.07497)Period: 10,
I wonder how the optimize function can be used to create multiple variations of the trends. Additionally I would like to know if the optimize function is comparable with the for loop.
Thanks for you patients, jcl :))