A question for P123 ranking developers

very interesting Georg, but how do you get p123 to check a different list (universe) every 52 weeks?

You have to keep the universe up to date; easy enough, by downloading USMV holdings periodically. I do it every 3 months.

Hi Georg:

I understand that would work on a going forward basis, but if you had to test, how would you ensure a changing universe?

That is the part i am struggling with

thanks!

If you have the historical holdings you can make various lists. Then make a universe that uses eval rules for year (and maybe month) to reference a specific list. I have done this before with the #1 Zack Ranks. A bit tedious.

eval(year=2012 and month=1,inlist(“Zacks201201”),na) OR
eval(year=2012 and month=2,inlist(“Zacks201202”),na) OR
And so on…

Kurtis,

Thanks for this method.

I looked at Zacks Rank also but I downloaded the list each week and paper-traded.

As you said, it is “a bit tedious” so maybe I did not try it long enough. But anyway, my short anecdotal results did not suggest that Zacks Rank offers any significant benefit over what can be done at P123 without Zacks Rank.

Would be interested in anyone else’s experience.

Thanks.

-Jim

This was for a client. Doing the method described I was able to backtest monthly Zacks #1 ranks since 2012 until today. I ran my own ranking system across it to see if I could enhance the Zacks #1 ranks. What worked the best was just removing the Zacks #1 ranks altogether and running my ranking system on an All Fundamentals universe. I did not see any benefit what-so-ever in Zacks ranking method.

Hi Kurtis/P123, this eval does not seem to work for me… Just putting in an inlist does

Inlist alone works, but it is not point-in-time to a date prior to when the inlist is applicable.
I used portbars to specify when an inlist should be used. This requires for the sim always to start at the same date.

We made inlists of the holdings every 3 months. Then you make a universe that holds all the inlists and future inlist which are empty at this time.
You start the sim on a specific date and in the buy rules use portbars to call up the specific inlist applicable to the time period of that inlist. That gives you a PIT simulation as it will only select stocks from the currently active inlist. Going forward you need to fill the predefined inlists every three months and also run a total on the universe so it updates.

The only inconsistency is that your universe gets bigger all the time because it will hold all the stocks dropped from USMV over time. But USMV has a turnover of only 27% so that’s not a big problem. Of course you can also remove the redundant stocks from the universe as you update every 3 months.

Marc:

Thanks a lot for your answer.

Yuval:

I assume that if you prefer to set the rebalance to “one week” your systems must have a lot of technical rules, if not, I do not understand how it is possible for the stock to develop their potential based on fundamental data, since fundamentals need a “maturity time”… or at least it is how I understand that…

Maybe I am wrong?

Sounds real nice. But how does that work exactly?

I guess you and I, along with Marc, realize a stock is undervalued and we (along with everyone else who recognizes this) just sit around for a few weeks before we buy the stock. We have all the time in the world—no one wants to get in early while the stock is most undervalued.

Seems like most of the change in price (and buying) would occur early: when the stocks are most underpriced. But that is just my story.

We can sit in our arm chairs and decide how it should be, or how it was “back in the day.”. Maybe we use a rule-of thumb that someone else gave us (just don’t call it a wive’s tale). Or we can do a little investigation and see what has been happening in the real world.

Whatever you say about Yuval’s techniques, one has to agree that he looks at the historical evidence very closely (a good thing). He is sitting up looking at an Excel spreadsheet or a P123 generated equity curve—not reclining while deciding how it “should be.”

-Jim

So back to the original question … I think you should look at how you want your final trading system to work. As in, are you on a mission to design something with the highest CAGR irrespective of turnover? Or maybe you want something simple that you only have to make a few trades a month? Do you want something with high sharpe over high gain or a modest mix of both? I try to think about the product I’m trying to produce and start my ranking off with a rebalance period that reflects that. You can also do multi time period tests to create systems from different date ranges. This is a great way to find similarities and differences in what factor combinations were effective in that PIT market environment. If you’ve never done this then you’d be surprised at what worked in the early 2000’s vs what’s worked in the last 5yrs (Maybe the same but likely different). A good ranking system is certainly a lot of work in my experience and I’m always learning the tricks to the trade.

I don’t use technical rules much at all. But every time a new quarterly report comes out, the financials change, and I like to jump on those. Also, when a stock’s price goes up or down, all the value ratios will change. And then there are sentiment measures, which can change quite rapidly too.

For small caps and microcaps, it can be more profitable to invest short-term (several months) than long-term (a year or two), in my limited experience. For large caps, long-term may be the way to go.

If you use fundamental data, why wouldn’t you want to make a decision on a change ASAP? For each individual company, most of those changes may only occur quarterly, but those changes will be at different points in times for each company.

An earnings report doesn’t need “maturity time”. The market reaction can be immediate, even preemptive.

These are all just rules of thumb (including my contribution).

What you are wanting to do is trade when the following is true:

Future return of new stock not in your sim/port (while you will be holding it) - Future return of a stock already in your sim/port (were you to continue to hold it) > Trading costs (trading old stock for new stock). Simple as that.

This does assume that the future holding periods will be the same for the “old” and "new "stocks (e.g., over the next rebalance period). It gets too complex for me if I have to consider that a newly purchased stock may be held longer by my model (e.g., over multiple rebalance periods) than one I already hold. And I am not sure this is the case anyway.

If you had a very accurate ranking system (that could truly tell the difference between RankPos 1 and RankPos 2), no trading costs and perhaps an AI to monitor things it would be rational to continuously trade throughout the day—something none of us have.

Of course, we are talking about the future so we are forced to deal with Expected Returns which we can only approximate. Obviously, each port will be different. For example, micro-caps will have a higher trading cost. But a micro-cap stock may have a greater expected return after an announcement, earnings estimate revision, recent price change or whatever factors are in your model. But that is all factored into the above equation.

