Auto-Trading multiple IB accounts

This question may be slightly off-topic. It involves not only AmiBroker but also Windows, TWS, and Interactive Brokers features.

What are some recommendations and pitfalls to avoid when auto-trading multiple accounts with Interactive Brokers? Two of the accounts will trade the same strategy. The third account will trade a different strategy. Is there a recommended architecture?

If this is already documented somewhere, I would be happy to find and read the docs.

Hi Steve

The first thing you'll need to do is set up an Advisor account in IB and assign all the accounts you want to trade to the Advisor account. You'll then login to TWS with the Advisor account credentials, and you'll then have access to trade all the client accounts.

If you want to send an order for just a single account, in the IB Controller you can either use SetAccount() to set the account before sending the order, or you can just set the account inside the PlaceOrder() command.

For trading the same strategy on multiple accounts use the FA Setup in TWS to create an account group or allocation profile and send the order to that grouping using the PlaceOrder() command.

It's all well documented in the IB Controller Help. Search the page for "advisor".




@HelixTrader Thank you for the prompt reply. To follow-up, may I ask what software architecture would be needed if I do not use the advisor account structure? Would that require running 3 instances of TWS?

I’m not sure that’s going to help you Steve since the IBC can only connect to one instance of TWS. If you wanted to do it that way, my guess is you would need 3 separate machines, or VPSs, running separate instances of TWS and Amibroker. However, as I use the Advisor method that’s only a guess. Maybe someone else can jump in and say whether it’s possible to control multiple TWS instances on the same machine.


As @HelixTrader wrote you need Advisor or Friends&Family account (they are similar). If you want to trade multiple individual accounts instead you would need to run 3 instances of TWS and 3 instances of AmIBroker each connected to other TWS (via different port numbers or better on different computers - can use virtual machine for example) or using 3 different Windows User accounts (as each user has “own” processes and “own” OLE automation).


Thank you @HelixTrader and @Tomasz.

My apologies for continuing this slightly off-topic thread, but one more consideration is the IB data feed. How does the Friends and Family account affect the number of allowed streaming symbols and monthly fees for the data feed?

It operates just like any other regular account. If you trade client accounts through the Advisor account, rather than directly through logging on to the client accounts themselves, you can turn off all the data feeds for the client accounts, and just have data turned on for the Advisor account. So in that way, it can reduce your data costs.

Depending on how you have the Advisor account set up will determine whether they classify you as an individual or as a professional, and therefore how you are charged for the data.


Perfect. Thank you @HelixTrader

1 Like

Another question reviving this topic. Sometimes a security may be held in multiple accounts. What is the right way to get the current position size for each account separately? Which of these approaches , or some other approach?

size = GetPositionSize(ticker);
size = GetPositionSize(ticker);

I think you would use the first one. The second one is for information like the cash balance or net liquidity.

But you need the ibc object in front of GetPositionSize:

size = ibc.GetPositionSize(ticker);

Question for anyone who trades with a Friends and Family Advisor account. Is it possible to hold positions in the master account itself and trade it alongside the client accounts?