Professional Documents
Culture Documents
Strategies - Part II
Successful Backtesting of Algorithmic Trading Strategies - Part II
By QuantStart Team
An instrument with higher volatility is more likely to be moving and so prices between
signal and execution can differ substantially. Latency is defined as the time difference
between signal generation and point of execution. Higher frequency strategies are more
sensitive to latency issues and improvements of milliseconds on this latency can make
all the difference towards profitability. The type of strategy is also important. Momentum
systems suffer more from slippage on average because they are trying to purchase
instruments that are already moving in the forecast direction. The opposite is true for
mean-reverting strategies as these strategies are moving in a direction opposing the
trade.
Market Impact/Liquidity
Market impact is the cost incurred to traders due to the supply/demand dynamics of the
exchange (and asset) through which they are trying to trade. A large order on a relatively
illiquid asset is likely to move the market substantially as the trade will need to access a
large component of the current supply. To counter this, large block trades are broken
down into smaller "chunks" which are transacted periodically, as and when new liquidity
arrives at the exchange. On the opposite end, for highly liquid instruments such as the
S&P500 E-Mini index futures contract, low volume trades are unlikely to adjust the
"current price" in any great amount.
More illiquid assets are characterised by a larger spread, which is the difference between
the current bid and ask prices on the limit order book. This spread is an additional
transaction cost associated with any trade. Spread is a very important component of the
total transaction cost - as evidenced by the myriad of UK spread-betting firms whose
advertising campaigns express the "tightness" of their spreads for heavily traded
instruments.
Algorithmic traders also attempt to make use of actual historical transaction costs for
their strategies as inputs to their current transaction models to make them more
accurate. This is tricky business and often verges on the complicated areas of modelling
volatility, slippage and market impact. However, if the trading strategy is transacting large
volumes over short time periods, then accurate estimates of the incurred transaction
costs can have a significant effect on the strategy bottom-line and so it is worth the
effort to invest in researching these models.
A market order executes a trade immediately, irrespective of available prices. Thus large
trades executed as market orders will often get a mixture of prices as each subsequent
limit order on the opposing side is filled. Market orders are considered aggressive orders
since they will almost certainly be filled, albeit with a potentially unknown cost.
Limit orders provide a mechanism for the strategy to determine the worst price at which
the trade will get executed, with the caveat that the trade may not get filled partially or
fully. Limit orders are considered passive orders since they are often unfilled, but when
they are a price is guaranteed. An individual exchange's collection of limit orders is
known as the limit order book, which is essentially a queue of buy and sell orders at
certain sizes and prices.
When backtesting, it is essential to model the effects of using market or limit orders
correctly. For high-frequency strategies in particular, backtests can significantly
outperform live trading if the effects of market impact and the limit order book are not
modelled accurately.
Cheap or free datasets, while suffering from survivorship bias (which we have already
discussed in Part I), are also often composite price feeds from multiple exchanges. This
means that the extreme points (i.e. the open, close, high and low) of the data are very
susceptible to "outlying" values due to small orders at regional exchanges. Further, these
values are also sometimes more likely to be tick-errors that have yet to be removed from
the dataset.
This means that if your trading strategy makes extensive use of any of the OHLC points
specifically, backtest performance can differ from live performance as orders might be
routed to different exchanges depending upon your broker and your available access to
liquidity. The only way to resolve these problems is to make use of higher frequency data
or obtain data directly from an individual exchange itself, rather than a cheaper
composite feed.
In the next couple of articles we will consider performance measurement of the backtest,
as well as a real example of a backtesting algorithm, with many of the above effects
included.
©2012-2019 QuarkGluon Ltd. All rights reserved. Privacy Policy | Back to top