At the end of the Charts page of the Backtest Report there are three frequency distribution charts, one each for Profit, MAE, and MFE. While the AFL and HTML for the other built-in chart and tables is included in the AmiBroker/Formulas/Report Charts directory, the code for these three charts is not.
I would like to create some very similar charts of my own, although the 3D effects are not necessary for my implementation (nice touch though, @Tomasz!) I know that I can use the Low-Level Graphics functions (Gfx*) to draw all the chart elements myself, but before I go down that road I am wondering if there are existing examples that do something similar.
I've recently done this for myself. How I did it was (using MFE as an example):
Collect MFE: Using the CBT iterate through trades and store the MFE results into a matrix and assign it to a static variable,
Bin the results: Create a new report chart that gets the MFE static variable and run it through a binning algorithm storing the frequency results into a matrix (hint: use two matricies or 1 matrix with two rows, 1 with the frequency, the other with the bin edges),
Plot your data: Using low level graphics functions iterate through the frequencies (y values) and bin edges (x values).
The binning algorithm was a bit of a pain and I ended up using Sturge's Rule to get a bin count. It seems to work ok however you could also just specify a bin width yourself.
Regarding point 2 above, I actually created a function external to the report chart however this involves more passing around of static variables.
Thanks @rb250660. My steps are nearly identical to yours, except I started with Step 3 because that's the part I was least familiar with. And for Step 2 I will probably start by taking a shortcut and use predefined bins.