Hi,
I am trying to either a) switch between IB accounts programmatically, or b) make a fixed selection of account in the script by e.g. a #define literal.
Currently I have set up an Accounts.csv with distinct names, account ids, and renamed copies of the IB DLL. And then I try:
#define SELECTED_ACCOUNT "IB-ACCT2"
#define ACCOUNT_ID "U1234567"
DLLFUNC void main()
{
Account = SELECTED_ACCOUNT; // with or without this
var *pBalance, *pTradeVal, *pMarginVal;
brokerAccount (SELECTED_ACCOUNT, ACCOUNT_ID, pBalance, pTradeVal, pMarginVal);
printf("Selected account %s, id %s\n", SELECTED_ACCOUNT, ACCOUNT_ID);
...
}
The above executes, but the value shown in the Zorro window corresponds to the default account instead of the selected account, and I get some warning/error messages depending on exactly what variation I'm trying ("BrokerAccount: No Data!" or from IB, "!Unable to subscribe to account as the following clients are subscribed to a different account....")
Declaring a string variable = SELECTED_ACCOUNT and passing in the variable name doesn't work either.
How should this be done? Using Zorro S, by the way.
Thanks very much for any insights!