top of page
< Back

Trading costs on the stock market in practice

October 3, 2024

CREATED BY

MICHAŁ ZAREMBA

Miniatura.jpg

Choosing a broker and transaction costs can be a real horror. I know this because I have used around 20 brokers in my career and I do not recommend the vast majority of them. At the same time, transaction costs are crucial for running a business based on algorithmic trading.

Trading costs on the stock market in practice

Fortunately, by choosing wisely, we have never had as easily accessible and cheap regulated brokerage services in the history of retail investors.


I want to clarify right away that I have no ties with the brokers mentioned in this article. I don't gain anything from referrals or sharing my views on them. My writing is purely based on personal experience and research for my own purposes.


This article comprehensively discusses the issue of transaction costs, including deep-spread research, from a practical perspective.


Ideal broker?


My expectations for the ideal broker operating in the stock market are:


  • must be regulated by FINRA

  • my funds should be insured by SPIC ($500k+ insurance)

  • should offer true 0% commission for users outside the US as well

  • uses true market spreads (no markups)

  • has low margin (borrowing money) costs

  • offers all products (stocks, ETFs) from the US

  • provides a free paper/demo account that accurately reflects real trading

  • has a well-functioning API and lightning-fast order execution in conjunction with my platform (I use Algocloud)

  • offers a user-friendly broker portal and integration with TradingView

  • has a good manual, forum, and helpdesk (hopefully not needed at all)

In 2022, I thought that unfortunately such an ideal does not exist, working without satisfaction with many brokers (I will omit their names in silence), until ... I tried Alpaca and ... eureka! It turns out that you can meet all the above requirements at once. Since then, over the following months, I have been convinced that it was one of the best fundamental choices in my business.


Because I like diversification, I also have several trading accounts with other brokers, including the largest one in IBKR, but Alpaca is my no.1. Therefore, forgive me that my research below will focus solely on this broker. I recommend testing it. If you already have experience and the ability to compare, I think your opinions will be similar.


Broker manipulations


Many new traders, especially those outside the USA, often overlook the importance of trading costs. They might not realize how brokers manipulate fees, even when they claim to offer "real 0% commission." Hidden costs often show up as a high spread with a markup (an extra charge on the natural market spread) or as price slippage when executing orders. This can lead to a position being slightly in loss after opening or closing at a worse price than expected.


The purpose of this article is not to expose broker practices or manipulations but to warn that these tactics allow brokers to control your trading. Unfortunately, this could mean losing some of your control over your business.


Defense against manipulation and high costs


  • Choose a broker that meets the criteria mentioned above.

  • Work on timeframes that make the issue of costs, including the natural market spread, insignificant in relation to price movements and profits you achieve. I highly recommend the D1 timeframe.

  • Avoid order types and entry points in the market that make your costs unpredictable.


Why costs in trading are critical for your business


Costs in algorithmic trading are of huge importance mainly due to the large number of transactions executed. Currently, I am executing around 10-50 trades per day on my accounts, so for example, with a commission of around $5 per trade (example costs for Tradestation users outside the USA), the monthly amounts for such operations can be quite high, and for smaller accounts, such a cost could blow up even the best strategies. Fortunately, Alpaca has real $0 commissions, as well as negligible exchange fees like REG/TAF, which I will explain more about below.


What is the real spread on stocks and how to avoid paying it?


I had the opportunity to work for almost a year in a trading room, trading in day trading mode on stocks. During that time, I experienced how high market spreads can be on some stocks, especially in the first few minutes after the market opens. That's why I am sensitive to avoiding this unnecessary cost. Let's clarify that market spread, which is the difference between the current bid and ask prices, is a normal in the market. I am not referring to artificial spreads created by some brokers, as mentioned above.


I wouldn't be myself if I didn't delve into this topic in a more comprehensive way. In 2023, I conducted a detailed analysis of spreads using the Sierra Chart platform and NASDAQ TotalView US stock data (Level2 data) as a data source.


I completed a study that compared Alpaca spreads with Nasdaq stock market data. In every case I checked, the prices fully matched, showing that Alpaca does not manipulate spreads.


