Category Archives: Interactive Brokers software tutorial

Tutorials around IB software

New recommended Interactive Brokers Traders Workstation Version (TWS 972)

Please apologize.  With our recommendation we switch back to this version.  Portfolio data are reported correctly.


User having higher verison and no problem should stick with those verison.


The version 972 has the advantage that it can be kept running using IBController (and IBStarter, a gui for IBController).


Download recommended Trader Workstation (version 972)


Download IB Gateway recommended (version 972)


Order increases leveraged FX position

When using software which works with an Interactive Brokers account, non USA traders may receive this order rejection notice:

Order increases leveraged FX position


The reason for this is may an insufficient margin.  You can try to solve this by logging into Account Management and request cash forex (leveraged forex) permissions.

TWSLink new version

A new TWSLink version has been uploaded.

  • Bugfix: Adaptive Orders bug fixed.
  • Change: Log extended to record adaptive order attributes.


[ddownload id=”281″ style=”link” text=”Download TWSLink″]


Batch command example adaptive order for TWSLinkBaTe

int uidc=REGISTER_CONTRACT("NVDA","STK","USD","SMART","","","",0,"",0,0)
int uido=PLACE_ORDER(uidc,0,"BUY","LMT",100,186.00,0.0,"DAY",-1,0)
// set rth hours only
// set adaptive order algorithm name
// set adaptive order parameter and transmit order to IB

Download bacth file TWSLinkBaTe



Disable TWS automatic Logoff


this is a quick tutorial how to prevent Interactive Brokers Traders Workstation (TWS) from automatic logoff. It also allows TWS to be started with a double click on a batch (Windows)- or shell (Linux) file.

This tutorial refers to Windows. On Linux just edit .sh files instead of .bat files.Steps to create automatic startup and autologoff preventions are:

  1. Download free open source IBController
  2. Unzip IBController into a folder of your choice
  3. For each TWS login, create a subfolder below IBController folder
  4. Copy files IBController/IBController.ini and IBController/IBControllerStart.bat (.sh on Linux) to this subfolder
  5. Edit IBController.ini to set login name and password and to set a flag to prevent autlogoff
  6. Edit IBControllerStart.bat to set TWS-Version and path to your IBController.ini
  7. Test it


We tested auto startup with TWS 952, TWS 964 and IBController 3.2.0. Before you start, make sure to have a TWS >= version 952 installed. You can check this,  by looking in folder.
c:\jts. You should see something like c:\jts\952 or c:\jts\959

1– Download IBController

Visit Github to get the latest stable version. In this case, it is version 3.2.0. Scroll down to file

2– Unzip IBController

to C:\IBController. So in C:\IBController you can see  files: README.txt, version, userguide.pdf, etc…

3– Create configuration subfolder

for all your configurations (different IB logins (paper, real) and/or TWS startup), let’s call it: configs. So you finally have a folder


Now in this folder, create a subfolder for a specific configuration. In our case, this is to start TWS version 952 with the public demo login credentials.
Create folder:


and create another folder in this subfolder, call it TWS. (This is used by TWS to store some setup.)



4–Copy files

C:\IBcontroller\IBController.ini and c:\IBController\IBControllerStart.bat to config folder


Also copy [ddownload id="1405" text="our jts.ini default file"] into this config folder.

5–Edit INI file

Scroll to attribute

and set the username of your account. In this case with public demo user:

Scroll to attribute

and set the password to the password of your login. This case the password for public demo:

(You could also set an encryped password...)

To encrypt your password in this file. BUT then, you need to put the encrypted password for IbPassword parameter.

To encrypt password, open file c:\IBController\IBControllerEncrypt.bat and follow instructions. (replace ‘deomuser’ by your password,
run file in a cmd window, copy encrypted password and put behind IbPassword=.

Define the folder, where TWS is storing settings and logfiles. Use the TWS subfolder for this as argument for
attribute IbDir.

     IbDir= c:\IBController\configs\demo_952\TWS

Set the trading mode flag. For livetrading to live , for paper trading to paper. So real accounts should have this set to live. Paper accounts to paper.


Finally, set the attrib IbAutoClosedown to no. This prevents TWS from autologoff.



6– Edit BAT file

Set parameter TWS_MAJOR_VRSN to a version which is installed in c:\jts. In this case 952.


Set the path of the file IBController.ini.



7– Test it

Doubleclick on file c:\IBController\configs\demo_952\IBControllerStart.bat.. This should start TWS, do an automatic login and prevent

TWS from automatic logoff. To test this feature, in TWS open Settings/Lock and Exit

and set the time 5 Minutes to future. !Close this dialog and settings. Wait for logoff time. TWS should NOT be closed. If you reopen logsettings, you will see logoff time shifted.


Hopefully this tutorial can help you to run TWS more convenient and to stop it from logoff. The setup in this tutorial slightly differs from what the IBController makes recommend.
Basically, the recommend to store the config files in the users document folder and to set this folder for encryption. Of course you can do it this way. Just follow the guid, which can
be found in folder