Getting your trading portfolio ready
The first step in preparing for live trading is saving your trading portfolio. Enter all of the stock pairs that you wish to have in your trading portfolio in the Stock Pair Builder program, on the Backtest card, in the Table of Pairs. Check the settings of the allocated capital, period, and time stop-loss. Save your portfolio to the disk, for example as “My portfolio.spt”. Start the StockPairTrader and open your portfolio in it by clicking on the “Load Portfolio” button. When you next launch the Trader, it will remember the portfolio you used, so typically, you will only need to do this once.
Connection to the TWS (Trader Work Station)
Stock Pair Trader trades through InteractiveBrokers as the broker. It is one of the world’s largest and most reliable traders, with relatively low commissions. InteractiveBrokers makes it possible to trade on most stock exchanges around the world.
Once a connection with TWS is established, the Trader automatically starts to download real-time data of all stock forming pairs in the trading portfolio. Every time there is a change, it automatically recalculates the pair’s calculation model, signals are updated, and any trading orders as well. All information is displayed in the easy-to-use graphics of the main program window.
Stock Pair Trader can work in two different modes:
- Manual mode – in this mode, the Trader receives price updates and generates signals. Trading orders are generated and passed on to TWS only once the user clicks on “Submit Orders”. This means that the trader has the running of the program fully under his control. The trader can view and check all orders in TWS before they are submitted to the stock exchange.
- Automatic mode – in the automatic mode, the program takes full control of the execution of trading orders. It prepares orders at the time entered, submits them to the stock exchange through TWS, and checks that they have been duly fulfilled. The user need not take care of anything in this mode, the program trades for him.
The type of orders generated by the Trader can be set up. The default type is LIMIT, which ensures that each order is fulfilled optimally, reducing the price “slip”. If the Automatic Trading Mode is active, submitted orders are managed intelligently such that they are optimally fulfilled during the set time slot. The alternative is the MARKET type order that ensures an immediate fulfilment of an order, but at a less favourable price.
Aligning live trading with a back-test
The trading model used by the Trader for generating signals and trading orders is identical to that used by the Builder for back-testing. The logic of portfolio management (limiting the number of open positions, blocking cross and duplicate pairs, ordering according to the fitness function) is also identical. The risk of human error is eliminated due to automatic preparation and transfer of trading orders.
Program activity log
Stock Pair Trader records all of its activities in a log. This means that at any point, you can find detailed information about the trading process, fulfilment of trading orders, etc. The program log is saved in a text file in RTF format, which means that it can be opened in any text editor (e.g., MS Word). You can enter your own notes in the log directly in StockPairTrader, edit it, or delete parts of the text.
Today, we introduced a reliable and efficient tool for trading stock pair portfolios. In the next part of our series, we will focus on historic data for stock pair back-testing. We will see how and where data can be obtained, how to check it, and how to cleanse it off splits and errors.
Petr Tmej a Petr Slepička
Previous chapter: Building profitable portfolio of stock pairs
Next chapter: Historical data for backtesting stock pairs