Blog Archives

IB ActiveX API Order status processing with VBA Dictionary object

If you ever submitted an order to Trader Workstation using IB API - you are probably aware of a well-known issue involving Interactive Brokers platform sending back duplicate order status updates. This can be problematic if your order management system or trading algorithm relies on accurate order status information. For example, a duplicate "FILLED" order status message for the same order ID can be misleading and confuse your trading logic.

This post demonstrates a method for improving IB ActiveX API's order status handling code using VBA Dictionary object. The algorithm for filtering out duplicate order status updates demonstrated in this post can also be used in Java, C++, and C# applications.
Posted in Interactive Brokers API, Programming examples Tagged with: , , , ,

Trading Strategy Backtesting Guide

Backtesting refers to testing a predictive model or a trading system using historical data. Traders use backtesting to test strategy ideas, compare strategy performance in different markets, time frames as well as determine optimal input parameter values for their systems.

Backtesting is proven to be useful for a couple of reasons. First, it is a method that provides concrete performance data for side-by-side strategy comparison. It eliminates guesswork and enables traders to apply scientific method to trading. Second, automated backtesting is a great time-saving tool. A good backtesting tool provides a way to iterate over thousands of parameter combinations and find the optimal ones. This process can be executed repeatedly on daily basis to ensure that a strategy stays fine-tuned using most up-to-date data.

Posted in Data Analysis Tagged with: , ,

Calculating Correlations of Forex Currency Pairs in Python

Traders often calculate correlation between different instruments, such as stocks and ETFs, or Forex currency pairs. It is important to know if you portfolio is properly diversified. Highly correlated instruments in your portfolio will tend to go up and down together compromising your diversification strategy. Keeping an eye for high correlations (positive or negative) is even more important to Forex traders, since currency pairs often exhibit high positive or negative correlations due to market conditions or having similar market drivers.… Read more...

Posted in Data Analysis, Programming examples

Technical Analysis with R

In this post we’ll take a look at how a trader could use R to calculate some basic Technical Analysis indicators. R is a free open-source statistical analysis environment and programming language. It is available for Windows, Mac OS, and Linux operating systems. Installation is easy and quick. For download and installation instructions go to:… Read more...

Posted in Data Analysis, Trading Tools

Technical Analysis in Excel: Part II – MACD and RSI

In the second part of the Technical Analysis in Excel series we will describe how to calculate RSI and MACD indicators using Excel formulas (see Part I where we implemented SMA, Bollinger Bands, and EMA indicators).
Posted in Data Analysis

Interactive Brokers TWS Performance Optimization