Set Optimization target by AFL

Hi - I tend to use an optimization target of CAR by setting it in the Analysis > Walk forward tab drop down list ..... but I was wondering if this could be done via AFL instead?

Thanks

I believe it can not be set from AFL.

This can be done, but you need to make the change to the project file (.apx) file before opening it.

First save afl as a project file, then you can edit like this.

Sorry there is no code insert button, so I will copy as text here.

   statRank="CAR";
filedir = "O:\\Amibroker\\Formulas\\projects\\abc123.apx";
fh2= fopen(filedir,"r");
Line=0;
while(!feof(Fh2))
{
tag= fgets(Fh2);

if(StrFind(Tag,"<OptTarget>"))
{
tag= "<OptTarget>"+statRank+"</OptTarget>\n";
}
VarSetText("line"+(line++), tag);
}
fclose( fh2);

fh3 = fopen( FileDir, "w" );
for( i = 0; i < line; i++ )
{
fputs( VarGetText("line"+i ), fh3 );
}