Backtest Commentary

From a Back Test AFL formula, is it possible to conditionally write commentary to the Interpretation window or the Analysis Info window when back testing?

Actually, I never used it, but from this recent post, I will say it is not the way to go.

In general, if you want to see a more detailed log of what is actually done by AmiBroker in the backtest you can enable the "Detailed log" in the "Report" tab from the "Backtester Settings" dialogue (the one that is displayed clicking this icon:

immagine

Moreover, if you need to log your own commentary I suggest you to use the _TRACEF() function, logging to an external debug viewer:

https://www.amibroker.com/guide/afl/_tracef.html

By the way the original link in that page to the Sysinternals DebugView.exe is no longer valid. You can find and download that free utility program from here:

For smaller tasks it is enough to use the internal log:
https://www.amibroker.com/guide/w_log.html

Finally, in general, when using the log, keep in mind that, when AmiBroker executes his code in multiple threads, the log lines will not be in the expected order...

If we want strictly sequential execution, then we must limit ourselves to just running in single-thread. A single-thread execution in New Analysis window can be achieved by placing the following pragma call at the top of the formula.

#pragma maxthreads 1

#pragma maxthreads limits the number of parallel threads used by New Analysis window. This command is available in AmiBroker version 6 or higher

Obviously, this slows down things and therefore should be used mainly for debugging purposes and then removed in production.

1 Like

An alternative to DebugView is this other freeware app:
DebugView++
(download links at the bottom of the page)

@beppe thank you. I use both _Trace and the debug to debug formulas.

Perhaps someone can suggest an alternative way to write information from the back test analysis to the interpretation window.

Interpretation window is for CHART interpretation. It is connected with currently selected CHART pane. So no, what you have imagined is not what this window is designed to do.

If you need “backtest commentary” - open the file: fopen(), write to it: fputs() and close it: fclose(). Then you can view your commentary using any text viewer (even Notepad)

@Tomasz Thank you.

With the file I/O tools you mentioned, I can write commentary to a ticker.txt (e.g. IBM.txt) file. To access this file, I will add another custom metric column (Comments URL) to my back test results. This new column will contain the @link file///… that points to the text file! A simple “Alt mouse double left click” will open the text file.

Again, thank you for your help!

2 Likes