Interactive Brokers Broker Profile

From MultiCharts
Jump to: navigation, search
Click here to see Interactive Brokers Video Tutorial.

If you need data from Interactive Brokers data source, make sure you have Interactive Brokers data feed set up.

To connect MultiCharts to Interactive Brokers (IB), it is necessary to have IB software installed and launched on the computer. IB provides two applications that can be used for connection to MultiCharts:

  1. IB Trader Workstation.
  2. IB Gateway.
Note: the latest Java version is strongly recommended for IB software to work correctly.

Though there is choice between web-based (Online) and standalone version (Offline), standalone version is recommended for MultiCharts connection. To download Trader Workstation and Gateway, follow this link:

http://individuals.interactivebrokers.com/en/control/systemstandalone.php?os=win&ib_entity=llc

For FOREX trade size should be equal to the amount of units, not trade lots.

For Open Position Profit/Loss calculation modes see Unrealized Profit Calculation Mode.

Unrealized Profit/Loss for the account is calculated by Interactive Brokers and displayed in MultiCharts.

In order to include the "Unrealized P/L" value from TWS FX Portfolio - Virtual FX Position into "Open P\L" value of Order and Position Tracker Window -> Accounts tab it is essential to enable "include FX position when sending portfolio" selection in the TWS > Global Configuration > API > Settings.


Note: Interactive Brokers supports native and simulated One-Cancels-Others group (see Setting up Interactive Brokers Profile).

Native OCO-group is used when the broker’s plug-in supports OCO-groups. In this case all OCO orders are sent to the broker directly and unfilled OCO orders will be cancelled by the broker.

Simulated OCO-group means that all OCO orders are sent to the broker, price is monitored by MultiCharts and once one of the orders is filled, other orders from this OCO group are cancelled by MultiCharts. When one of the OCO orders is filled, MultiCharts sends a command to cancel the second OCO order to broker. Note that the second order may also be filled if price reaches its level before the cancellation is processed by the broker (see OCO-Orders Risk).

Note: There are certain limitations for IB Free Trial accounts from the broker end: Open PnL and account information might be incorrect, open positions might not be received after TWS re-connection.

Interactive Brokers Profile is already created when MultiCharts is installed. It is not necessary to reconfigure its settings if only one IB account is going to be used with no subaccounts, but it is Important to set up connection parameters in IB TWS.

Setting up Interactive Brokers Trader WorkStation

The following configuration is required to establish connection between MultiCharts platform and IB TWS:

  1. Click on Configure in main TWS window.
  2. Click on API section. Select Settings.
  3. Check Enable Active X and Socket Clients box.
  4. Uncheck Read-Only API box.
  5. Set the Port (Socket port) number to the same value both in IB TWS and IB Broker Profile in MultiCharts.
    Note: If more than one IB TWS will be used, then separate Broker Profile should be created per each additional IB TWS and set their Port numbers accordingly, but each IB Broker profile should have unique Port number, that corresponds to one IB TWS.
  6. Add 127.0.0.1 to Trusted IP Addresses or check the "Allow connections from localhost only" box (only if TWS is running on the same PC). If TWS is running on a remote PC - you should specify its IP address.

Setting up Interactive Brokers Gateway

The following configuration is required to establish connection between MultiCharts platform and IB Gateway:

  1. IB API option should be selected when logging into IB Gateway.
  2. Click on Configure in main Gateway window.
  3. Click on API section. Select Settings.
  4. Uncheck Read-Only API box.
  5. Set the Port (Socket port) number to the same value both in IB Gateway and IB Broker Profile in MultiCharts.
    Note: By default in IB Gateway Socket port number is 4001. In IB data source in QuoteManager default Port (Socket port) number is 7497.
  6. Add 127.0.0.1 to Trusted IP Addresses or check the "Allow connections from localhost only" box (only if Gateway is running on the same PC). If Gateway is running on a remote PC - you should specify its IP address.

Setting up Interactive Brokers Profile

In the Properties Interactive Brokers window (see Managing Broker Profiles) enter the information provided by Interactive Brokers.

