introduction
The term backtesting is used generically to describe the process of testing the performance of a screener using data "back" in time. Stockworm screeners specifically offer the ability to test the buy and hold performance of any screener over an arbitrary set of dates. Our database contains more than 10 years of historical data, so you have a lot of flexibility in testing your screener over different phases of the market.
backtesting using stockworm screeners
So, let‘s specifically cover how you would backtest a stockworm screener:
- create a new screener or pick a stockworm screener.
- towards the bottom of the screener page, click “show“ next to “backtesting options“
- next to “use stock data from“ select the date you would like to run the screen (stockworm will ‘pretend‘ to run the screener on this past date)
- next to the “calculate gain through“, set the date through which you would like to calculate the gain
- run the screener (click on the ‘run‘ link in the bar above the screener form)
- the results from running the screener on the “from” date are shown, along with a gain table.
The backtesting settings are covered in detail in the manual.
So, a few points to note: first, when you backtest a screener, the analysis data will automatically be displayed for the “from“ date of the screen. The exception is the quote data above the thumbnails — this is always a delayed quote.
Next, you will note the gain table above the screener results. This shows the gain which would be achieved by purchasing equal parts of the screener results on the “from“ date and holding them through your selected “through“ date. The gains are computed using closing prices on both the “from“ and “through” date. For convenience, we also show how several market benchmarks would have performed over this same period.

Finally, it is important to remember that the screener backtesting includes all of the stocks returned from your screener. Let's consider a simple screener which first limits the results to small cap stocks and then sorts the results by ascending p/e. The backtest would be meaningless for this screener because it would represent a test of buying and holding ALL small cap stocks. To make the backtesting meaningful, you need to add a "keep stocks by list position" rule after the sort by p/e rule. This rule, as the name implies, allows you to keep, for example, the top 20 stocks returned by your screener. With this rule included, you would therefore be backtesting a buy and hold of the 20 lowest p/e stocks in the small cap universe (rather than unintentionally backtesting a buy and hold of all small cap stocks).
conclusions
Let‘s conclude by comparing screener backtesting to autoinvestor simulations. Screeners yield a list of stocks on a given date which best suit the given screener rules. Screener backtesting takes this list of stocks and holds them for a given period to yield a backtested return. Autoinvestor simulations, on the other hand, evaluate a simulated portfolio on every day of a simulation period to determine:
- which stocks in the portfolio should be held;
- which stocks in the portfolio should be sold; and
- what are the best stocks to buy to fill the portfolio
The autoinvestor simulation is therefore a more realistic test of how you would manage a real portfolio using stockworm autoinvestor strategies. These concepts will be covered in more detail in the follow-on posts.
|