Are we allowed to loop OLE objects within AFL? Amibroker seems to go crazy when I try to do so.
I can easily automate optimizations individually by specifying individual dates, and then applying the indicator. But when I try to loop through a series of dates, it's as if Amibroker tries to run all the optimizations at once. The AA window opens and closes in rapid succession, and never completes a single optimization.
If we can't put the actual objects inside a loop, how else can we batch-run a group of sequential optimizations? I know I can dump a range of dates to a log file. But to read those dates back, and run the optimizations, still requires looping, so I don't know what else to try.
I've tested everything else in my code, and it works fine - the dates increment correctly, the loop starts and stops when I want, etc. So then I pasted in the actual AA objects, but it does not work, as described above.
For the sake of simplicity, I have stripped out most of the code that calculates the dates and what not, and am just pasting the essence of the loop here.
What is the correct general approach in order to make this
Walk-Forward Opt-Opt code work? Any input much appreciated:
// AFL Code setting up necessary vars, objects and functions goes here
// More code here ensures the following loop only initiated upon user input
// by manually changing a parameter in parameter window:
for ( U = BegISDate; U <= EndISdate; U = U + StepIS )
{
// AFL code for properly calculating from and to dates goes here
AA.LoadFormula( Formula1 ); // load formula from external file
AA.ApplyTo = 1; // use current symbol
AA.RangeMode = 3; // use 'From' and 'To' dates
AA.RangeFromDate = ISfromDateStr;
AA.RangeToDate = IStoDateStr;
AA.Optimize( 0 );
// AFL code for properly calculating from and to dates goes here
AA.LoadFormula( Formula2 ); // load formula from external file
AA.ApplyTo = 1; // use current symbol
AA.RangeMode = 3; // use 'From' and 'To' dates
AA.RangeFromDate = OOSfromDateStr;
AA.RangeToDate = OOStoDateStr;
AA.Optimize( 0 ); // run Optimize for the portfolio
}
> My research methods tend to be convoluted, just like my thought processes. But basically, I am optimizing on OOS data, to simply look for clues and inspiration to reverse engineer a better method of choosing OOS parameters for a specific trading system. The thought being that if one never re-optimizes on the OOS data, and studies the results, how would you ever know that your system truly chose the "best" values, during the IS step, for the OOS data?
>
> The danger of course is one of curve fitting, and engineering the trading system based on this "glimpse into the future". But my approach is general enough that this should not happen.
>
> It is simply a method to gain clues on how well the system is choosing parameters, as opposed to relying solely on the equity curve, and associated reports. I am still in the middle of this experiment, and have yet to come to any solid conclusions. It merely looks promising at this juncture for one of my unorthodox systems, yet failed to yield anything fruitful for my other, more normal, systems.
>
>
> --- In
amibroker@xxxxxxxxxxxxxxx, Howard B howardbandy@ wrote:
> >
> > Greetings Ozzy, and all --
> >
> > Optimization on the out-of-sample data? Tell us more.
> >
> > Thanks,
> > Howard
> >
>