Home     Manual
 


GBOT UPDATE INSTALLATION

If this is your first installation, skip this step. If you have got your new G-Bot update, follow this steps:

- Remove the old version, as usual, using Windows uninstaller.
- Remove the folder "G-Bot_Files" in "Documents".


You can also remove all the the old temporary G-Bot folders (G-Bot temporary folders can be removed anytime, even while trading, unless you have there closed sessions that need to be restored):

RemoveGBotFolders


- Make sure you have installed the latest version of the Gateway and IB API. In case remove the old version and install the new one:


http://download.interactivebrokers.com/download/tws40_install.exe

 API ver. 9.67:

http://www.interactivebrokers.com/download/InstallAX_967.exe

IMPORTANT: when installing the API, make sure that TWS, Gateway or G-BOT are not running (or else the DLL may not be actually installed)


Remember to setup the TWS or the Gateway to allow API connections, set all "Precautions" to bypass, and add the local host 127.0.0.1 to the trusted IP addresses.

If you need to update your JAVA version, it's good to do it now. Test TWS and the Gateway, after any update.

In case you receive the "Unauthorized user" error, please send me the customization information (MAC address, etc) that are indicated on our page:
http://www.datatime.eu/public/gbot/default.htm#CopyRequest.  

 


G-BOT FIRST INSTALLATION AND COMPUTER PREPARATION


What is G-Bot ?

G-BOT is a breakthrough Algorithmic Trading Platform. It's a high precision instrument working as a bullet proof client sending orders directly to IB Gateway (or IB TWS).
It is meant to work completely automatically and stay up 24/7 (it also allows full discretionary intervention). It will automatically execute predefined algorithms, that can be selected and customized by the user.
It can trade any instrument, including futures , stocks, etf, options, forex, and it is especially meant for use with folios of futures and future options.
It is based on the modern Microsoft .NET technology (.NET 4.00) and the latest Interactive Brokers APIs.

G-Bot is an elitarian application for smart people. Therefore, I only provide the basic information to get you started up, while I expect you can get most of its functionalities and strategies by yourself, and possibly provide feedback for performance enhancements. Trading is not not for all. It's difficult and requires right tools and strategies, intelligence, capital and right environment.
I provide you with the right tool and the basic strategies. You need to provide the rest. Make sure your trading environment is quiet and allows you to focus on what you are doing.

Operating systems

Win XP, Win 7, Vista 32 or 64 bit  (or any windows system or platform running .NET)


Trading machine preparation

advice If possible, make a clean windows install (after data backup) and install only the most important and secure programs (antivirus, etc). [ If you can choose, get Win 7 ultimate].
If have not done a clean windows install, run a complete antivirus scan, and disk defrag and check out everything is in order.
critical issue Through Windows Control Panel, disable any form of energy saving or monitor and computer sleep (do not set the "blank" screensaver). Disable automatic defrag (you will run it manually when mkt closed). Try not to use font sizes larger than windows default (96 dpi) and, in any case, do not increase it beyond 125%.

NoSleep

 

critical issue Never change manually computer time while G-Bot is trading or running

Synchronize your clock. Make sure the computer time is correct. If necessary, synchronize it with an internet Time server (eg., pool.ntp.org). In case read this tutorial:
http://www.howtogeek.com/howto/windows-vista/dealing-with-windows-vista-time-sync-problems/

Synchronize clock

(changing time while G-Bot trading could result in chart messing, as the time is represented on the x axis of charts.)

critical issue Never allow any update while trading and until all positions are closed

It is important that while trading (especially with real money) no software update be ever allowed. (Especially Java or operating system or tws or IB api)
In fact, as the TWS and API are java-based, if any version incompatibility arise (rare, but indeed possible) you might even not be able to immediately resume trading.
So, it is safe to do all the updates and maintenance when mkt closed.

 
critical issue Disable any form of automatic windows update or maintenance or defrag and perform these task manually in a day of the week when not trading.

NoUpdate

If you have win 7, you may also want to o want to disable altogether the auto shutdown after windows updates (recommended).

critical issue When trading with real money, you must have UPS or battery (e.g., a powerful laptop). Make sure that the trading station cannot be turned off accidentally by any reason.
advice If possible, have speakers attached to the trading station, so that G-Bot disconnection alert can be heard. If you leave the bot completely unattended, remember to disable the sound alert (G-Bot makes a eerie sound when disconnected, which may be of great annoyance to neighbours).
advice If possible, might be a good thing to have multiple internet providers. If possible, use the pc where installed G-BOT for trading only, when trading with real money. Never use the trading machine (or the network where the machine is plugged) for P2P activity or alike.

 

