Free to Use Download Now

FREE TO USE DOWNLOAD NOW

NinjaTrader Connection Guide for Interactive Brokers

Requirements

  • Interactive Brokers valid account
  • Account user name and password
  • You must have standalone Traders Workstation (TWS) version 944.3 (browser version is not supported) installed - Download
  • Latest Java version – Download

Connection Configuration Instructions

Play Video

  1. NinjaTrader must be installed
  2. Start Interactive Brokers TWS
  3. As per the image below, select the menu "Edit > Global Configuration…"
  4. Interactive Brokers Configure
  5. 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…
    • Set the "Socket port" value to 7496
  6. Start NinjaTrader
  7. From the Control Center window, select the menu "Tools > Account Connections…"
  8. In the Account Connection Set Up window, press the "Add…" button
  9. The Connection Wizard will appear. Press the "Next >" button.
  10. As per the image below
    • Connection name: Create a name to identify your connection
    • Provider: Select "Interactive Brokers" from the list
    • Backup data feed connection: Select your backup data feed or leave as "<None>"
    • Connect on startup: Enable if you want NinjaTrader to automatically establish a connection on startup
    • Select "Use Interactive Brokers servers" for historical data or disabled if you will be using a different connection for historical data
  11. InteractiveBrokers Connection Options
  12. Press the "Next>" button
  13. As per the image below enter your Interactive Brokers account logon credentials:
    • User name: Your Interactive Brokers account user name
    • Password: Your Interactive Brokers account password
    • Host: Leave this as "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.
    • Port: Ensure that this value is set to the same value in TWS (step 4 above)
    • Client ID: Leave this set to a value of zero "0" unless otherwise instructed by a technical support representative
    • 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)
    • Auto logon: Enables NinjaTrader to automatically start and log on to TWS
    • Run-time pop up handling: Enables NinjaTrader to suppress TWS pop up windows
    • SSL: Enable secure socket layer
    • 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
    • Use user settings: Enables NinjaTrader to use TWS user settings when automatically started
    • Trade Currencies (FX): Enable this if you trade currencies (forex) through your Interactive Brokers account
  14. Interactive Brokers Additional Instructions
  15. Press the "Next >" button followed by the "Finish" button to complete configuring your Interactive Brokers account.
  16. If you will be trading currencies (forex):
    • You must set the correct setting for the "Quote currencies (FX) in:" property accessible from within the NinjaTrader Control Center window menu "Tools > Options > Data".
    • Set the value to HalfPip
    • Critical: 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.
  17. To connect to your account, go to the NinjaTrader Control Center window, select the menu "File > Connect" and select your account.
  18. If you run into any problems connecting to your account, please review the common problems and resolutions below

Common Problems Connecting to your Interactive Brokers Account

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 step 3 above.

I see an error message "Target machine actively refused…"
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.