To connect NinjaTrader to Interactive Brokers (IBKR), log in to Trader Workstation (TWS), turn on Enable ActiveX and Socket Clients in its API settings, then add an Interactive Brokers connection in NinjaTrader that uses the same socket port (7496 for live, 7497 for paper). Live and simulation trading need NinjaTrader's Multi-Broker add-on. IB Gateway is not supported, so TWS must stay running while NinjaTrader is connected.
Here is the process in five steps:
- Install NinjaTrader Desktop 8.0.28.0 or later and turn on Multi-Provider mode under Tools > Settings > General.
- Install the TWS version listed in NinjaTrader's Interactive Brokers connection guide, using the download link on that page.
- In TWS, open File > Global Configuration > API > Settings, enable ActiveX and Socket Clients, and untick Read-Only API if you will place orders.
- In NinjaTrader, open Connections > Configure, add Interactive Brokers, enter your IB username and password, and set Port TWS to the same number as TWS.
- Connect from the Connections menu and check for the green light next to the connection.
What You Need Before Connecting Interactive Brokers to NinjaTrader
Before diving into trading, make sure you've got everything in place for a stable, low-latency connection. Here's a rundown of the software, accounts, and configurations you'll need to get started.

Set your IB platform to use U.S. formats before you connect it to NinjaTrader, whether NinjaTrader runs on your own PC or on a NinjaTrader VPS. This setup ensures smooth integration between Interactive Brokers (IB) and NinjaTrader, with accurate data handling and full compatibility.
Required Software and Accounts
- NinjaTrader Desktop 8.0.28.0 or later (the latest 8.1 release is recommended)
- Live trading requires Multi-Broker Add-on - How to subscribe to Multi-Broker Add-on
- On NinjaTrader 8.1.1.0 or newer you must have Multi-provider enabled using these steps.
- A valid account at Interactive Brokers
- Logon credentials provided by Interactive Brokers (username / password)
-
The IB Trader’s Workstation (TWS) version listed in NinjaTrader’s connection guide, installed from the download link on that page. TWS downloaded straight from IBKR may update itself to a version NinjaTrader does not support.
- Note: No other versions of TWS are supported with NinjaTrader Desktop. IB Gateway is not supported for connections with NinjaTrader Desktop.
Pro Tip: Use a dedicated Windows server like QuantVPS for uninterrupted, low-latency trading.
This setup ensures smooth integration for automated trading and precise execution.
Initial Setup Instructions for Connecting with IB Trader’s Workstation (TWS)
- Start Interactive Brokers TWS and enter your IB username and password to login to TWS
-
As per the image below, select the menu "File > Global Configuration…" Note: For Classic TWS view select the menu “Edit > Global Configuration…”
- From the Trade Workstation Configuration window, select “API > Settings”
-
As per the image below, enable the following options:
* Enable ActiveX and Socket Clients
* Download open orders on connection
* Include FX positions when sending portfolio
* Send status updates...
* Send Forex market data in compatibility mode in integer units Set the Socket Port to 7496 if it shows another value (7497 if you log in to a paper account). Note: Uncheck Read-Only API if you plan on placing live trades from NinjaTrader; otherwise you will only be able to view market data and account information - Press OK and continue reading the “Connection Configuration Instructions” further down on this page
- Warning: Trader Workstation and NinjaTrader must have matching time zone settings to properly time stamp executions, orders and historical data. By default these will be your local PC time and no change is needed.
Order flow
Built for scalpers. Heatmaps on dedicated resources.
Order-flow heatmaps and DOM ladders run on dedicated CPU, memory and NVMe, so your charts keep responding during volatility.
See the dedicated hardwareFrom $29.99/mo · Windows or Linux
Connection Configuration Instructions
- NinjaTrader must be installed
- Start NinjaTrader
- From the Control Center window, select the menu Connections > configure
-
Select Interactive Brokers from the list of Available connections and then press the add text from the Configured section below:
- The Connection Properties section will be made available on the right side
-
Enter your Interactive Brokers credentials as per the image below:
Connection name: Create a name to identify your connection
Connect on start up: Enable if you want NinjaTrader to automatically establish a connection on start up
User name (optional): Enter your Interactive Brokers account user name (leave blank if you wish to manually enter your user name each time TWS is started)
Password (optional): Enter your Interactive Brokers account password (leave blank if you wish to manually enter your password each time TWS is started)
Ask password on connect: Enable to require manually entering the password when connecting (Password field above will be disabled)
Connect using: TWS
Auto logon: Check this option in order for NinjaTrader to automatically start and enter your credentials to log into your account. Selecting this check box will enable the “Auto logon path” property which is used to tell NinjaTrader where your TWS is located. Leave unchecked if you wish to manually start and login to TWS before using your connection
Important: Auto logon only works with the TWS version NinjaTrader lists in its guide, and the user name and password must be filled in above
Auto logon path: Only used if “Auto logon” is enabled. Not compatible with paper accounts. Choose the file location of your TWS installation (your installation may vary depending on your setup)
TWS: C:\Jts\985\tws.exe, etc.
Client ID: Leave this set to a value of zero "0" unless otherwise instructed by a technical support representative
Host (optional): Leave this as “127.0.0.1” (localhost) unless you want to connect NinjaTrader to TWS running on another PC within your local area network. If connecting over a network enter the computer name or IP address.
Local OCO simulation: Enables NinjaTrader to handle OCO (one cancels other order handling) on your local PC. DO NOT enable this unless otherwise instructed by a technical support representative
Log level: Leave default unless otherwise instructed by a technical support representative
Port TWS: Ensure that this value is set to the same value in the TWS API Settings. The default values are below:
TWS: production / live account 7496, paper account 7497
To avoid changing ports on the NinjaTrader side, you could setup 2 account connections, one for your production / live login, and one for your paper login
Run-time pop up handling: Enables NinjaTrader to suppress TWS pop up windows
SSL: Enable secure socket layer
Trigger after hours: Enable this if you want stop orders to trigger outside of standard trading hours. This will only work if you also have "Allow order to be activated, triggered, or filled outside of regular trading hours" enabled in TWS (Configure > Order > Order Presets > Timing menu) - Press OK
To connect to your account, go to the NinjaTrader Control Center window, select the Connections menu and then select the connection name you created above.
Once connected, you will see your connection highlighted in the connections menu per provider. There is also an aggregated connection status in the bottom left hand corner of the Control Center. If the connection fails before the trading platform can connect, inspect Windows network logs for evidence of the underlying network problem.
Please note: The forex positions reported in NinjaTrader are based on the positions reported in TWS FX Trader and the FX Portfolio section of the TWS Account window. This is NOT the cash value reported in the Market Value section of the TWS Account window.
Fixing Common Errors when Connecting to Your Interactive Brokers Account
If you encounter issues while connecting NinjaTrader to Interactive Brokers, here are some common errors and their fixes. Always check the Control Center Log tab to see if there are any connection error messages.
I try to connect but nothing happens
This is usually because TWS is not configured correctly. Please review the Initial Setup Instructions for Connecting with IB API settings in the guide above.
I see an error message "Target machine actively refused…"
- Ensure you have configured the TWS API Settings to "Enable ActiveX and Socket Clients" per the "Initial Setup Instructions" section for the TWS version you are using
- If you have another 3rd party application connected to TWS, ensure that it is not using a Client ID value of zero. Try shutting down this application and then connecting NinjaTrader to TWS.
I see an error message “Unable to auto start IB…”
This is because you have enabled the “Auto logon” feature, but NinjaTrader was unable to find the recommended version
- Try starting TWS manually and logging in before attempting the connection from NinjaTrader.
- Ensure the “Auto logon path” points to your local tws.exe, as set in the Connection Configuration Instructions above.
- Ensure you have installed the recommend API configuration per the “Requirements” section of this guide.
I see an error message “Unable to connect to IB TWS instance…”
This is usually because TWS is not running, or the “Socket Port” configured in the NinjaTrader Configuration settings do not match the Socket Port configured in the TWS API Settings. While the port number used is optional, they must be the same between both software configurations in order to connect
Orders don't reach a live account: make sure Read-Only API is unchecked in the TWS API settings. With it ticked, NinjaTrader can show data but can't place trades.
If problems persist, check the Log tab in NinjaTrader’s Control Center for detailed error messages. These logs can provide valuable clues to help resolve the issue. Additionally, ensure that both NinjaTrader and TWS are set to the same time zone to avoid discrepancies in data timestamps.
Best Environment Setup
A dedicated Windows Server is the best way to avoid connectivity problems. Relying on a home internet connection or personal computer comes with risks - power outages, crashes, or even automatic updates could interrupt your trading and lead to costly mistakes.
As for hardware, memory requirements depend on your trading style. A setup with 8GB of RAM is fine for basic strategies and a few charts. However, if you're running multiple strategies, complex indicators, or analyzing large historical data sets, go for 16GB or 32GB of RAM to keep your system running smoothly, even during high-volume trading periods.
Once your setup is ready, you can move on to configuring Interactive Brokers for use with NinjaTrader.
NinjaTrader and TWS on the same machine
NinjaTrader reaches IBKR through TWS, so both programs must be running and logged in, and IBKR's daily restart will drop the link if it falls inside your session. Set the restart time in TWS outside your trading hours. A QuantVPS server for IBKR can run TWS and NinjaTrader side by side in Chicago.
Uptime
99.999% uptime. Built for 24/7 trading reliability.
Your VPS runs in Tier IV datacenters with redundant power and network, monitored 24/7 on site.
See the uptime SLAFrom $29.99/mo · Windows or Linux
Pre-Trading Checklist
Before diving into trading, take a moment to run through this checklist to ensure everything is set up correctly for smooth integration between NinjaTrader and Interactive Brokers (IB).
- Confirm both platforms are running: Make sure Trader Workstation (TWS) and NinjaTrader are open. Check NinjaTrader's connection status - it should display a green "Connected" indicator. If not, restart both platforms.
- Double-check API settings in IB: Ensure "Enable ActiveX and Socket Clients" is turned on, and confirm that trusted IP addresses are properly configured.
- Test market data: Open an ES chart in NinjaTrader and verify that real-time price updates are appearing as expected.
- Place a test order: Use a paper trading account to confirm that order routing is functioning properly.
Regular Maintenance Tips
Keep both platforms running efficiently and securely by following these maintenance practices:
- Update regularly: Schedule notifications for updates and apply them during non-trading hours to avoid interruptions.
- Monitor system performance: Keep an eye on CPU and memory usage to prevent lags during trading. If needed, use the automatic off-site backups on every VPS plan to quickly restore your trading environment.
- Secure your credentials: Use strong passwords and enable two-factor authentication on your IB account to safeguard against unauthorized access.
- Back up your data: Save NinjaTrader workspaces, strategies, and custom indicators at least once a month to avoid losing important customizations.
- Log out properly: Always log out of both platforms when you're done trading to enhance security.
U.S. Format Settings for Traders
Using the right settings is key for accurate data display and analysis:
- Time zone alignment: Set your PC and platform time zones to match - most U.S. traders use Eastern Time. This ensures consistent timestamps for trades. As NinjaTrader Support explains:
"Trader Workstation and NinjaTrader must have matching time zone settings to properly time stamp executions, orders and historical data. By default these will be your local PC time and no change is needed."
- Display settings: Use U.S. formats for dates (MM/DD/YYYY), currency (e.g., $25,000.00 with commas and dollar signs), and imperial units. Keep in mind that NinjaTrader only shows the total USD cash position and doesn’t break down foreign exchange positions by currency.
- Price precision: Set price formatting based on the asset you're trading. For example, stocks typically use two decimal places (e.g., $125.50), while futures like ES follow specific increments, such as 0.25 points.
Conclusion
Linking NinjaTrader with Interactive Brokers enhances your trading setup, providing a solid foundation for effective and reliable performance. By following the steps outlined earlier, you can establish a connection that supports your trading strategies with confidence.
Key takeaways include the importance of preparation: ensuring accurate installation, configuring API settings properly, and conducting thorough connection tests. These steps minimize the risk of costly errors. Additionally, keeping both platforms synchronized - especially in terms of time zones and data formatting - ensures accurate and efficient order execution.
A stable network is equally critical. This kind of reliability is crucial for maintaining trade execution.
Finally, adopting consistent practices - such as staying on top of updates, monitoring system performance, and maintaining security - will keep your NinjaTrader and Interactive Brokers connection running smoothly over the long term. With a well-tuned system and efficient processes in place, you're ready to focus on trading without worrying about technical hiccups.
FAQs
Can I use IB Gateway instead of Trader Workstation to connect NinjaTrader with Interactive Brokers?
No. NinjaTrader Desktop connects to Interactive Brokers only through Trader Workstation (TWS), and its connection guide states that IB Gateway is not compatible. Install the TWS version NinjaTrader lists in that guide and keep it logged in while NinjaTrader is connected.
IB Gateway is a lighter IBKR program that suits custom API bots written in Python or other languages, but NinjaTrader can't use it.
What should I do if I encounter connection issues between NinjaTrader and Interactive Brokers?
If you're struggling to connect NinjaTrader with Interactive Brokers, the first step is to confirm that your internet connection is stable and unrestricted. Sometimes, firewalls or antivirus programs can block communication, so check if they're interfering. Also, ensure the API client is properly configured and shows a connected status.
Take a look at the NinjaTrader Control Center Log for any error messages. These can provide clues, such as incorrect settings or network-related issues. Restarting your router and adding NinjaTrader to your firewall's exceptions list can often solve the problem. If the issue continues, verify that your account credentials and API permissions are set up correctly.
Why should I use a dedicated Windows server like QuantVPS for trading with NinjaTrader and Interactive Brokers?
A dedicated Windows server gives NinjaTrader and TWS the lowest latency route to the broker and stable uptime, so both programs stay connected while you are away from your own computer. These servers sit in data centers close to major exchanges and broker servers, and they keep running through home power cuts, crashes and Windows updates.
On top of that, dedicated servers provide a stable and dependable environment with excellent uptime. This minimizes the chances of disconnections or technical hiccups during trading sessions, helping you maintain smooth operations and avoid unnecessary interruptions in your trading workflow.









