/media/kzclnkaj/connecting-the-dots-in-investments.jpg

How to back test your investment strategy - Real world example

Investing without backtesting is like sailing without a compass. Learn how to navigate the stock market with precision by backtesting your investment strategy. Ready to chart a more reliable course with this backtesting tool?

The Quant Investing stock screener also lets you back test your investment strategy using point in time data. It allows you to look into the past (using the exact historical company and market data) and see exactly what stocks your strategy would have selected and what the returns would have been. 

This article shows you exactly how to do back tests with a real world example.

 

Make sure you download the spreadsheet

Important - You can download a spreadsheet that shows you all of the back test data and calculations – it’s at the bottom of the article. 👇

 

 

Back test of the Magic Formula + Momentum investment strategy

This article shows you a back test of the Magic Formula combined with momentum (Price Index 6 months) investment strategy in Europe over the four-year period from January 2016 to December 2019.

It is a further back testing of this investment strategy: Magic Formula investing & Price Index 6m momentum investment strategy

If you have not used the stock screener before, this article shows you exactly how to get started: Quant Investing Screener Quick Start Guide

Back test data is available from 4 December 2015. 

 

Exact Back Test Screener Settings

Here are the details of the back tested investment strategy:

  • Countries - 17 Eurozone countries (Austria, Belgium, Cyprus, Estonia, Finland, France, Germany, Greece, Ireland, Italy, Luxembourg, Malta, the Netherlands, Portugal, Slovakia, Slovenia, and Spain)
  • Exclude banks, insurance companies, investment funds, certain holding companies, and REITS
  • Exclude companies with an average 30-day trading volume of less than €10,000
  • Portfolios formed on the first trading day of the year (Because the back test database is point-in-time, there is no risk of look-ahead bias)
  • Returns were compounded on an annual basis
  • First select the 20% best-ranked Magic Formula companies
  • Secondly sort the list by Price Index 6 months from high to low
  • Buy the top 50 companies by Price Index 6 months on an equal-weight basis
  • Rebalance after one year

 

This is what the screen looks like.

Magic Formula back test Europe 1

 

How to Screen the Past - Backtesting

This is how you set up a back test.

I expand on all the points below but here are the steps if you know the screener:

  1. Login  and go to the screener
  2. Set up or load a screen
  3. Click on the Historical Screener icon
  4. Select the date in the past from where you want the screener results
  5. Select the future closing price date to where you want to calculate returns
  6. Click Confirm to get the historical screener results

 

Detailed Back Test Steps

Here are the detailed steps to back test your strategy.

 

1. Login and Set up or load a saved screen

For instructions on exactly how to log in and set up a screen, look at this article: How to run your first screen with the Quant Investing screener

 

2. Get historical results of your screen

Set up the stock screen you want to back test, so you have a list of companies that currently fit your screening criteria. You are now ready to go back in time.

To do this, click on the Historical Screener icon to open the Historical Screener date selector.

Quant Investing back test 1

 

A window will then open where you can select two dates.

The first date is the date in the past you want the screener to run and give you investment ideas. The closing stock prices on this date will automatically be added.

You can also (you do not have to) select a second closing price date.

 

Adding a second date

If you add a second date, the Screener will automatically calculate the stock price percentage change from the first date to the second closing price date.

For example, if you run the historical screener on 4 January 2016 and enter 30 June 2016 as the second date, the screener calculates the stock price return from 4 January 2016 to 30 June 2016 for you.

This makes it easy to see how your investment strategy has performed.

 

To select the past date you would like to screen for, click the top date selector icon.

Quant Investing back test 2

 

To select a date, you can either click the blue left arrow or click on the date heading as shown below.

Quant Investing back test 3

 

Next, select a second closing date.

The Historical Screener will calculate returns from the above selected screener date to this date.

Quant Investing back test 4

 

After selecting the date, click the Confirm button to start the historical screen.

Quant Investing back test 5

 

That is all you have to do to back test or screen stocks to get past results.

 

Run this back test yourself

Your free demo includes the historical screener used in this article. Load the Magic Formula ranking, add the Price Index 6 months filter, pick a date in the past, and see which stocks the strategy would have bought and how they did. The demo runs on data from a year ago, so the newest list you see is the stocks the strategy would have picked twelve months ago.

Back test the Magic Formula screen

No credit card needed. Cancels automatically after 30 days.

 

 

If there is "No Data"

As you saw, you can only select weekdays. However, the day you selected was a market holiday (this happens a lot around year-end) with no stock prices.

If it was a market holiday, you will see a "No data" message like this:

Quant Investing back test 6

 

If you get the No data message, simply select a weekday before or after the date you selected until you get a result. The day you selected was most likely a market holiday. This happens a lot around year-end. 

 

What were the returns of your back test?

The results of your back test will look like this (number explanation below):

