How to Reproduce a Strategy Backtest using the Screener

Describes the reasons why it backtests differs and to make them more similar

Simulations and backtests are very different tests. The results will almost never be identical, but one can force simulations to act very similarly to a screen backtest.

Screen backtests are built around baskets of stocks or ETFs that have passed the rules. It starts with $100 at the beginning of the first rebalance period and then puts an equal amount into each stock using partial shares. The amount will thus be exactly equal. If 10 stocks are returned, then it puts $10 into each. If the screen returns 10,000, then there will be $0.01 in each.

At the end of the first rebalance period, the value of the basket is determined and this becomes the initial value of the next rebalance period. This is continued for the duration of the test, and the initial and final values determine the statistics and annualized return.

Simulations are a holistic investing approach. They require both that the user determines a set number of holdings and a ranking system. The strategy tool will select the highest-ranking securities in the universe that are not already owned and that pass the buy rules.

Treatment of dividends are also different. Screen backtests adjust past prices for future dividends: You will buy the stocks at a lower price, and then the value will ratchet up with each dividend. This lets the screen reflect dividends without keeping track of holdings; screens are simply using what passes the rules at each rebalance without regard to what has passed before.

Simulations put cash dividends into the cash line. They are available for reinvestment at the next rebalancing.

Perhaps the largest difference, however, is that the simulations have separate sell rules. Many people make the mistake of not putting sell rules into the simulation, and this will cause the strategy to never sell (except if a stock leaves the universe).

To force the simulation and the screen backtest to give similar returns, use the following settings in the simulation:

  • On the General tab, set the transaction costs to zero and the Slippage to zero, or to a value matching that of the screen.

  • On the Rebalance tab, set Allow Immediate Buyback to Yes.

  • On the Universe & Ranking tab, set Force Positions into Universe to No.

  • On the Restrictions tab, set Allow Mergers to Yes and Load Global Restrictions to Yes. (These are rarely material, but the screen uses these settings by default.)

  • On the Sell Rule tab, use a single rule: True

    This will force the simulation to reevaluate its holdings at every rebalance, just like a screen.

There are a couple of things worth noting. First, except under some very specific circumstances the returns and statistics will never match exactly. This is because of the use of partial shares in the backtest and whole shares in the simulation, as well as the differing treatment of dividends.

Also, this question typically comes up while people are learning the site and checking the results of various tests. It bears consideration, though, that forcing the strategy tool to operate as the screen is generally not a good idea: The settings that you are changing are usually either a source of additional alpha or valuable downside protection.