Fortunately, P123 has included trading costs in its simulations so a sim accounts for all of this. The beauty of P123.

Ultimately, Marc has pretty good advice. He says you can use the sim (at least to some extent) to determine the frequency of trading if there are rational reasons to do so. Yuval and Randy provide some very rational reasons to consider frequent trading for some ports.

-Jim

I was really struck by this comment. For some reason the very simple and true equation that Jim posits here had never occurred to me before.

But what occurred to me a couple of hours later was the following. A sim does NOT account for all of this. The returns of a simulation if it is even ever-so-slightly optimized will never match the out-of-sample returns of a strategy. But the trading costs will.

In other words, if you estimate that the return per trade of your simulation will be, say, double your actual return per trade, then double your estimated trading costs in your simulation. Or use some other proportionate method.

Just thinking out loud here . . . But I think it’s a suggestion worth thinking about. It might lead users like me to better take into account the high cost of frequent trading.

Yuval,

Do you still think BID/ASK spread data could be useful for slippage estimates? Meaning do you think the data is good, the programmers think it is practical, that everyone at P123 likes it still etc?

Keep in mind that I am not urging P123 to implement this. I am generally happy with the present method and I leave it to P123 to set the priorities.

Plus, I think the present slippage estimates are already about twice what one can get on just a moderately sized market order with a good broker. That is not a bad thing. Maybe a very good thing for my over-optimized ports, as you point out.

But in the context of this discussion, I was thinking that the option of putting a user defined factor on the BID/ASK spread estimate of slippage could be useful when (if) the idea is being considered for implementation.

It could be useful for the reason you describe above.

I think it could also be useful because the BID/ASK spreads change during the day–narrowing considerably at the close. Close BID/ASK spread data should probably be doubled for trades at 10:00 AM—or I would use a factor of 2 if I could.

Anyway, just something for discussion while we are on the subject.

-Jim

(I’m going to be using “transaction costs” and “slippage” as synonymous in my reply, even though they may not be.)

Transaction costs depend on so many things: the bid-ask spread, the type of order, the size of the order, the total volume of shares being traded. The bid-ask spread is going to affect fills with limit orders a lot less than fills with market orders, and a lot depends on how you place your limit orders and whether you adjust them during the day and how you count the contribution of an unfilled order to your slippage cost. And VWAP is a whole other thing. I have confidence in the bid-ask spreads that we get, but you’re right, they are closing bid-ask spreads and are therefore going to be significantly lower than those from early in the day. If you’re using market orders, you’ll probably be paying the entire spread for each order, but if you’re clever about placing limit orders, you might be able to evade the spread much of the time (unless you’re buying extremely illiquid securities). And the market impact related to order size is a major factor that’s also hard to estimate. There are simply so many variables at work that estimating accurate slippage for a host of different users placing different types of orders at different sizes is pretty much impossible. P123’s variable slippage is a valiant attempt, and better than anything else I’ve seen–but I haven’t seen much.

I am hoping that at some point it’ll be possible for users to create their own formulas for variable slippage. Until then, if you have your own formula you’d like to implement, here’s what I suggest.

Create a screen with your universe and your ranking system.

Then put in the rules:

Rank > 97

ShowVar(@slippage, )

If you’re using formula weights in your simulation, the next line should be

ShowVar(@weightedslippage, @slippage*)

If your formula weight could conceivably spit out negative numbers, the next line should be

@weightedslippage > 0

The last line will be, if you’re using formula weights,

ShowVar(@avgslippage, Aggregate (“@weightedslippage”,#previous)/Aggregate(“”,#previous))

When you run the screen you’ll see the slippage amount in the column @avgslippage. Put that into your simulation.

If you’re not using formula weights, you can skip a lot of this and just use

ShowVar(@avgslippage, Aggregate (“@slippage”,#previous)

as the last line.

This is more cumbersome than just guessing what your slippage is or using the default variable slippage. I have developed complicated formulae for measuring transaction costs, and I think it’s important for me to do so since I sometimes buy more of a stock than its average daily dollar volume.

Yuval,

Very cool. I have done this type of thing to calculate “market impact” before. And you are right BID/ASK spread, market impact and a bunch of other things all get mixed together into “slippage.”

Doing this with BID/ASK spread (with additional market impact calculations if I want) is something I had not considered.

This technique, variable slippage in the sims and even entering a high fixed number into sim all work well for me now.

Thanks.

-Jim

Every time I ask something here the answers are bigger than my initial doubt and open a huge variety of possibilities.

Thanks to all of you.

I think the obvious, straightforward principle that appears to be implied – but unsaid in this thread – one that maybe you are not realizing is that the rebalance period has nothing to do with the holding period. My strategies always rebalance every week – because I want them to make the appropriate buy or sell to a position when it is the optimum time to make that change.

However, while my rebalance period is always one week, my average holding time for positions is about 3-4 months. You are right that the fundamentals of an undervalued stock might need to improve in the direction your model is assessing to be likely, but, for example; for Position 1 that change may occur next week, while for Position 2, it might not happen for six months. You want to be assessing each position and conditions as often as possible. That active assessment has nothing to do with hold-time.

The economy, the market as a whole, the different sectors and segments of the market, and the fundamental data for all 9,733 stocks and 2,172 ETFs currently in the P123 database changes EVERY DAY (P123 updates fundamentals weekly). Don’t you want to assess that data when the “iron is hot,” and make the appropriate change to your portfolio when it is the optimum time? Your holding time can be one month, three months, one year, or 10 years for that matter!

TLDR; Rebalance period and holding period are entirely unrelated.