The second study focused on the pure market spread. It considered data for stocks belonging to the S&P500. In detailed research, I analyzed bid/ask prices of multiple tickers from this index every minute over a 30-day period in January-February 2023.


Here is an example table with recorded data:


The chart below shows the average spread for each minute over the next 30 days in the analyzed period. Here is an example spread for the IDXX ticker:


The spread behavior chart over time for most stocks looks very similar. At the beginning of the market (first 15 minutes), the spread is very high, then it decreases, only to increase significantly in the last 1-2 minutes of trading.


The size of the spread will of course vary between different stocks. For example, it will be completely different for AAPL (low relative spread) vs. BKNG (high relative spread), but the proportions of behavior over time are very similar for stocks.


Moving on to the details, the first 1.5 hours after the market opens for IDXX looks as follows:

Meanwhile, the last hour looked something like this:


I will not bore you with many examples of such spreads on different tickers. I would like it to remain in your awareness that entering a position with a market order at the beginning of the market will regularly result in catching a spread of even a few percent (!). Something like this cannot be predicted and assumed in backtests.


Practical solutions in constructing strategies


Solutions to the spread problem are very simple and effective. I use them in all of my strategies. I emphasize that these solutions apply to trading on a daily interval. I use the great features offered by Algocloud here.


  1. If you want to open a position at the beginning of the market - use a LIMIT order (preferably below the Open price), which will ensure that you do not pay the spread (the ASK price must reach your desired level, or you simply skip the transaction). Equally important, your backtest will be reliable in terms of entry prices (I confirmed this with a separate study using SQX).


  2. If you want to open a position with a MARKET order - do it only at the end of the market! Algocloud opens such positions about 5 minutes before the end of the session, during the period of the lowest spread throughout the day. I often prefer this type of order for liquid ETFs - although I also assume a slightly higher cost in the backtest.

  3. If you want to trade Breakout by using a STOP order (which is nothing more than triggering a MARKET order by the broker if the price reaches a certain level), then you can place your order away from the OPEN price to avoid getting caught too quickly in a market order, and thus in an unpredictable spread at the beginning of the market. This type of order in stocks is more advanced and requires higher transaction costs. Personally, I avoid this type of order in the broad stock market, but it can be successfully used with ETFs or highly liquid stocks where we know they have a low spread.

  4. When exiting positions - if they are based on rules, I only use a Market order ON BAR CLOSE. Of course, you can use SL or TP, but in this case, we are exposed to price gaps and sometimes at a high spread to the beginning of the market (more about SL and TP in stocks can be found here).


Volume vs. spread


Of course, the idea for potential defense against a high spread should be a filter that selects only stocks with high volume from the previous day. These frequently traded stocks should have a guaranteed low spread, right? I admit that I don't have reliable research in this area, but from my many observations, it seems that it's not so straightforward. I have often observed stocks with very high volumes and at the same time unnaturally high spreads. Honestly, I don't know what causes this, but it's probably more of a mix of volume and volatility rather than just volume itself. That's why I rely more on universal methods, as I write in the section above. A volume filter certainly won't hurt, but it may not be enough. However, it's always worth considering when looking for stocks outside the S&P500.


What transaction costs should I assume in backtests?


Carefully analyzing the topic, you may ask the question that if we close a position with a MARKET order 5 minutes before the market closes, and we conduct a backtest over, for example, 30 years, operating on the Close price from daily bars, how does the price behavior during the last/unknown 5 minutes affect the consistency of the results of the strategy compared to the earlier backtest?


This is a very good question. I dedicated a completely separate study to answer it, and the results were very surprising to me.


My study was based on 1074 transactions closed ON BAR CLOSE, on a real account using Alpaca broker and Algocloud platform, in the period: 11.2023-07.2024. In this study, I compared the real closing price of transactions recorded in Algocloud with the official/exchange closing price of the respective ticker on that day, which we normally use for backtesting.


I took the market closing prices from Google Finance. Here is a snippet from my comparative spreadsheet:


The results are much better than I expected. The average spread/slippage of the last 5 minutes, between the actual transaction price and the price recorded on the exchange as the bar closing, was only -0.005% (!)


