Don't know if there is an easier way. But, you could always just use
the Com/JScript support to access the AmiBroker OLE object and query
its properties as follows.
Mike
EnableScript("jscript");
<%
function getAAWatchList() {
var ab = new ActiveXObject("Broker.Application");
var aa = ab.Analysis;
return aa.Filter(0, "watchlist");
}
%>
Fast = MA(Close, 5);
Slow = MA(Close, 25);
PositionSize = -10;
Buy = Cross(Fast, Slow);
Sell = Cross(Slow, Fast);
SetBacktestMode(backtestRegular);
SetCustomBacktestProc("");
if (Status("action") == actionPortfolio) {
script = GetScriptObject();
bo = GetBacktesterObject();
bo.Backtest();
bo.AddCustomMetric("Watchlist", script.getAAWatchList());
}
Documentation for JScript support:
http://www.amibroker.com/guide/a_aflcom.html
Documentation for OLE model:
http://www.amibroker.com/guide/objects.html
--- In
amibroker@xxxxxxxxxxxxxxx, "Ara Kaloustian" <ara1@xxx> wrote:
>
> Is there an AFL function to read the name of the current watchlist
(or market etc) that the AA is currently set on?
>
> I want to add the name of the watchlist as a custom metric with
CBI, but have not found how to locate what watchlist AA is set on.
>
> tx
>
> Ara
>