Unable to connect to Interactive Brokers after installed 2018a in new Laptop

5 views (last 30 days)
Jeff Koh
Jeff Koh on 11 Mar 2019
Commented: Annie Leonhart on 15 Jan 2020
Hi Sir/Mdm,
I just re-install TWS and Matlab in my new computer. And I discover that I was unable to connect the trading tool box to my interactive broker TWS.
I have ensure I follow the istruction to installed TWS trading software and the TWS API.
I have also ensure "Enable Active X and Socket Clients" is checked.
I still encountered this error:
>> ib = ibtws('',7496)
Error using actxserver (line 90)
Server creation failed. Invalid ProgID 'TWS.TwsCtrl.1'.
Attached is the setting for API in TWS
2019-03-11 23_31_52-Clipboard.jpg
Error in ibtws
  3 Comments
Image Analyst
Image Analyst on 1 Dec 2019
Patrick, if the solution is already in the MATLAB (and toolboxes) that you already paid for, then use them. I often recommend toolboxes (usually sold by the Mathworks, though occasionally by others such as Eigenvector University) that can do things more conveniently than if you had to write it from lower level MATLAB functions. Sure, I could write regionprops() and bwmorph() myself, but it will cost me more in time than to just buy it already written. If your solution is not in something you paid for, you can either pay for a toolbox, write it yourself, or hope that someone else will eventually see your post and write it for you and give it to you for free. Annie has apparently done the latter for you, but it's not always that a poster can expect a generous donor like Annie to come along with turnkey free code right when the code is urgently needed. She should post it as an official "Answer" rather than a comment so Jeff can "Accept" her answer if it solves the problem. This was her first post, so you lucked out, though it sounds like in the future she will continue to supply code and toolboxes to people for free.
Yair is one of the worlds top publishers and authors and contributor of free MATLAB code (if you've ever looked at his web site which has mountains of free code that you will find nowhere else). I know him personally. He is on the Mathworks Advisory board and often knows more about the code than the Mathworks staff. He spends more time on MATLAB than even the people who work at the Mathworks. No one is obligated to buy his books, toolboxes, courses, or consulting time but the community is fortunate to have someone like Yair who is usually the one people turn to for the toughest MATLAB problems.

Sign in to comment.

Answers (2)

Yair Altman
Yair Altman on 12 Mar 2019
Sometime in recent years, presumably around TWS API 9.70, IB changed their COM server's ProgID from 'TWS.TwsCtrl.1' to 'TWS.TwsCtrl'. This breaks the Trading Toolbox code, which still assumes a ProgId of 'TWS.TwsCtrl.1'. Since the Trading Toolbox's code is encrypted, you cannot modify its expected ProgId. The best you could do is to try to uninstall your IB API and install an old version (possibly with the assistance of IB). Note that this might break other things for you - the old IB API version might not be fully supported by IB today, but it's worth trying. And of course you could report this to MathWorks and hope that a fix or workaround will be provided in a future release.
As an alternative, you could try to use my IB-Matlab connector instead (http://undocumentedmatlab.com/IB-Matlab). IB-Matlab is based on IB's Java API (not COM), so it runs well on all platforms that support Matlab (Windows, Mac and Linux), and does not exhibit the problems that are common with the COM-based interface, such as the one that you encountered. It is by far the highest-rated product on IB's Marketplace.

Alessio Cianini
Alessio Cianini on 14 Jan 2020
enable DDE clients..that's all
  1 Comment
Annie Leonhart
Annie Leonhart on 15 Jan 2020
Incorrect.
Server creation failed. Invalid ProgID 'TWS.TwsCtrl.1'. means he has a non-updated trading toolbox, or doesn't have the latest IB API.
DDE is excel...

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by