BAT script not firing with 'Execute and Wait'. What am I not doing?

I am trying to launch a .BAT file as below...

This .BAT file launches 2 python scripts which take order parameters from a CSV file (created by Amibroker). Each of the python scripts creates a log file if not already there and then writes exceptions to the log

If I click the .BAT file manually, I do get the order and the stop loss placed on the exchange and the logs are created, but if I run them from Amibroker batch using Execute and wait, ...

then the Amibroker Batch says completed, but there is no log file and there are no orders placed at the exchange.

What am I doing, or not doing, that is resulting in this? Thanks

Andy

Solved (or at least found a workaround.
I just pasted this as .afl and put it into an .apx project (for current symbol and 1 recent bar,.... I learned that the hard way)

ShellExecute("PowerShell.exe","py stopLossPlacer.py","C:\\Program Files\\AmiBroker\\........\\Python\\",1);
ShellExecute("PowerShell.exe","py NewOrder.py","C:\\Program Files\\AmiBroker\\..........\\Python\\",1);

then

@SpandexMan, as a simple alternative, in your DOS batch file (.bat) you could have added a statement to change the current directory to the one where the python scripts are located. E.g.:

CD "C:\Program Files\Amibroker\YourScriptsParentFolder\Python"
start python stoplossPlacer.py  
start python newOrder.py 
3 Likes

Ah, of course!! Yes, thanks Beppe!

1 Like

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