Backtest Report XY Scatter Plots

I am trying to move all of my trade analysis from Excel to be 100% in AmiBroker and I’m almost there now thanks to the excellent help I’ve received on the forums here.

My next task is to produce some scatter plots in the Backtest Report window. I am not sure how to initialize this type of plot. Can it be done? I’ve made some histograms using the low level graphics method but I have no clue where to start with scatter plots. If I can figure out how to start a plot, I am reasonably comfortable with constricting the plot itself.

If it is possible, I plan to produce an MAE/MFE plot and Profit/Bars in trade plot. I am assuming I will need the CBT to collect the data and store it in static variables for the plot to read. Would this approach be sensible/correct?

It certainly is possible. For metrics that don't span the whole time series (eg ones that are trade based), your best bet is to create a matrix in the high-level CBT, then loop through the trades and store the metrics you need to the matrix. At the end of the CBT process, store the matrix in a static variable. Then in your report formula, recall the contents of the static variable and loop through the matrix values and plot them using low-level graphics.

You can come up with almost any combination you can think of:
image

image

3 Likes