Can we pass a parameter to CustomBackTest procedure?

Hello Amibroker team,

I would like to use a customBacktest procedure saved in external .afl file, however I need to pass into that external file some global variables from called main strategy file. Is it possible?

I tried to create a global variables, however they are not "visible" in backtest file.
I tried to create also an external file with global settings, include this file in backtesting file, but this also not work.

Can you please suggest any workaround?

A reason to do this, that I am using almost the same backtest formula in multiple strategies. This solution will allow me to change code on 1 place only in case of change need.
As my customBacktest also exports equity into .csv I need to have an ability to pass there a strategy name as an parameter (plus some others too)

Many thanks,
Tomas

Thanks,
Tomas

Just save the values as static variables in your Phase 1 code, and then retrieve them in the CBT.

1 Like

You don't need to pass anything.

variable = 1; // when variable is set / defined in global level it is visible

If you use separate file, you can always #include files with variables from any other formula:

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.