Overview
Backtesting corrections represent realities in the market that render a simple theoretical backtest incorrect. That is, various frictions and other issues must be accounted for in order to produce a conservative test.
Corrections
- Commissions Most trades will incur brokerage fees or some sort of commission to trade. Commissions have been trending down over time, but nevertheless, if ignored can have a big impact on portfolio performance, especially for trading strategies with high 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);
This correction can mostly be ignored for very large portfolios. - 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.