Click image to enlarge

 

  1. Shows you which saved screen you are back testing
  2. Shows you the date you are back testing (companies that fit your screen on that date)
  3. Shows you the saved Template you are using. A Template is a saved collection of columns displayed with a screen.
  4. The closing price on the date you are back testing. The date shown in 2.
  5. The second closing price date you selected.
  6. The percentage change from the closing price in 2 to the closing price in 5.

 

If the returns look unusual

We have done a lot of work to make sure the data is reliable. But as you can imagine, with more than 22,000 companies over so many years, something can go wrong.

So, if the returns of companies in your back test look unusual, -100% or no return, for example. Please check to see that it is correct. 

 

Export to Excel for more calculations

If you want to calculate more return numbers, remember you can export the above results to Microsoft Excel (download the spreadsheet template below to help you).

To export to Excel, just click on the Export Data to MS Excel icon.

Quant Investing back test 8

 

 

The Magic Formula momentum back test results

Getting back to how the Magic Formula Momentum investment strategy performed.

Here are the summarised results:

From To Strategy return Market return Out / (under) performance
4 Jan 2016 3 Jan 2017 19.5% 10.9% 8.6%
5 Jan 2017 3 Jan 2018 26.8% 13.7% 13.1%
5 Jan 2018 2 Jan 2019 -26.0% -12.4% -13.6%
4 Jan 2019 16 Dec 2019 15.4% 23.9% -8.5%
CAGR* 6.7% 8.2%  
Standard deviation 20.6% 13.3%  
Growth of €100 €129 €137  

* CAGR: compound annual growth rate.

 

You can see the strategy performed well in 2016 and 2017 but did not beat the market (EURO STOXX® Index) on a CAGR basis.

This was mainly because of the 2018 loss of 26%.

This is general information, not personalised advice. Past performance is no guarantee of future results, prices fluctuate and you can lose money.

 

 

Here is your back test spreadsheet - Free Download

Click on the link below to download the spreadsheet with the Magic Formula Europe investment strategy back test:

Magic Formula Europe Back Test Spreadsheet 

 

That is how easy it is for you to back test your investment strategy.

 

Forward-test the Magic Formula yourself in five minutes

The demo gives you the same Magic Formula ranking this back test used, on data from a year ago. Sort the Eurozone by it, add Price Index 6 months for the momentum version, and note the 50 names at the top, the stocks the strategy would have picked twelve months ago. Look up today's prices on any five of them and you have run a real one-year forward test of the strategy, no back-test software needed.

Forward-test the strategy now

No credit card needed. Cancels automatically after 30 days.

Already convinced? Skip the demo and subscribe direct. 100% money-back guarantee for the first 30 days. See subscription options →

 

 

Frequently Asked Questions About Back Testing Your Investment Strategy

What is back testing, and why is it important for my investment strategy?

Back testing is the process of evaluating an investment strategy using historical data to see how it would have performed in the past, in all market conditions. It helps you understand the effectiveness of a strategy before you commit real money. It allows you to refine and improve your approach based on actual past market performance.


How do I set up a back test in the Quant Investing stock screener?

To set up a back test:

  • Log in to the Quant Investing screener.
  • Load or create your desired screen.
  • Click on the Historical Screener icon.
  • Select the start date for your back test.
  • Optionally, select an end date to calculate returns over a specific period.
  • Click Confirm to see the historical screener results.

 

What data can I use to backtest my strategy?

The Quant Investing stock screener uses point-in-time data, ensuring that there is no look-ahead bias. You can select historical dates to see which companies met your screening criteria at that time and calculate their subsequent performance.

 

What settings should I use for a back test of the Magic Formula Momentum strategy?

For the Magic Formula Momentum strategy, use the following settings:

  • Countries: Select the countries you want to test.
  • Exclude banks, insurance companies, investment funds, certain holding companies, and REITs.
  • Exclude companies with an average 30-day trading volume of less than €10,000.
  • Select the top 20% Magic Formula companies and sort by 6-month Price Index, buying the top 50.
  • Form portfolios on the first trading day of the year.
  • Rebalance annually.

 

How do I interpret the results of my back test?

After running the back test, the results will show the companies that fit your criteria on the selected dates, along with their closing prices and the percentage change over the period you selected. This lets you find out how well your strategy would have performed. Look for consistent returns and avoid strategies with high volatility or frequent large losses.

 

What should I do if my back test results show "No Data"?

If you see a "No Data" message, it means the selected date was a market holiday or there was no trading data available. Simply choose a weekday before or after the selected date until you get valid data.

 

Can I export my back test results for further analysis?

Yes, you can export your back test results to Excel for more detailed analysis. Click on the "Export Data to MS Excel" icon in the screener, and you can perform additional calculations or create custom reports to further evaluate your strategy's performance.