Subscribe to the newsletter!
Subscribing you will be able to read a weekly summary with the new posts and updates.
We'll never share your data with anyone else.

Importance of Commissions in a Backtest

Posted by Daniel Cano

Edited on May 15, 2024, 5:48 p.m.



What are commissions?

Commissions in trading are a critical aspect that often goes unnoticed but can have a significant impact on the profitability of an investment strategy. These commissions are the costs associated with executing financial transactions in the markets, and although they may seem small individually, their accumulation over time can have a considerable effect on the final results. It is important to understand that commissions are not limited to brokerage fees charged for buying and selling assets, but they can also include other costs such as spreads, financing charges (leverage), and management fees in the case of investment funds. Therefore, it is crucial to take all these factors into account when evaluating the profitability of an investment strategy.

Why are commissions important?

One of the fundamental reasons to pay attention to commissions when testing an investment strategy is that they can significantly reduce net returns. Even a strategy that seems profitable in gross terms can become unprofitable after taking into account the commissions associated with executing trades. Therefore, it is essential to calculate the impact of commissions on expected returns and ensure that the strategy is robust enough to generate net profits after considering these costs. This is more important the more frequent the trading activity of the strategy, as total commissions will increase proportionally to the number of transactions made. In shorter-term strategies, commissions can represent a significant portion of the invested capital and can quickly erode any potential profit. Therefore, it is important to assess whether a strategy is feasible given the commission fees and other associated costs.

Furthermore, commissions can influence the choice of financial instruments in which to invest. For example, strategies involving assets with narrow spreads or no commissions or lower leverage costs may be more attractive from a profitability standpoint due to the lower costs associated with executing trades. While the choice of financial instruments to trade is likely to be more affected by available capital and required margins.

How to estimate Commissions?

When conducting a backtest of an investment strategy, it is crucial to include a realistic estimate of the commissions associated with executing trades. These commissions can vary depending on the type of asset, the broker used, and the trading volume, among other factors. However, a commonly accepted estimate for trading commissions ranges between 0.1% and 1% of the total value of the trade, although personally, I prefer to assume a higher value.

For a good approximation, the first step will always be to try to reflect fixed commissions such as brokerage fees, market connection, financing, or management fees. These types of commissions are the easiest to take into account since they are defined, and you only need to consult them, although sometimes consulting them can be more complicated than it seems. The second step will be to estimate parameters that depend on the market, such as spreads and slippage. In most cases, a relatively simple equation can be developed based on the volatility and liquidity of the underlying asset. To avoid having to make such an estimate, assets can be filtered, and it is common practice to trade assets in which the trading volume does not exceed 5-10% so that slippage is less likely. Additionally, assets can also be filtered by volatility, increasing or decreasing the impact of the spread.

Example strategy

The strategy used for the example will trade a single contract and only long the SPY. Positions will be taken based on the position of the opening of the current candle relative to the previous day's closing average. In the upper chart, you can see the gross and net returns of the strategy compared to the Dollar Cost Average (DCA) strategy on the same financial asset. In the lower part, you can see the drawdowns of the three aforementioned traces.

One can observe how, while the gross performance is higher and considerably more stable than the DCA strategy, considering the commissions results in a considerably lower return. This could be addressed with higher leverage since the volatility remains lower than for DCA. But one would have to consider whether they would be able to follow this strategy considering that periods like the one observed between 2015 and 2019 could be repeated, during which practically no return was obtained due to erosion from more frequent trading.

Conclusion

It is important to include commissions when conducting a backtest of a strategy because they reflect the actual costs that would be incurred when executing trades in a live trading environment. Ignoring these costs could lead to an overestimation of the strategy's profitability and unrealistic expectations regarding expected returns.

Furthermore, taking commissions into account in the backtest allows for evaluating the viability of the strategy. If commissions represent a significant portion of the returns generated by the strategy, this could indicate that the strategy is not economically viable, especially if the net returns after commissions are not sufficient to justify the costs associated with trade execution.



Categories:
python trading