You must allow connections from other programs (such as the trading algorithm on S#). To do this, open the settings menu "File -> Global configuration...". Select "Configuration -> API -> Settings" in the new window:
Turn on "Enable ActiveX and Socket Clients" mode.
Also it is recommended to add the address of the computer that will run the algorithm (the local address - 127.0.0.1). It allows not confirming the terminal connection permission each time you start the algorithm.