I have set up a batch (using the Amibroker batch function) to clear out an old watch list, load a project, run a scan, then save those to the watch list.
It saves fine within amibroker, but does not save to the underlying file unless I close Amibroker.
So at the end of my batch I load a project which basically...
ShellExecute("amibrokerkill.bat" ,"","" ,0 );
Amibrokerkill.BAT is simply
taskkill /im Broker.exe
That sucessfully terminates Amibroker. So, each day according to my criteria, a new watchlist is automaticaly set up ready for intraday trading.
The issue I see, is that if I have several instances of amibroker running, they are all terminated. So if I am running another process (e.g running a scheduled exploration), that could get killed.
When you create AB instance by object, the Application object has object.visible property that you can set to true.
AB will show the program window. If you want to close that instance, just click exit from within.
If you want to kill specific instance, you can kill by PID but how do you know which instance is which PID? unless you start tracking PIDs as instance is created.
Terminating a program like that may also have other ill effects.