Starting an Amibroker Batch File with Command Prompt, Python or Autoit

Just wanted to share, the basis for a lot of automation with Amibroker is to be able to start it and run a batch file. I figured out three different ways to do it:

From a command prompt, I was successful with this code (Substitute your own filenames.):

"C:\Program Files\AmiBroker\Broker.exe" /runbatch "C:\Users\elder\OneDrive\Trading\Amibroker\Batch Files\MR2 US.abb" /exit

Using Python (Note that I had to put two backslashes after the second C prompt to make it work. Substitute your own file names.):

import subprocess
import os
#http://www.learningaboutelectronics.com/Articles/How-to-launch-computer-programs-using-Python.php
#https://linuxhint.com/execute_shell_python_subprocess_run_method/
subprocess.run('C:\Program Files\AmiBroker\Broker.exe /runbatch "C:\\Users\elder\OneDrive\Amibroker\Batch Files\MR2 US.abb " /exit')

With a freeware program named Autoit (Substitute your own filenames.):

run('C:\Program Files\AmiBroker\Broker.exe /runbatch "C:\Users\elder\OneDrive\Trading\Amibroker\Batch Files\MR2 US.abb " /exit')
3 Likes

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.