Software prerequisites

To run G-BOT, you will need the following software installed in your computer:

  IB TWS and Gateway:
http://download.interactivebrokers.com/download/tws40_install.exe                                                                                   

  Net Framework 4.0:
http://www.microsoft.com/downloads/details.aspx?FamilyID=9cfb2d51-5ff4-4491-b0e5-b386f32c0992&displaylang=en   

 Interactive Brokers API (always use the latest beta release):
http://www.interactivebrokers.com/en/p.php?f=programInterfacemInterface

  Microsoft Visual C++ 2005 SP1 Redistributable Package (x86):
http://www.microsoft.com/downloads/en/confirmation.aspx?familyid=200B2FD9-AE1A-4A14-984D-389C36F85647&displaylang=en


For 64 bit systems, in case problems arise, take a look at IB recomendations:
http://individuals.interactivebrokers.com/php/apiUsersGuide/apiguide/activex/running_the_activex_api_on_64-bit_windows_xp_systems.htmystems.htm

This discussion may also be useful:
http://www.elitetrader.com/vb/showthread.php?s=&threadid=182041&perpage=6&pagenumber=4

 

GATEWAY or TWS preparation

 If you use the IB Gateway (recommended), just make sure to select "API" (not FIX), when logging in for the first time. (If you are not too familiar with the Gateway, you will find it just near the TWS in your program menu).

Configure the API settings, to allow connections and disable all precautions:

    - enable ActiveX
    - bypass order precautions for API orders
    - add 127.0.0.1 (the “local host”) in trusted IP address list     <= important or, on disconnection from TWS, the bot automatic reconnection attemp will be blocked
    - (may want to disable sounds for order fill )

While we wait that the guys at IB finally make optional the automatic logoff feature, you may want to use the IB Gateway, instead of TWS to avoid the annoying automatic daily autologoff.

 

API Settings


->     The TWS default port is 7496. If you use the IB Gateway, the default port is 4001.

 

Bypass all API precautions

Important: In the "Precautions" section of API Settings, check to bypass everything (G-Bot takes care of all precautions).

Using the Gateway you may find quite annoying that you can't have a  look at the account. IB should really add an account view to the Gateway.
In any case, in G-Bot, you can use the context menu "show IB account info" or the "$" icon in the trading monitor window to browse the last folio update events received from IB.

 

GBOT Installation

Run the setup file to install G-BOT. Once installed you will have 2 shortcuts: a new icon on the desktop and a new entry in the program menu:

GBotShortcuts


Make sure that either the Gateway or the TWS is running before you attempt to connect.
Use the the icon on the desktop or in the program menu to run G-Bot. 
- The Gateway or the TWS must be running for G-BOT be able to receive data and send orders.

G-Bot communicates with the Gateway (or TWS) through a socket port, by default the port number is 7496 for TWS or 4001 for the Gateway (recommended).

If the port number is changed for any reason, the number must be the same in both Gateway (or TWS)  (see Api settings), and G-Bot.  If port numbers are different clearly G-Bot will not be able to communicate.  

 

 

For quick settings of default port (41001 for Gateway, or 7496 for TWS), you can just click on the two small icons below the port number.

Install is now complete.

 
Some notes on G-Bot usage

- Once the program is running, correctly receiving data from the Gateway (or TWS) and sending orders, it should never be shut down, unless there is the intention to close the trading session. G-Bot is designed to stay always on 24/7: day and night. If, for any reason, the gateway (or TWS) is closed, killed, autologoff, or quit functioning for whatever reason, never close G-Bot: just restart the Gateway or the TWS. G-Bot will reconnect automatically.

 

Power outage

- If you have a UPS or battery attached to the PC, wait until the the line is restored. Do not do anything. Short interruptions will not be able, in general, to hurt much the strategy.
If the interruption is too long and the UPS is running out of charge, close gracefully G-Bot saving the current trading session. It can be restored when the power is back. Shut down the PC.
When the line is restored restart the PC, restart TWS and G-Bot, by resuming the saved session. G-Bot will restore trading just from where it left.


- If you do not have a UPS attached to the PC, it is mandatory to have an UPS (or battery) attached when trading with real money! When the line is restored restart the PC, restart TWS and G-Bot, by loading the last trading session. A copy of the trading session file is automatically saved periodically in the program folder.

