Skip to content. | Skip to navigation

Personal tools
Sections
You are here: Home QuickStart Reference Guides The Backtest: All you need to know

The Backtest: All you need to know

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 pass 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 rebalance?

- 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.

Lets change the backtest to a monthly rebalance:

Now re-backtest the strategy:

Notice how the number of trades went from 1600 to 1000 thru 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 open of the day the stock was bought to the open 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 in which the backtest is 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 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 backest 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 optionswill allow you to compare the performance of the strategy versus the market only on days when the market is going up or going 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