Microsoft Visual C++ Runtime Library Error with Matlab

11 views (last 30 days)
Hi everyone,
I am having issues with the "Microsoft Visual C++ Runtime Library" Error (see picture below), while executing Matlab in combination with the Interactive Brokers Trader Work Station.
A few remarks on how this error occurs:
  • I have a Matlab script that is constantly connected to the TWS API from Interactive Brokers, which does things like extract price data, request account details and opening trades.
  • For this purpose I installed the following program that I needed to get the connection between Matlab and Interactive Brokers working (I believe this might be relevant, because this is the only part that I can think of that might have messed with C++): https://www.interactivebrokers.com/en/index.php?f=5041
  • As you can see on the screenshot, this error occurs multiple times over the runtime (~ every 2 - 3 hours or so).
  • As long as I do not hit "okay", Matlab continues to execute the program just fine, however from monitoring my resources I can see that the errors take up a large portion of CPU processing capacity which slows down the execution eventually and causes errors
  • When I do hit "okay" while Matlab is running, it will cause Matlab to crash.
  • The Matlab-Interactive Brokers connection is based on ActiveX as far as I know
Any ideas how to solve this issue? Many thanks in advance!

Answers (1)

Yair Altman
Yair Altman on 23 Oct 2018
As you've noticed, using IB's COM/ActiveX API (which is used by the Trading Toolbox) has severe limitations. In addition to the 32-bit limitation, ActiveX also has the drawback of only working on Windows, and of being slower, less robust, and not as reliable as IB's other APIs ( according to IB themselves ).
If you need a Matlab-IB connector without these limitations, try the IB-Matlab toolbox: http://undocumentedmatlab.com/ib-matlab. IB-Matlab is based on IB's Java (not COM/ActiveX) API, which is super-fast, very stable, does not include memory errors, and does not crash Matlab. It runs well on all platforms that support Matlab: Windows (both 32 and 64 bits), Mac and Linux - including all releases of Matlab and TWS.

Community Treasure Hunt

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

Start Hunting!