This cost was an order of magnitude lower than I had previously assumed. I will be repeating this study cyclically to have a larger sample of data.


BTW, if you haven't already, sign up for our newsletter, and we will notify you of updates on this topic.


Safe assumptions


Below, I am writing about the costs I assume in backtests, which are 10 times higher than the average achieved in the above study. Due to this accepted margin, I consider such settings to be safe.


Here is my standard backtest setting, with the strategy settings: ENTRY - Limit (On Bar Open) / EXIT - Market (On Bar Close):

And regarding the orders: ENTRY - Market (On Bar Close)/ EXIT - Market (On Bar Close):


All strategy tests conducted by us at Algohubb have similar or identical cost settings during the strategy testing stage.


REG/TAF fees in practice


There is another category of fees for regulators such as the SEC and FINRA that is worth knowing about. Fortunately, their impact should be minimal on trading business with a good broker. These are the so-called REG/TAF fees.


More on this topic: https://alpaca.markets/blog/reg-taf-fees/


In practice, the REG/TAF costs are completely marginal for me, so I even skip them in the backtest settings. I estimate them to be around $0.06 per trade for me. They will be proportional to the size of the transactions according to the list in the link.


Margin and Short Selling costs


In Money Management, we periodically use credit in the Margin account. The extent of using Margin is, of course, the preference and risk tolerance of individual traders.


If you are using Margin, then factor in the cost of this credit from the broker in your backtests. At the time of writing this article, the cost of borrowing capital from Alpaca is 8.5% annually (for comparison, the best in the market in this range, to my knowledge, is IBKR which charges 6.83% during the same period).


The calculation method for Alpaca is outlined here:

https://docs.alpaca.markets/docs/margin-and-short-selling


The topic of short selling on stocks and the associated costs deserves another article, which I hope to write soon. However, I believe that shorting stocks is not necessary to achieve success in trading. It is associated with a number of challenges, limitations, and costs, so short strategies on stocks are more suitable for advanced users.


Summary


In summary, choosing the right broker and understanding transaction costs are key elements to success in algorithmic trading. I hope my experiences in this area will be helpful to you. Remember, even the best strategy can be undermined by high fees, so I'm rooting for your good choices in this matter!


BONUS TIP! How to Make Money with Free Capital Every Night


A tip for you as a reward for reading this article to the end 🙂.


If at the end of the day you have some free capital and 3 minutes to manually execute a buy or sell operation, you can successfully buy BIL overnight for a free amount. BIL is an ETF that practically accrues interest on treasury bonds daily (at the time of writing the article, it was 5.3% annually). The next day, the purchase of new shares will be financed from the broker's free margin, and by the end of the day, you can potentially sell BIL to balance the lack of cash.


This buy/sell operation requires a few minutes once a day. Personally, I set an alarm 5 minutes before the market closes and take a quick look at the results and the operation on BIL. Certain profits generated from such a "deposit" can successfully cover the costs of the margin and other fees for platforms like Algocloud. I hope that in the future, Algocloud will allow for the automation of this operation.


BIL chart (taking into account dividends paid out once a month):

Attention! Don't be surprised that on the first day of each new month, the price of BIL drops by the amount of interest paid to you a few days later as a dividend.


Therefore, the chart of BIL without considering dividends looks like this:

Leverage this simple yet effective strategy to enhance your investment portfolio and make the most of your free capital every night.

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 draws inspiration from Larry Connors' experiences. While it is based on the Relative Strength Index (RSI) indicator, it includes a specific way of using this indicator and filters that enhance its effectiveness. It is a trend reversal strategy that waits for a specific pullback in 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

Emerging Monthly Mover PRO Strategy

There is a PRO version of the Emerging Monthly Mover FREE strategy. Be sure to familiarize yourself with this strategy before moving on to analyzing the PRO version.

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

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

Gold Monthly Miner Strategy

The strategies from the Monthly Mover series utilize the best periods of the month for trading selected instruments. This time, I present a strategy exploring such patterns in the price of gold.

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.

AH-zdjecie-stopka.png

GET NEW STRATEGY UPDATES

JOIN OUR NEWSLETTER

Thanks! Let's stay in touch

bottom of page