How To Use Monte Carlo With The Piotroski Score
How to analyze a factor without ranking in Equities Lab
Create a screen
Everything starts with creating a screen. So, onward!
Name your screen
Screeners with names can be found later. If you want to put your screens into categories, simply put MyCoolCategory: at the front.
Limit your stocks
You can type “Market Cap > 500m” here. You could alternatively type “mc > 500m”, keying on the capital letters. Or you could type “>”, hit return and fill in both boxes, one with MarketCap and the other with 500m. Of course your assignment has you using a different cutoff, but that’s your problem 🙂
Add a new line
You can add lines by doing any of the following:
1. clicking on that green plus
2. Typing a semicolon
3. Select the “>”, type “and” and hitting return. This actually wraps whatever condition you type with an AND, but that gets the job done.
Get rid of foreign ADRs
Use the “not” operator negate a condition — here the condition of being an ADR. Check out the tools menu to find the condition you are looking for. For fun, try searching for “reit” in the tools menu. Where’s the tools menu? In the lower left corner of the window (green arrow).
Create yet another line
You do remember how to do this? If not, look back two slides.
Get rid of financials
Piotroski score doesn’t work well on banks, so they have to go. The “classify” operator is your friend here.
Create yet another line
Create a line using a method you haven’t used yet. This new line is going to get the piotroski condition. If you were doing a rank_across to measure deciles, you’d bundle the lines above into a variable, and perhaps you’d call it restrictions. But you aren’t, so you don’t.
Compare using “=”
You want to divide each band of stocks into Piotroski score segments. So, you’ll check to find all stocks with a given piotroski score. You’ll notice that if you use a condition that insists that stock make money last quarter, there will be very few Piotroski score 0 stocks. Why is left as an question for you. Make sure you can answer it ;-).
Find Piotroski using the tools menu
The process for using the tools menu is now emblazoned on your mind in letters of fire (green arrow first, blue arrow second, click where the red box is).
Fill that second box with monte
You could backtest 10 times, and save off the monthly returns for each series, and compose those. If you did, that would be a longer assignment, especially since you need to do that for earnings yield. So, will you? Nah — use monte carlo instead. That will do all the backtests, and put them all on the same table for you. You are going to choose monte_range (monte from x to y).
Go from 0 to 9 step 1
We want to see Piotroski 0, and we don’t want to see Piotroski 10 (why not?). So, just click on the numbers and change ’em.
The backtest button is next to the “go” button.
This will take a minute or two.
After you click the “run button” of course. You’ll want to change the dates to match the desired range (green arrows).
We only got five lines!?!
You will notice that there are only five liens. You need to set a magic variable “whic_montes” to “max of -1 1” to get all the lines. Create a new line.
Create a condition
You want this condition to be always true, but have “which_montes” in it. Unfortunately you need somewhere to put it, hence the need for a new condition which is always true. Of course you could just use a new tab instead (new tab button pointed to by the green arrow or CTRL T).
Name the left side “which_montes”
Use the menu to name the line, or use the single quote key to do the same thing.
The backtest can be accessed by CTRL B, or by the button which is still by the go button.
If it takes too long, you can put the task in the background.
Or you can just wait……
The manager’s report will give you monthly returns. Try clicking on all the tabs at the bottom. With a monte-carlo, the green shaded tabs won’t have results, but the others all have interesting info. If there is no monte carlo, the green shaded tabs go into detail about all the trades.
View the massive table
The monthly returns are sorted vertically by date, and horizontally by Piotroski score. If you need to export to Excel, use the “export” button (green arrow).
Change the dates if need be
Try clicking elsewhere to see what happens.