Saving key performance metrics during optimisation

I'm doing an exhaustive optimisation that will go through hundreds of thousands of systems. For future analysis reasons, I need to save key variables associated with each combination (eg PNL, DD, PF etc). This will be analysed outside of AB later.

I believe I can save each performance report in full (Is it possible to save equity curves during Optimization?), but that this will be quite slow. I really only need a few (~10) numbers. What would be the best way to do this, noting that I'll likely run the optimisation multithreaded on a single symbol (ie Individual Optimise).

10 vs all numbers does not make a difference when it comes to report generation. AmiBroker calculations are fast. It does not matter if it calculates 10 or 100 numbers.

I think I’ve asked my question poorly. I’m trying to find the right way to save a) performance metrics and b) trades list for each optimisation cycle in an exhaustive search. I need to save them externally to a file - but I don’t need the entire perf report with graphs etc.

Is it just a matter of manually writing to file? How do I access these values?

Regarding performance variables, look into the high-level CBT. You can output any values you want to the backtest report. The output for an optimization contains a one-line summary of each backtest, including any custom metrics you generate.

@kidgloves81, adding to @mradtke answer, I suggest in particular to look at the Stats object returned by the GetPerformanceStats() function as documented in the Porfolio Backtester Interface Reference Guide.

1 Like

Note, that using CBT is likely to cost more performance-wise than generation of built-in report. As to how to get the numbers - reports are HTML (text) files, so you can easily read them anywhere. The structure of the file is very basic - simple HTML table with all stats.

1 Like

Yes, I should have clarified: you only need the CBT if you are generating custom metrics that you need to output for each backtest. If you're only interested in standard metrics already generated by AmiBroker, then a CBT probably isn't necessary for the scenario you've described.