Check that the positions in TWS match the positions in G-Bot. [If one does not have UPS and is also very unlucky, it might happen that the power interruption happened just while the session file was being written on disk. In such a case may not be possible to restore the session due to file corruption. (However note that G-Bot uses a double backup mechanism: so check out the previous backup and see if it maches your current position. In case you can also use the feature which allows to insert manually new positions.) Always use a power backup to avoid that]. In general, it is always better to leave G-Bot on until you have closed all positions. Anyway, in case you wish to close G-Bot leaving the positions open, to restore trading after several hours or from another machine, it can be done. Close G-Bot saving the session. You can resume an interrupted session (from any machine) by simply reloading the saved session file. G-Bot will restore trading from where it left (clearly, tick data will have a gap if mkt is not closed).

 

Before trading with real money (partners only)

Make sure you paper-trade with G-BOT at least for a few months before thinking of trading with real money. Understand and get familiar with all G-Bot functionalities and the various strategies. Do all possible crazy experiments you wish when paper trading.
Try also stressing the system, causing errors and shutting down the machine and restore trading.
Report to us immediately any problem you see or any suggested improvement. Any issue is solved immediately.

Do not do anything in real trading, which you have not already tried in paper trading, and you are sure about the result of that action.

Adding new instruments

Make sure you understand the symbol notation used by G-Bot by examining the symbol file: it's very simple and intuitive.

If adding a new leveraged instrument, make sure that you have specify the correct value for the multiplier (the multiplier can be found very simply by double-clicking on the symbol name in the TWS. Anyway many examples are within the symbol file itself).
New instruments can be added/removed "on the fly", while other instruments are trading, at any time.
Instruments can also be "cloned" to have multiple of the same instrument instance within the same session and account.
Never trade with real money any instrument that you have not paper traded and fully understood (tick value/liquidity/volatility/correlation, etc.), and tuned strategy parameters based on its volatility, margins and the drawdown your account can actually afford.


Trading "clones" within the same instance of G-BOT

Any instrument can be cloned and each clone will trade independently. Overlaying delayed clones is a good method to spread risk, instead of increasing the packet size.

 

Trading simultaneously different G-Bot instances (clients) on the same account

You can run multiple instance of G-Bot, pointing to the same account. In this case, they all have the same port but the client numbers must be different clearly (1,2, ...). [ If the same client number is used for another instance, it will fail to connect. ]


Trading simultaneously different G-BOT instances on different accounts

You can run multiple instances of G-Bot, pointing to different accounts. In this case, a different port number must be used for each account (for instance, 7496, 7497, ... or 4001, 4002, ..  for the Gateway). When trading on different accounts, the client number need not to be changed.

 

G-Bot is a very stable platform. It can stay up forever with any number of instruments. It is now being run by a huge number of people worldwide. So any bug should appear is really short lived. If you see any problem, check out the following list. If it's a new problem or bug, please report immediately, so win can fix it immediately.

 

 

Some quick Troubleshooting

Troubleshooting: You see a crash when connected to the Gateway or tws, or orders do not execute.

Make sure you have installed the latest API and the c++ redistributable. Update your java framework.

Troubleshooting: G-BOT can connect to TWS, but receive a side by side error ?

Make sure you have installed IB API and the visual C++ SP1 redistributable as indicated in the prerequisites above.


Troubleshooting: You receive a request to enter MAC address and an "Unauthorized Trader" message

Either: 1. the MAC you provided was incorrect, 2. you are trying it on another machine with a different MAC.

Send us
all the MAC addresses you need of the testing machines, or else it will remain or switch in "manual mode" and it won't trade automatically.
You can also use our utility to see the mac of your machines: http://www.datatime.eu/public/gbot/FindMAC.exe


G-BOT cannot connect to Interactive Brokers API: Unregistered interface/class ?

This should never happen. It it happens inform us and ask for a new program setup.
[If anything fails, you can try a "manual" registration of the IB API dll. To register manually the API DLLs:

Tws.ocx
,
AxInterop.TWSLib.dll, which you will find in the program folder, you can use the utility DLLVIEW : http://www.nirsoft.net/utils/registered_dll_view.html
When registering / Unregistering use "run as administrator" to run dllview  http://www.nirsoft.net/utils/regdllview.zip    [DLLs 32 bit]
(You need to use in any case the 32 bit version, even if running on win 64 bit, because IB API are 32 bit) ]

 

Home     Manual