Store individual backtest results to a global matrix

After I invoke the backtest engine to run a whole set of individual reports (see diagram), I would like to have a way to store the results of each line of p&l statistics to a global matrix so I can use these results later on (in a subsequent step) to calculate the mean of sample means (average number of the lines), standard deviation, standard error of the sample means etc., for the whole set of results. Is this possible? Thanks.

I realize I can do a portfolio run, but the portfolio engine uses different algorithms for treating the individual stocks, thus, I cannot get the 2 runs to balance (this topic was discussed before in the forum). This is why I am inquiring about doing it this way. If someone can show a way to run a portfolio backtest that matches the individual runs, that could be a solution.


You can export result list to file (either manually via File - Export HTML/CSV or via Batch) and then you may read file via AFL.

An example showing how to populate matrix from file is part of AmiBroker KB:

Other than that you might alternatively use CBT... storing stats:

stats = bo.GetPerformanceStats( 0 );
// value1 = stats.GetValue(...)
// etc.