Backtest Features

Open the Next Generation: Piotroski Score Stock Screener and backtest the strategy

This strategy only allows 10 stocks at a time because we indicated the maximum number of holdings in the "max_holdings" tab.

The Backtest will buy all stocks that pass the strategy on the start date of the backtest. In the case above, that date is Jun 1, 2003.

The backtest, by default, rebalances every Tuesday. What does it do when it rebalances?

- When the backtest rebalances, it checks to see whether the stocks that passed since the previous rebalance still pass the strategy, and it also checks to see if any new stocks pass the strategy. It sells the stocks that no longer pass and buys the stocks that recently passed the strategy.  It also gives equal portfolio weight to each stock in the strategy at each rebalance.

What if you want to change when it rebalances?

- Create a Tab Called "rebalance" and specify when or how often You want it to rebalance.

- Putting True inside of the tab will make the backtest rebalance daily, and putting False inside the tab will make the backtest never rebalance.

Let's change the backtest to a monthly rebalance:

Now re-backtest the strategy:

Notice how the number of trades went from 1600 to 1000 over 10 years.

The green line represents the strategy based on buying and selling the stocks that pass the Next Generation: Piotroski Score stock screener. Notice how it starts at $100 and goes up or down from there. If, at any point, the green line reaches 200, that means your strategy has made a 100% return on that date.

Click on Screener to view the annualized and total returns of the strategy:

How are returns calculated?

- The returns are calculated per stock based on the opening of the day the stock was bought to the opening of the day the stock was sold. Then that return for the particular stock, while it was held in the backtest, is added to the total return of your strategy.

What stocks passed the strategy at a certain point in the backtest?

- Click on any point in the backtest, and you can select view results as of Month Day, Year.

How do I change the dates on the backtest I run?

There are two ways to change the dates.

- Use the date chooser or type the dates in manually.

- Scroll up on the graph to zoom in on specific dates, then you can click on the graph and drag it to move horizontally.

Plot the average of a property of the stocks in the backtest on a particular date.

- Switch to the Tools Tab and drag the property PE to "Show in Results."

Now Re-Backtest and notice how the average PE of the stocks that were in the backtest for any particular date is now plotted on the graph.

Backtest Breakdown

The backtest breakdown shows you the performance of a strategy in each particular year. If you zoom in on the chart, you can view performance on each particular month and day in the past. 

In the upper right-hand corner of the graph, there is an option to "show all days," "show only bullish days," "show only bearish days," and "show random days." Selecting any of those options will allow you to compare the strategy's performance versus the market only on days when the market is going up or down or a random set of days.

Backtest Table

The Backtest Table displays the value of every line in the backtest for every single date in the backtest.

Click on the Excel Export Icon.