How To - Arrange custom metric columns in Backtest Trade Report

Custom Metrics for the Backtest report are terrific. I see that there SetOption(“ExtraColumnsLocation”, 1 ); to locate the custom metric columns but I was wondering about a few related matters:

  1. How do I return this setOption to its default value?
  2. Can I customize the custom metric column width?
  3. Can I specify left or right justification (e.g. trade.fullname) shows up right justified for me.
  4. I have seen a recent Discourse post that custom metrics cannot be displayed in color. It would be awesome if this feature could be considered for a future Amibroker release.

Addressing item 4 from previous post:
Apparently Not available for reasons discussed in How to change texts color in Backtest report?

It seems possible to use the strformat() to right justify or left justify custom metrics. This was briefly discussed in Formatting Custom Metrics?

Here is my sample code snippet and the result (Requires Amibroker 6.20 or later):

trade.AddCustomMetric( StrFormat("%-100s","Full Name"), StrFormat("%-100s",trade.FullName));

left-justify

For anyone interested, here is a whitepaper on the Secrets of printf. I cannot confirm that every argument will work in Amibroker.

For additional information see Strfromat().

Read more about various % format specifiers here.

With regards to whitepaper - it applies to “C” language. In AFL you can use all formatting sequences that work for floating point arguments (%f, %g, %e), strings (%s) and all escape sequences (\n, \r, \t, \\, %%).