In the pop-up window there are 2 tabs: Settings and Financial Advisor Settings.

On the Settings tab the following parameters are available:

General Settings section

IP address and Port number ClientID. “0” by default. If there is another trading platform running on your computer that is connected to IB TWS, it is recommended to change the corresponding value in that piece of software.

Starting from MultiCharts 11, IB TWS can be launched automatically by MultiCharts on attempt to connect IB broker profile. To enable this option check Launch Trader Workstation at start box.

Default Order Settings section

Time in Force:

  • DAY
Order is canceled if it is not executed by the close of the trading day. DAY is set as default; or:
  • GTC (Good-Till-Canceled)
Order remains active until it is cancelled.
  • IOC (Immediate-or-Cancel)
Any portion of an order that is not filled is to be canceled as soon as it becomes available in the market.

Settling Firm.

Clearing Account.

Default Account.

All or None Execution.

An order waits for a specified number of contracts at broker. Either all are filled or none of them.

  • Entry Orders; or:
  • Exit Orders.

Outside RTH tag

This tag is applicable for stocks on real trading accounts – when it’s enabled order can be placed and (orders can get executed outside regular trading hours) directly to the exchange outside of regular market hours. If it’s disabled, IB will return an error saying that it’s impossible to get to the exchange. It’s enabled by default in the broker profile for IB.

OCO Group section

Use Native OCO Group Turn on this function to use native OCO group realized by Interactive Brokers, otherwise, OCO group is emulated by MultiCharts.

Reduce Size OCO

When one order of the OCO group is partially filled, the size of other orders in this group is reduced proportionally.

Example: Three buy stop orders with the size of 2 are sent in OCO group. One of the orders is partially filled (1 contract). The size of the two other orders is reduced by 1.

Overfill Protection Turn on to send only one order of an OCO group to the exchange. Other orders of this OCO groups will be held and monitored in TWS. If this option is disabled all orders of the OCO group are sent to the exchange.

Unrealized Profit Calculation Mode

There are three modes for Open Position Profit/Loss calculation:

  • "By best bid & best ask" - calculated by MC, requires realtime data subscription on your broker account for calculation;
  • "By last trade" - calculated by MC, requires realtime data subscription on your broker account for calculation, should match TWS main grid;
  • "Get from TWS" (single accounts only) - streamed by IB API - should match TWS Accounts tab;

Connection Settings section

Disconnect the broker profile (stop auto trading) in X seconds after IB TWS is logged off.

In case of the connection loss the broker profile will be disconnected after the specified period of time if the connection is not re-established, as the result the auto-trading will be turned off.

Financial Advisor Settings

To set up Financial Advisor account, select the Financial Advisor Settings tab.

There are 3 options to select:

  • Automatic Allocation
Group: a group of accounts should be created in TWS and the name of the group should be put to this field.
Method: a method of allocation for the group should be specified.
Percentage: percentage of allocation should be specified.
  • Manual Allocation
Profile: a profile in IB TWS should be created, where all the settings are set up and the profile name should be put to this field; or:
  • Single Account Allocation
Account: only 1 account of the group should be specified to send all the orders directly on this account.

How stop orders work

  • Native OCO enabled, Overfill protection enabled.

For orders sent in the OCO group:
All Limit orders (entry and exit) are blue (on broker).
All Stop orders (entry and exit) are blue (on broker).

Limit orders sent not in the OCO group:
All Limit orders (entry and exit) are green (on exchange).

  • Native OCO enabled, Overfill protection disabled.

Limit entry order-blue (on broker).
Limit exit order-green (on exchange).
All Stop orders (entry and exit) are blue (on broker).

  • Native OCO disabled.

All limits (entry and exit) are green (on exchange).
All Stops (entry and exit) are blue (on broker).


Note: On IB Live account you can send Stop orders directly to the exchange (green in TWS).
Enable "Use outside RTH tag" to do that. In order to send multiple orders directly to the exchange "Use Native OCO Group" should also be disabled.