If you can't connect to Interactive Brokers TWS check the PORT number

Apparently Interactive Brokers recently changed the default API port number in newest versions of TWS (from 7496 to 7497 in recent versions). This has caused problems for new users.

If you are having problems connecting to TWS from AmiBroker, you need to make sure that port number is IDENTICAL in TWS settings (in TWS Edit->Global Configuration->API)


and in AmiBroker's File->Database Settings->Configure dialog, as shown below:


Socket port numbers in both places MUST BE THE SAME.