buy-driven simulations

I finally figured out how to simulate a buy-driven rather than a sell-driven strategy.

Just to explain, I want to simulate a twenty-stock strategy that ALWAYS buys the top ten stocks and simultaneously sells the lowest-ranked remaining stocks, whether they’re ranked 11 or 111. If there are no new top ten stocks, then the strategy holds everything it has, no matter how low the ranking.

The way I can do this is to create two portfolios with the same ranking system and universe.

The first is a portfolio which I’ll call “top 10.” Rebalance weekly, allow holdings to be re-bought, transactions saved, fixed amount position sizing equivalent to about 1% of starting capital, force weekly ranks, force positions into universe. One buy rule: rankpos <= 10. One sell rule: nodays > 365.

The second I’ll call “top 20.” Again, allow holdings to be rebought at current rebalance. 5% ideal weight of new position, force weekly ranks, force positions into universe. One buy rule: portfolio(“top 10”) = true. One sell rule: 1 = 1. The start date should be slightly later than the start date for “top 10.”

The second portfolio is the one that simulates the strategy, and its results and transactions are what should be compared to the more conventional sell-driven strategy. This strategy is not perfect. There is weekly rebalancing, which can entail some expensive buy/sell difference transaction costs. And occasionally the strategy will swap out a 33rd-ranked stock for a 28th-ranked stock which was bought and sold months ago without there being a new top-ten stock to be bought. But anyway, it’s as close as I can get. If anyone has any better ideas, I’d love to hear them.

Hi Yuval,
what is the benefit of a system that buys a 28th-ranked stock instead of a top 10-ranked stock?

There isn’t one. Maybe I didn’t express myself clearly. The strategy is to ONLY buy top-10 ranked stocks. As soon as a new stock appears on the top-ten list, you buy it, simultaneously selling your worst-ranked stock. The second simulation does this, while a regular sim wouldn’t. A regular sim is sell driven. A regular sim would sell any stock ranked below 30, say, and then buy the top stock that wasn’t already held, but it could be ranked 15.

The second sim that I proposed just has one little problem, and that is if a stock was top-ten a few months ago and then was sold it might be bought again even though it’s no longer top ten if one of the held stocks ranks lower. This doesn’t happen very often, though.

  • Yuval

Useful for creating a strategy which creates optimal churn (i.e., maximizes return versus turnover cost).

I.e., If a stock in the top-ten ranking system falls to the top eleven, selling that stock likely creates more value for the broker than for the investor.

I played with this idea by trying to ask:

  1. What is my lost opportunity by NOT trading up a lower ranked stock for a higher ranked potential replacement?
  2. What is my all-inclusive turnover cost?
  3. What is my expected turnover any given ranked stock?

If lost opportunity cost exceeds turnover cost times annualized turnover, then drop the lower ranked stock and pickup the higher rank one. If this condition is not met, do nothing for optimal churn.

I eventually gave up on implementing this idea… not enough time.

The other big thing to consider, David, is timing. Let’s say you have a relatively low turnover model. A stock you’ve never looked at before shows up at #5 in your ranking because of a new quarterly earnings report. But none of the other stocks you hold have changed much in position–none of them satisfy your sell rule. So your port waits until it’s actually time to sell something. By that time, though, the new stock has gone up in price by 20%. My contention is that it’s better to buy a stock as soon as it shows up in your top ten than to wait a week or two. On the other hand, if a stock falls below the rankpos in your sell rule, is it that urgent to sell it right away? That’s why a buy-driven strategy seems to make more sense to me than a sell-driven one.

I’m not clear on how this is any different than rankpos > 10 as a sell rule.

Given your example of a new stock appearing in the number 5 position, that would mean the rankpos 10 stock you’re holding is now rankpos 11 (so it gets sold and the previous stock at rankpos 6 is now 7, etc).

Would be curious to see the response to his question as well.

I guess I’m not explaining this very well. If your sell rule is rankpos > 10 and your position size is 5% you will always have half your portfolio in cash. I don’t want half my portfolio in cash.

I want to hold twenty stocks and I want to buy them if and only if their rank is in the top ten, and as soon as they appear in the top ten, and then hold them until a new stock appears in the top ten. I can’t do that with the normal simulation rules. So I came up with a way to do that. This also improves my results, as I expected.

At the risk of repeating myself, the way simulations are now designed places priority on the sell rule. The only time a new stock is bought is when one is sold. I was trying to design a simulation that places the priority on a buy rule–the only time a held stock is sold is when a new one is bought. Yes, I could lower the sell threshold to accomplish this, but then I’m holding lots of cash.

I apologize for wasting everyone’s time if I’m the only one who sees any value in this. But this is the way I manage my real-life portfolio now, so I was very happy that I finally found a way to simulate it. And I thought I’d share that with the community on the chance that it might inspire other strategy designers.

I totally agree with you and have posted about this topic in the past. However, I have several additional buy rules and I don’t want to force positions into the universe. My question is: How difficult could it be to come up with a new buy rule that says always own the top ten stocks and sell the lowest ranked stock to get the money to buy? I think we need a “portfolio rank position” that ranks every holding against every other portfolio holding. Then you could buy buy saying Rank>Rank of PortRankPosition(10). Sells would be done when required to fund purchases starting with the lowest ranked position held.

Yuval, what you’re describing makes perfect sense to me, however I’m so new I don’t know enough about it to answer intelligently about how to do it. My thought was to create an intersection of the set of your portfolio and the top 10 rankings of the screen. If the intersection of that set is less than 10 the sell the lowest ranked in portfolio and replace with missing item(s) in the top 10. This would allow to run daily for timeliness, but possibly not generate as much turnover as other methods while still catching very high rankers.

Yuval, would it help you to put your rules into your universe?

Yes indeed. Unfortunately, there is no way to sell the lowest ranked position held the way simulations are currently set up without rebalancing every position. If there were, everything would be so much easier.

I don’t see how I could possibly do that. Basically, the rule would be “has been in the top 10 sometime in the last year.” And “Portfolio” can’t be used as a rule in a universe.