Microsoft Visual C++ Runtime Library Error with Matlab

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

Direct link to this answer

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.

This website uses cookies to improve your user experience, personalize content and ads, and analyze website traffic. By continuing to use this website, you consent to our use of cookies. Please see our Privacy Policy to learn more about cookies and how to change your settings.