Watchlist creation from external program

Hi,

My watchlist will be created after 5min of market starts from external source/program, how can I transfer to AmiBroker which is running.

I tried to copy file to watchlist folder from the external program but AmiBroker overwrites the watchlist. Any solution please ....

Thanks
Rathish

AmiBroker only reads watch list files (from Watchlist subfolder) when it opens the database. So you should first copy the watch list, then open the database (you can do this via OLE). Alternatively you can read externally written file from AFL (fopen/fread/fclose) and add symbols to watchlist from AFL using CategoryAddSymbol()

Actually you can tell AmiBroker to reload externally changed .TLS files:

// JScript code
AB = new ActiveXObject("Broker.Application");
AB.LoadWatchlists(); // reloads watch lists from DB

Keep in mind that doing so reloads contents from the disk, so any changes that you did from UI in current session will be overwritten.

1 Like

Thanks Tomasz,

I need to update watchlist only once in the beginning, but in AFL every time it will keep scanning.

You can try and implement the following to execute that part of the code only once:
http://www.amibroker.com/kb/2015/10/06/how-to-run-certain-piece-of-code-only-once/