My heart began racing when I logged into my brokerage account - my largest position was down 40% from the day before.

I started to freak out.

It was a normal day in the market - no big crashes - yet here I was seeing a huge decline in my position and no news to explain it. My cortisol levels finally started to drop when I realized that a large divestiture had been executed splitting the company in two. In my frenzy, I had failed to notice the new ticker symbol in my account (or the fact that my account total was roughly the same as it was the day before) and subjected myself to a few minutes of panic.

Most algorithms take price information as a key - or even the only input - so if you get a 40% drop in price like I did and don't adjust your prices, you're probably going to hit your stops and see your system bail out of a position. Corporate actions like this can have a huge effect on your data and your algorithms. They need to be cleaned up and taken into account so you know what you're trading and how to trade it.

Price Shocks You Shouldn't Freak out About

Here's a brief list of some of those events that can ruin your backtest data that you need to keep an eye out for.

Corporate Actions - Any action or announcement by a company that could have material impacts on the share price. The most common material corporate actions typically include: Dividend Announcements, Stock Splits, Reverse Splits, Rights Offerings, and Merger & Acquisitions (M&A's). For this article, we will focus mainly on dividends and splits as these have the most immediate impact on close prices.

Dividends - A distribution of company profits to eligible shareholders, typically in the form of cash (most common) or additional stock. Dividend payments are received by any shareholder as long as they hold the stock before the ex-dividend date. Note that dividend announcements are typically accompanied by a proportional change in the stock price.

Ex-Dividend and Ex-Dividend Date - Ex-Dividend is simply a term for any stock that is trading net of the value of the upcoming dividend. Ex-Dividend Date (also referred to as ex-date) is, you guessed it, the date which the stock begins trading without the upcoming dividend value. Most companies will specify the ex-date when they announce the dividend.

Stock-Splits and Reverse-Splits - This is a decision made by the company to either increase (Stock-Split) or decrease (Reverse-Split) the number of shares on the market by issuing a set number of shares for every share currently on the market.

As for Mergers & Acquisitions and Rights Offerings, we will not go into too much detail here because their impact on share price and close prices can be highly variable.

Say two companies announce they're seeking a merger. What will the market do in response?

Often it goes up, sometimes it drops, sometimes that initial rise is beaten down because more news comes out that regulators won't approve, or they'll have to do further restructurings, or shareholders become skeptical, or the terms don't look great. There are too many factors involved here to explore, so we leave these actions for merger arbitrage specialists.

Now that we have a better understanding of the items mentioned above, let's discuss how you can leverage this knowledge in your investing and trading strategies!

Considerations of Adjusted Close Price

Each of the actions outlined above will have an impact on the closing price going forward and backward in time. This is where adjusted closing prices come into play. The overwhelming majority of the time, adjusted closing price will be the better tool when it comes to evaluating performance over any given period of time.

To understand how adjustments to closing prices might affect you and why you would need to pay attention to them, we might first consider asking a few basic questions. There are certainly more questions that can be asked, but these are some good ones to get you thinking:

  1. How is the corporate action going to affect the price?
  2. Will this change affect my trading strategy?
  3. What is the impact to our backtesting data?

We could dive substantially deeper if needed, but these are normally going to be some of the best questions to ask yourself. So let's tackle these one at a time and discuss some of the impacts that each of these questions can carry.

1. How is the corporate action going to affect the price?

As we discussed above, there are several types of corporate actions that can be taken which have material impacts on share price. The most notable are dividend announcements, stock splits/reverse splits, and Rights Offerings.

These announcements will typically be listed on a proxy statement or in an SEC filing affectionately known as an 8-K. An 8-K filing is just a catch-all filing that publicly traded companies are required to file for material events.

Dividend announcements will have an effect on the stock price in a very tangible way. After a cash dividend is declared there will be an ex-dividend date, on the day of that ex-dividend date the stock price will reflect the dividend amount in its share price. So if the stock of company is trading at $30 and a dividend of $3 is announced, on that ex-dividend date the share price would be $3 less than the previous closing price.

You may be asking yourself "Why is the stock adjusted downwards? Aren't dividends supposed to be a good thing?" and that would be a great question because this certainly does seem counter-intuitive! The share price is adjusted downward because that money is technically no longer owned by the company, so the total amount of dividends to be paid is the value the company has "lost" or given to the shareholders and thus it that much less valuable.

Stock splits and reverse splits are common in the markets these days. Just look at this recent example of one of the biggest companies in the world, Apple (AAPL), undergoing a split in 2020:

In August 2020, Apple (AAPL) split its shares 4-for-1 to make them more accessible to a larger number of investors. Right before the split, each share was trading at around $540. After the split, the price per share at the market open was $135 (approximately $540 รท 4). Existing shareholders were also given four additional shares for each share owned, so an investor who owned 1,000 shares of AAPL pre-split would have 4,000 shares post-split. Apple's outstanding shares increased from 3.4 to approximately 13.6 billion shares, however, the market cap remained largely unchanged at $2 trillion.

  • A reverse split would be the exact opposite of this scenario. In this particular case the share price would have jumped to $2,160 (approximately $540 x 4) and the number of shares outstanding would been divided by four.

It is important to note that the actual value (market cap) of the company is not affected here even though the share price has changed drastically. The above example is an excellent illustration of why understanding this concept is so important. If you simply looked at the closing price the day after Apple's split, you could come to the massively erroneous conclusion that Apple lost a fourth of their value in a single trading day (similar to the mistake I made in my younger days). Obviously, that would not only be wrong, but would lead to significant errors when calculating Apple's price performance, returns, and especially any backtesting.

2. How will this change affect my trading strategy?

Once you know the action that is taking place and understand how it is going to impact the prices of your stock, you then need to take some time to determine if this upcoming change is going to affect whatever trading strategy you are implementing.

The answer could be a very simple "No." and if that is the case then there is no need for further analysis. However, there is a few things you may want to consider before shrugging this off and moving on the final question.

Normally, the announcement of stock-splits will only have an impact on your active trading strategies with regards to your indicators. If you have an algo trading on a price indicator, you would see a sudden 75% price reduction one day to the next in the Apple example. This could trigger stops, reversals, or other signals that are going to mess your finely tuned trading strategy up!

You can help to mitigate this by pulling fresh data daily.

Some traders - especially those running off of shudder Microsoft Excel - simply copy and paste their daily close into the next row of the spreadsheet and update their calculations. To get an accurate results, they need to go back and refresh their whole history. If you have an automated system that just pulls in the latest and appends it to a data base, you're going to be in the same boat as our Excel trader.

Dividends on the other hand a are a different story. On the day they are announced, the company declares a "record date" where they record all shareholders of the stock at that point in time. The ex-date is almost always the day before the record date, so as long as you own shares of that stock on the record date, you will be eligible to receive those dividends.

3. What is the impact to our backtesting data?

We know the corporate actions, we have assessed the impact to the share price, and determined if this will have an effect on our trading strategy. Now we need to know how our backtesting data has been affected and what we can do to address the changes to our adjusted close prices.

As we know, dividends and stock-splits can have a material impact on the share price from one day to the next. Because of this impact on share price, the closing price for that day, and all days before it, need to be adjusted as well to smooth out the historical prices. This is where we get our adjusted close price. This can have a massive impact on your backtesting if not accounted for correctly. Fortunately, most share price data pulled from places like Yahoo Finance will have all the historical data already adjusted for splits and dividends.

The importance of backtesting, how we do it, and why we do it is a topic that would take several articles to cover just by itself. But for now we will simply look at the implications that closing prices can have on our data and how it can affect our backtesting performance.

Below is chart depicting the difference between adjusted close and unadjusted close prices of Apple from 2000 to 2022. There are two lines on this graph representing Apple's share price. See if you can guess which line is the share price that is not adjusted for historical stock-splits.

aapl-adj-price-chart.png

If you guessed green (or just read the label), then congratulations, you are correct! The red line, or the adjusted close price, just looks a straight line when plotted alongside the unadjusted close price. That is because without the 5 stock-splits that Apple has done over the years the share price would be so high!

Imagine that you are backtesting a trading strategy and your data was not accounting for splits or dividends in the historical share price. Your historical price data would be royally skewed (pun intended) and your backtesting results would be unreliable!

Now lets say your strategy involves trading a stock which historically offers a dividend. This is important information! Knowing when the ex-date occurs could help you plan your trade entries and exits and help make you aware of upcoming prices changes. The price of the stock will drop by about the same value as the dividend, so buying a stock right before the ex-date shouldn't result in any profits (solely from the dividend adjustment). The same will happen with investors trying to buy on the ex-date after getting a "discount" for the dividend they will not receive. We discussed an example above, but lets review it one more time, because it is that important!

"... on the day of that ex-dividend date the stock price will reflect the dividend amount in its share price. So if the stock of company is trading at $30 and a dividend of $3 is announced, on that ex-dividend date the share price would be $3 less than the previous closing price."

This is huge! Assuming all else stayed the same, and the stock moved sideways at the same price for the rest of the day, all you would see is a 10% drop in share price! Obviously, the market does not sit still so this drop relative to the dividend amount may not be felt due to volatility or appreciation in the share price based on the sentiment that a dividend was being paid. But it is especially important information that you should be aware of, and I dont mean only when entering/exiting trades, but also when backtesting trading strategies.

What you do with those dividends can have a big impact on your algo's backtest. If you reinvest them, then your capital base is growing which may mean you've got to rebalance and increase your position size as your dividends compound over time. Other traders prefer to just pocket any dividends their algorithm may earn. If this is the case, it still should be reflected in your total return data.

Either way, you have some design decisions to make.

How Raposa can help Your Algorithmic Trading Game

Hopefully these examples help you visualize the importance of adjusted close prices, its impact on your backtesting results and why we should care about understanding them.

Here at Raposa, we try to take care of all this for you on the backend so you don't have to worry about any of this! We are constantly making sure that your data is adjusted, current, and ready for backtesting! If that sounds like something you want, come check us out at raposa.trade and let us know what you think and don't forget to check out some other posts on our blog!