Custom universe sell rule

Evening from Spain everyone!

I have a live strategy with a selfmade universe and ranking and I have the following buy and sell rules:
BUY: seccount<7
SELL Rank < 85 AND NoDays > 23

I want the stocks to leave the portfolio if 4 weeks have passed but I recently found they can leave early if they leave the universe. How can I keep them for 4 weeks even if they leave the universe??
I have tried forcing stocks into the universe and using the Universe(uname) function in Sell options but it doesn’t accept custom universes

Thanks everyone!

The Universe & Ranking tab has a setting called ‘Force Positions into Universe’. Setting that to Yes will prevent them from being sold because they have left the universe. If they are still being sold before they were held for 23 days, then there must be some other reason. For example, pending mergers or stop loss rules.

“Force Positions into Universe” prevents the stock from leaving the portfolio if they fall out of the universe after 4 weeks.

Can you try ‘Force Positions into Universe’ set to Yes and add the Buy rule: LastSellDaysLT(7)=FALSE

Not sure it will work. The LastSellDaysLT function looks for past transactions, but it should also look at the current rebalance.

Let us know. Thanks

No... it didn't work...

Why can we use custome universes in the Universe("name") rule?

Let me put some context..

I have a system with a universe defined and a ranking.
My intention is to rebalance on every week, but only to sell those positions that have been at least one month in the portfolio.

So first question here: Does anyone know how to keep in the portfolio stocks that are not longer in the universe? with the rule Rank< X, the positions are sold due to NoRank. If I put the filters of the universe in the selling rules, the ranking is disorted because the unviverse is much bigger.

any ideas?

thanks!

The solution I gave early does what you are asking. I did a test to verify it is working. Here are the steps and the results:

The Universe in the live strategy is the SP500.
'Force Positions into Universe' is set to Yes.

I change the universe to Sp600 small caps. Now every stock this strategy holds is no longer in the universe.
I rebalance the strategy.
No stocks are sold due to 'No Rank' (because Force Positions into Universe=Yes).
Only 2 stocks are sold because their rank is too low. They are:
PAY held 293 days
ETR held 1 day

I exit the rebalance page and change the sell rule from: Rank < 60
To: Rank < 60 and NoDays > 28
Now it wont sell unless the stock was held at least 28 days (4 weeks).

Rebalance again. Now only PAYX is a sell. ETR is not sold because it doesn’t pass the "NoDays > 28" part of the sell rule.

Do you want it to behave differently then what I described above?

If you have a strategy that is setup with 'Force Positions into Universe' = Yes and the sell rule like Ranky that is not working this way, please send me the name of the strategy and I will take a look at it.

Hi Danp,

First, thank you very much for your support!

I think we've got a solution. Not perfect, but a solution.

If we do only as you say, the stocks that are no longer in the "universe" but are forced to the universe do not have rank. Therefore, the "Rank < X " rule will not work, and these stocks may remain forever.

We needed to put the universe rules in the sell rules, with "and Nodays > 27". This way, stocks forced to the universe can leave the portfolio.

It is not perfect, because as we force some stocks to be included in the universe, ranking varies... It works because this portfolio is small (20 Pos) and the impact of some stocks being forced is meaningless, but with larger portfolios the differences are higher.

Nevertheless, a Universe(X) filter with our own universes would be a great improvement.

Thank you all. I'll be back if something doesnt work as expected!

EDIT: Read below, the problem was different. My fault!

I cant reproduce this behavior. Maybe there is some other setting in your live strategy that is causing the issue and I am interested to see what it could be. If you tell me the name of the strategy, then I can look into this further.

In the test I mentioned earlier, I changed the universe from the sp500 to the sp600 so none of the holdings in this live strategy are in the current universe. The sell rule in my first test was Rank < 60 and NoDays > 50. It was selling 1 stock based on rank.

Today I changed the sell rule to Rank < 99 and NoDays > 50. Now the Rebalance page shows it is selling 9 of the 12 holdings and clearly shows that it is selling them based on the rank and it shows the rank for each stock (none are 'No Rank'). There are 3 positions it is still holding. Two have rank > 90 and the other has not been held for 50 days.

mmmmmm You are right. I'm mixing topics. Sorry, too many changes until I found a solution. I understand your point.

The problem wasn't that the stocks forced to be in the universe won't have a rank. The problem was that these stocks won't leave the portfolio because we forced them to be in the universe, so with a high rank, they will remain, although we only want to keep them 28days as max.

In order to sell them after 28 days, we had to include the rules that filtered them out of the universe in the "Sell Rules". That was it. My fault.

The system is https://www.portfolio123.com/port_summary.jsp?portid=1676754 . name: NV - SC NG Following

Thanks!