ConnectToIBTWSOnLocalMachineExample not working
1 view (last 30 days)
Show older comments
I have read some comments about problems like this and I still don't know what to do.
My Activex Socket Clients are enabled. My Socket port is 7496. I can access with IBMatlab.
I am running with Windows 10 64bit.
I have the latest version of TWS.
I get the error using the test program "ConnectToIBTWSOnLocalMachineExample"
Error using actxserver (line 93)
Server creation failed. Invalid ProgID 'TWS.TwsCtrl.1'.
Error in ibtws (line 37)
x.Handle = actxserver('TWS.TwsCtrl.1');
Error in ConnectToIBTWSOnLocalMachineExample (line 7)
ib = ibtws('',7496)
My ver
MATLAB Version: 9.7.0.1190202 (R2019b)
MATLAB License Number: 40386371
Operating System: Microsoft Windows 10 Pro Version 10.0 (Build 18985)
Java Version: Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
-----------------------------------------------------------------------------------------------------
MATLAB Version 9.7 (R2019b)
Curve Fitting Toolbox Version 3.5.10 (R2019b)
Financial Toolbox Version 5.14 (R2019b)
IB-Matlab - Matlab connector to InteractiveBrokers Version 2.05 Expires: 1-Oct-2019
Optimization Toolbox Version 8.4 (R2019b)
Parallel Computing Toolbox Version 7.1 (R2019b)
Statistics and Machine Learning Toolbox Version 11.6 (R2019b)
Trading Toolbox Version 3.6 (R2019b)
Answers (2)
Annie Leonhart
on 1 Dec 2019
You're running the latest version of Matlab which corrected this issue. I assume you are not running the latest API from TWS. It doesn't matter if you have the latest TWS platform, you need the latest API which is 9.76
0 Comments
Kajal Bansala
on 10 Mar 2021
Hello,
This error indicates that the Trading Toolbox in MATLAB cannot establish a connection to the IB Trader Workstation ActiveX-based API. Please refer to the following MATLAB Answers post for some initial troubleshooting steps that may help resolve the error experienced:
If after following the above post, you are unable to get "success" message from Excel VBA and hence getting connection error in MATLAB, there is something broken with the IB Trader API installation. It would be best to contact the IB support since the VB script is checking connection outside of MATLAB and the resulting error is not caused due to MATLAB.
Additionally, I would suggest to first (before reaching out to IB) try the suggestions as per the following MATLAB Answers post linked below as other users came across the same issue and have received next steps from IB:
The BaT file provided by IB helps establish connection with Excel using DDE connection and not ActiveX API connection which is used by MATLAB.
In order to instantiate the connection between IB and MATLAB, the system needs to recognize the ActiveX API program ID TWS.TwsCtrl.
The VB script won't run because it can't find the Trader Workstation program ID. And since the VB Script is not running, this indicates that there is something going wrong with the IB installation files. I would recommend contacting the IB Support for help troubleshooting the IB installation files.
As a possible workaround to connect IB with MATLAB, you could use the IB MATLAB product by Yair Altman.
Please find the below link for more details about IB MATLAB:
0 Comments
See Also
Categories
Find more on Transaction Cost Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!