SetCustomBacktestProc doesn't behave as indicated in AFL Function Reference

Hi Tomasz,

According to the online AFL Function Reference at https://www.amibroker.com/guide/afl/setcustombacktestproc.html

The SetCustomBacktestProc should work like this:
SetCustomBacktestProc( "Formulas\MyCustomBacktest.afl", True );

However, this causes two errors.

  1. You have to use double backslashes or you will get error 54.
  2. You have to include the entire file path, including the drive, or the backtester won't find the file.

image
image

The way to make it work with a filename is to include the entire filepath using double-backslashes:
SetCustomBacktestProc( "C:\Program Files\AmiBroker\Formulas\Backtests\CBT 20180912.afl", True );

This is how it works in my version of AB which is 6.30.

Is the Function Reference out of date? Or is this unexpected behavior of the function?

Thanks,
Peter Deal

@PeterD if you follow the link provided in the AFL Function Reference (that you have quoted above)

1

... you can answer these questions yourself:

2
https://www.amibroker.com/guide/a_custombacktest.html


BTW because you have not used code tags/code button, your double backshlashes turned into single backshlashes. This is another example showing, that using code tags/code button on the forum is mandatory:

Without code tags:

SetCustomBacktestProc( "C:\Program Files\AmiBroker\Formulas\Backtests\CBT 20180912.afl", True );

With code tags:

SetCustomBacktestProc( "C:\\Program Files\\AmiBroker\\Formulas\\Backtests\\CBT 20180912.afl", True );

3

2 Likes

Thanks, Milosz. I'm new to the forum so I appreciate your guidance on using the tags.

But here's the trouble with the Function Reference:
image

It seems to me that this example should be updated to use the double slashes.

“One who makes no mistakes makes nothing”

Giacomo Casanova :wink:


By the way, if someone was wondering how does forward slash and backslash look like, here it is :grin:

Slash

5 Likes

@Milosz , that forward/back "Slash" is pretty good! :sunglasses:

1 Like