Backtesting of Algorithmic Trading Strategies, Cont’d

QuantStart has a second part to its backtesting of algorithmic trading strategies series.  This time, they discuss more nuanced aspects of creating an accurate (and thus useful) backtest.  This means including commissions and fees; slippage and latency; and market impact and liquidity.  QuantStart also explores transaction cost models, including flat or fixed cost models, and linear, piecewise linear, and quadratic transaction cost models.  Finally, they discuss common strategy backtest implementation issues, including using market vs. limit orders, and OHLC data issues.  Read all of the details here.

Quantopian Announces Live Trading

Quantopian today announced that it has implemented live trading for algorithmic trading models coded in its backtesting engine.  Right now, it is only available by invitation, but those who are interested can sign up for the beta program.  I also appreciate that Quantopian is up front about the fact that it expects some anomalies to show up, both because the technology is still being refined and because their data provider uses real-time, unfiltered data (i.e. no filtering of bad prints).  In any case, what are you waiting for?  Head over to Quantopian and start automating your trading.

A Simple Algorithmic Trading Example

Very often, retail traders are intimidated by the idea of “algorithmic trading,” often equating it with high frequency trading.  Algorithmic trading simply means trading by fixed rules, and since computers are better and faster than humans at calculating the rules, we often hand off the task to computers for the trading rules to be automated.  On the lower-speed end of the scale, which I personally favor, it’s possible to trade these rules manually.  ETF HQ has a great example of this in their twist on Dow Theory, Market Timing Through Market Dominance — TransDow.  It describes a system that uses the ratio of the Dow Jones Transportation Average to the Dow Jones Industrial Average to determine whether the transports are leading the market (dominant) or lagging the market, and goes long or to cash accordingly.  Since it uses weekly prices, anyone can download the data from Yahoo Finance, throw it into a spreadsheet, and enter orders over the weekend.  These sorts of simple algorithmic trading models are a great place to start before tackling daily or intra-day strategies.  Read the article here.

Update:  Woodshedder is trying to implement the system in Amibroker, for those who use it.  It appears to produce different results from the system shown by ETF HQ, but may be a good starting point.

Backtesting of Algorithmic Trading Strategies

As a follow-up to yesterday’s post, I wanted to provide some more background about back-testing.  As usual, I won’t re-invent the wheel, so let me present some great posts from others.  QuantStart gives an overview of back-testing, including the key reasons why back-testing is important (filtration, modeling, optimization, and verification) as well as the biases that create misleading back-testing results (optimization bias, look-ahead bias, survivorship bias, and psychological tolerance bias). and finally the pros and cons of some of the software tools available for back-testing (Excel / OpenOffice; Matlab / Octave / SciLab; Python / Ruby / Erlang / Haskell; R / SPSS / Stata; and C++ / C# / Java / Scala).  The whole article is here.

Continue reading Backtesting of Algorithmic Trading Strategies

Parameter Optimization in Algorithmic Finance

Quantopian had a blog post a while ago about parameter optimization when building a trading algorithm.  What is parameter optimization?  In the simplest sense, it’s selecting the variable settings that go into your algorithm.  For example, when using a moving average, one must choose a number of days over which to calculate the moving average, and different lengths will have different effects on the outcome of the trading strategy.  So how does one choose the best parameters?  Quantopian discusses the pros and cons of the two most common methods, which are batch optimization (i.e. brute force) and walk-forward optimization.