Ly,
You can get any of the included metrics after running a backtest. An
optimization is just a collection of backtests. So, your code will be
executed for each backtest in the optimization.
Copy the following script to a file (ending with .afl extension),
load it into the AA window, set to run against active symbol, select
any date range of 5 or more days, then click the Optimize button.
It will generate a file named "myfile.txt" in your Amibroker
directory. The file will contain a single line for each optimization
step. You'll need to rename or delete the file between optimizations,
else the next optimization will continue to get appended to whatever
is already in the file.
SetBacktestMode(backtestRegularRaw);
SetCustomBacktestProc("");
trigger = Optimize("Trigger", 1, 1, 4, 1);
if (Status("action") == actionPortfolio) {
bo = GetBacktesterObject();
bo.PreProcess();
for (bar = 0; bar < BarCount; bar++) {
bo.ProcessTradeSignals(bar);
}
bo.PostProcess();
stats = bo.getPerformanceStats(0);
carMDD = stats.getValue("CAR/MDD");
fh = fopen( "myfile.txt", "a");
if (fh) {
fputs("CAR/MDD: " + carMDD + "\n", fh);
fclose(fh);
}
}
Buy = DayOfWeek() == trigger;
Sell = DayOfWeek() == 5;
Refer to the links provided in my earlier response for more detail.
Mike
--- In [email protected], "loveyourenemynow"
<[EMAIL PROTECTED]> wrote:
>
> Hi Mike,
>
> Are you sure you can get optimization result from custum backtester
> interface? Can you make an example? As far as I know there is such a
> feature from the backtesting interface, but there may be from OLE,
and
> if you know it, please let me know.
>
> Thanks
>
> Ly
> --- In [email protected], "Mike" <sfclimbers@> wrote:
> >
> > Try looking in the user guide under advanced portfolio backtester
> > interface, to see how to get at the stats information.
> >
> > e.g.
> > http://www.amibroker.com/guide/a_custombacktest.html (bottom of
page)
> >
> > Then look at file operations fopen, fputs, fclose.
> >
> > e.g.
> > http://www.amibroker.com/guide/afl/afl_view.php?id=227
> >
> > Mike
> >
> > --- In [email protected], "lou" <loulh@> wrote:
> > >
> > > After running an optimization I want to get the value from one
of
> > the columns in the report and be able to put it into a file for
> > further reference. (For example, the first value in the RAR
column)
> > Is there a way to do this?
> > >
> > > lou
> > >
> >
>