top of page
< Back

What transaction costs should I assume in historical tests?

Miniatura.jpg

CREATED BY

March 24, 2025

MICHAŁ ZAREMBA

Transaction costs are an extremely important topic for every trader, especially short-term and algorithmic ones.

What transaction costs should I assume in historical tests?

What transaction costs should I assume in backtests?


I first approached analyzing transaction costs using Alpaca & Algocloud in mid-2024 with a sample of about 1,000 real transactions for the period 11.2023-07.2024.


In February 2025, I returned to analyze the costs again, this time with a sample of over 6,000 transactions on both Alpaca accounts (real and demo) for the period 11-2023/02-2025.


Now, I can answer with much greater confidence the crucial question: What are the real trading costs using Alpaca and Algocloud?


In the second part of this article, you will receive specific setting guidelines that I use in my backtests, but let's start with what and how I investigated.


Objective and Method of the Study


  • The study aimed to determine the actual slippage and spread for market orders placed at the end of the day (ON BAR CLOSE). These orders are placed about 3-4 minutes before the market closes and are compared to the close prices recorded on daily candles used for backtesting.


  • My study included 2,227 LONG transactions on a real account and 3,548 transactions on a demo account.


  • I use the broker Alpaca, so I do not incur any commission costs except for REG/TAF fees, which are marginal (I write about the details here).


  • I base my analysis on the closing transaction prices recorded in Algocloud (csv export). The sample concerns strategies operating on companies from the S&P500 and Nasdaq100 indices.


  • I compared this "close" price to a reference source, i.e., the official Close price of that day, according to Nasdaq Financial, Economic and Alternative Data. I used this source due to the unadjusted close. In a previous study, I used the price provided by GoogleFinance, but the Nasdaq data are better for this study because it does not include dividend adjustments.

    Obtained Results

    Here is a summary of the obtained results:



    A screen of the Real account sheet. The full data can be found below.

    Histogram showing the distribution of price differences based on Real account data. Positive difference - unfavorable. Negative - favorable.


    Full research results are available in the Google Sheet:


How about dividends?


To ensure the accuracy of this study over the long term, we need to use the unadjusted close, which is the actual price of the day without considering splits and dividends. If we don't, the study might be too optimistic because the adjusted close tends to decrease over time, skewing the results.


However, this approach means the study doesn't include dividends paid if we hold a position on the Ex-Dividend Date. I view dividends as a bonus, like the cherry on top, reducing our costs, but this is not included in the study.

Summary of results


The result obtained on the real account, i.e., 0.015%, is several times better than the 0.05%-0.1% I most often assumed in backtests.


Interestingly, the results from the real account are better than from the demo account, suggesting responsible simulation of order execution by Alpaca.


The timing used by Algocloud, which operates on bar close with about a 3-minute delay, is cost-effective.


While total transaction costs can be higher depending on how a position is opened, most of my strategies use Limit orders. This approach helps avoid the spread from the beginning. Although Limit orders have their own "limitations", that's not the focus of this article.


In my opinion, we live in beautiful times because transaction costs have never been so low for individual investors!


Safe assumptions in backtesting


Here is MY standard historical test setup, with strategy settings:

Type 1:

  • Entry - Limit

  • Exit - Market, On Bar Close

The costs we assume are 0.05%, which is over 3x more than what came out in the real account study 0.015%.


Type 2:

  • Entry - Market On Bar Close

  • Exit - Market On Bar Close

The costs we assume in backtests are 0.1%, which is almost 7x more than what came out in the real account study.

In this case, slippage occurs 2x (on entry and exit), so it requires in my opinion at least double consideration. I currently have too little data to assess the market order entries themselves, but I plan to expand my research in the future.


All strategy tests conducted by us in Algohubb have such or similar cost settings during the strategy testing phase.


You can find more on the topic of broker evaluation and costs in this article.

BEST STRATEGIES

average rating is 4.7 out of 5

Volta Strategy

The Volta strategy uses a volume-based indicator as its foundation, which distinguishes the strategy profile from most typical reversal strategies. It is a mean reversion strategy that waits for a quick pullback in an uptrend.

average rating is 4.6 out of 5

Stock Monthly Mover Strategy

The strategy is based on a monthly pattern that has been occurring in stocks for several decades. A great advantage of it is the low capital commitment (on average around 13% of real exposure), which allows for simultaneous use of capital in other strategies.

average rating is 4.5 out of 5

R2 Turbo Strategy

The R2 Turbo strategy is inspired by Larry Connors' experiences. It uses the Relative Strength Index (RSI) indicator in a unique way, along with filters to boost its effectiveness. This trend reversal strategy waits for a specific pullback during an uptrend.

average rating is 4.5 out of 5

Triple B Strategy

The Triple B strategy combines three indicators that support each other. The basis of the strategy is the %B indicator based on Bollinger Bands.

average rating is 4.5 out of 5

Week Explorer Strategy

For last 40 years, the best day of the week on the US stock market has been Tuesday. The next day with the highest return is Wednesday. We present a strategy that skillfully exploits this market behavior by opening positions only on Mondays and cashing in profits in almost 70% of cases over the following days.

average rating is 4.4 out of 5

IBS Master Strategy

IBS Master draws inspiration from the experiences of Linda Raschke described in the book Street Smarts: High Probability Short-Term Trading.

average rating is 4.4 out of 5

RSI Range Rider Strategy

If J. Welles Wilder knew that the indicator he described in 1978 was still performing so well, he would be very proud. It is a matter of matching a powerful indicator to the nature of the instrument, that is US stocks.

average rating is 4.3 out of 5

KO Christmas Rally Strategy

The seasonal holiday pattern on Coca-Cola is one fantastic example of how seasons affect stocks. The pattern has a logical justification, which is the association of the brand with holidays built over decades. This consequently influenced consumer and investor behavior before this period.

average rating is 4.3 out of 5

BBIQ Strategy

The BB IQ strategy utilizes the Momentum effect by purchasing stocks that are in the Exponential Move phase and those that are among the strongest in the index.

average rating is 4.3 out of 5

Momentum IBS 3xETF Strategy

Momentum IBS focuses on three ETFs, rarely engages capital, but is a valuable addition to most portfolios due to the stability of profits and excellent risk-reward ratio. It offers a 71% win rate and a different profile compared to typical reversal strategies.

average rating is 4.2 out of 5

BKNG Winter Travel Strategy

Winter is one of the two best seasons for Booking.com. This is also true for the company's stock. The winter strategy will show you how holding the stock for just 25 days in January and February could yield results similar to holding the index for the entire year.

average rating is 4.1 out of 5

BA Flight to Growth Strategy

Each year, the shares of the aerospace giant The Boeing Company (BA) statistically see an increase from the end of October to the beginning of January. What might drive this trend? Increased air traffic during the holiday season, which reminds investors of the company? Or perhaps government purchases at the end of the year cause Boeing's shares to gain strength?

bottom of page