If you are planning on having many custom backtest implementations, but few systems, then you can update System.afl to #include whichever custom backtest you want to test, then run the Ssytem.afl script. Any variables required by the custom backtester would be expected to be passed as procedure parameters.
System.afl
#include <CustomBacktest.afl>
Buy = DayOfWeek() == 1;
Sell = DayOfWeek() == 5;
MyBackTestVar = true;
SetCustomBacktestProc("");
if (Status("action") == actionPortfolio) {
RunCustomBackTest(MyBackTestVar);
}
Custom_Backtesting.afl
procedure RunCustomBackTest(Var) {
if (Var) {
_TRACE("Var was true.");
} else {
_TRACE("Var was false.");
}
bo = GetBacktesterObject();
bo.Backtest();
// Add custom metrics here...
}
Mike