To connect Overcharts to IB, please follow these steps carefully:
1. IB Account– If you do not already have an Interactive Brokers demo or real account, please create a new one from Interactive Brokers official website.
2. Download & Install the latest version of TWS platform or IB-Gateway application from the Interactive Brokers official website. IB-Gateway is lighter than TWS but initially we recommend using TWS which provides much more information and allows you to constantly monitor your orders status. Unfortunately IB APIs may have malfunctions which Overcharts cannot always work around. For this reason, if you are not very expert in this technology, the best thing to do is to have the TWS always open and intervene if necessary.
3. Launch TWS or IB-Gateway and log in with the IB account Username and Password. For IB Gateway in the API Type section select IB API only in the login window.
4. TWS / IB-Gateway Configuration
4.a If you are logged in from TWS open the File > Global Configuration window. Otherwise go to step 4.b
Select API > Settings and configure highlighted properties as in the image below:
If the property ‘Send instrument-specific attributes for dual-mode API client in‘ is present in TWS, set its value as ‘operator timezone‘ or ‘UTC format‘. ‘instrument timezone’ is NOT supported in Overcharts. So DO NOT select it. Take note of the property value, you will need to use it later to set up the IB connection on Overcharts.
Take note of the Socket Port. You will need to use it to setup the IB connection on Overcharts.
Select API > Precautions and configure properties as in the image below:
4.b If you are logged in from IB-Gateway open the Configure > Settings window.
5. Launch Overcharts and select the Interactive Brokers connection in the Connections tab. Access the connection configuration window by right clicking the mouse > Edit. If you already have an IB connection configured, please create a new one.
Set the following properties:
Client ID: Choose an ID to identify the connection. The ID must be unique within Overcharts (if multiple connections to IB are configured) and also among all 3rd-party applications connected to the same TWS or IB-Gateway.
By choosing ID equal to ZERO you will be able to view and modify all orders placed from Overcharts and from TWS / IB-Gateway.An ID other than ZERO allows you to view and modify ONLY orders placed using this connection.
Host: localhost (DO NOT change)
Port: Select port corresponding to the value you noted in step 4. If the port is not listed, select Custom and manually set the value of step 4 in Custom Port property.
Generate Ticks From: Specify whether to generate ticks from Quotes or Tick-By-Tick streaming. By choosing the Tick-By-Tick streaming you have greater data accuracy but IB by default allows you to subscribe to a maximum of 3 instruments. You can increase this limit by subscribing to Booster Packs with IB. For more information, refer to the official IB website or ask their assistance.
Instrument Attributes Time-Zone: The value of this property is FUNDAMENTAL for receiving historical data and order information. MUST match ‘Send instrument-specific attributes for dual-mode API client in‘ property value in TWS/IB-Gateway API settings.
6. Press OK to save the configuration.
7. Start connection from Overcharts by pressing the Connect button or by double-clicking on the connection. You are connected successfully if 3 green dots appear next to the connection. If there are red dots, hover over the “i” icon to view the error message.