Backtesting Corrections
Overview
Commissions
Most trades will incur brokerage fees or some sort of commission to trade. Commissions have been treding down over time,
but nevertheless, if ignored can have a big impact on portfolio performance, especially for trading strategies with
hight turnover.
No Fractional Trades
One idealization of the frictionless backtest is that we ignore
the issues surrounding achievable trade sizes. In general,
we cant trade fractions of a share, therefore, in our trade
function, we will need to round either up or down. For this,
you can use the built in math functions
//round to the nearest
Math.round(number);
//round up
Math.ceil(number);
//round down
Math.floor(number);
The larger your portfolio, the less impact this correction will have.
Market Impact and Slippage
The other promiment issue ignored by the efficient frictionless portfolio backtest is the issue of
market impact.
When trading
large blocks of assets, the trader can actually cause the market to move, changing the price that she receives. This means that
simply using the price as recorded in a price feed is unlikely to accurately reflect the price that one would receive when actually
trading.
Slippage refers to any time that the actual price of a trade differs from the expected trade price. This can occur for multiple reasons
including market impact. As a general rule, backtesting algorithms should include a correction for trade slippage.