top of page
< Back

What transaction costs should I assume in historical tests?

Miniatura.jpg

CREATED BY

May 7, 2025

MICHAŁ ZAREMBA

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.

If you use another broker please check your real costs and consider adjustments.


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

NQ Snap Strategy

High win-rate, low exposure, free capital — NQ Snap plays smart and pulls ahead of the benchmark.

average rating is 4.7 out of 5

Victa Strategy

Victa Strategy is a focused equity approach that leverages price and volume price action to capitalize on significant corrections while minimizing drawdowns. This strategy supports stable, long-term portfolio growth.

average rating is 4.7 out of 5

Volta Turbo 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

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.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.6 out of 5

Bollinger Bounce Strategy

The strategy effectively identifies overreactions and the subsequent snapbacks, outperforming a buy-and-hold in the long term while maintaining an average exposure of only 8%.

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

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.

bottom of page