Change Active Ticker from AFL in Amibroker

#1
Hi,

I have an AFL script that iterates through scrips in a watchlist and does charting and buy/sell calls.

When processing each symbol, i make a call setForeign(symbol). This changes the price arrays, but the barcount is the same for all the symbols (I know there is different amount of history for each scrip in the DB). This barcount changes when I click on the symbol in the watchlist (ie., change the active ticker). Eg., in the interpretation window, i printf the barcount. when an actively traded scrip is clicked, it shows a high num and when I click on a rarely traded scrip, it shows a low num for BarCount.

Though this is there, ALL the scrips are processed in every iteration. But, since the Barcount is not changed by setForeign, it is causing wrong computation.

Can you tell me how to change the active symbol from within AFL?. (For eg., once I change the active symbol, the chart window's title should change to the new symbol's name. setForeign does not do it.)

I read the following code in some forum, but it is not working:
AB = CreateObject("Broker.Application");
Ab.ActiveDocument.Name = "Ticker";

Thanks in advance,
Vijay
 

Similar threads

Intraday Higher Leverage

Save up to 90% in brokerage and get higher leverage for intraday trades.

Name:Phone:
Email:City:
State:
Are you a day trader?