buy - hold for 1 year - sell - repeat weekly

Hi there!

I need some assistance to create a simple simulation that :

  1. buys 1 stock provided in my custom universe (1 stock recommended every week)
  2. hold for 1 year this particular stock
  3. sell this holding (only)
  4. repeat every week.

The idea is to build the portfolio of virtually 52 recommendations over 52 weeks progressively.
My custom universe may recommend the same stock for a number of weeks. In this case I want to treat the recommendation independently of existing holdings, i.e. buy more of a stock if it is recommended, while still selling the portion bought 1 year ago (hope it makes sens…).
The liquidity in the portfolio comes from the initial cash and weekly sells. So originally each buy should be 1/52 of available original cash less cash reserve. Based on the results, I will adjust the cash reserve.

I thought I could do it by building a book with 52 simulations with lagging start dates, but I can’t have more than 10 sim in a book… That would be great is someone knows how to translate this in P123.

Cheers
Frederic

Servus Frederic!

In the position sizing tab, set % of Portfolio value to 1.92, this will allow up to 52 stocks into your portfolio.
As buy rule set RankPos<2, this will force the simulation to buy only one stock per week.
As sell rule set Nodays>251 AND Rank<101, this will sell the one holding after 52 weeks (approx. 250 trading days). You might have to play around a little with this last rule, because the number of trading days are not the same every year.

Have a look at this sim, but there might still be a few more tweaks to do…
https://www.portfolio123.com/port_summary.jsp?portid=1372526

Cheers,
Florian

Thanks Florian for the quick reply!
I will give it a shot and get back to this thread to celebrate successful implementation - hopefully :o)
Cheers
Frederic

Servus Florian,

Close but no cigar :o)

As you can see in your example sim, when the recommendation is the same from one week to the next the sim does not add to the position. Bummer.

I control the results by checking the sim transactions against the expected behaviour (which I defined by running a similar weekly rolling screen with 1 year holding period - each week produced in the rolling screen corresponds to my expected recommendation which I want to hold for 1 year independently of other recommendations).

In your example sim (starting 07/26/2013):

week#: screen output - sim transaction - check

week1: HIMX - HIMX BUY - ok
week2: SANM - SANM BUY - ok
week3: SANM - nothing - fail
week4: SANM - nothing - fail
week5: SANM - nothing - fail
week6: LEA - LEA BUY - ok
week7: PCMI - PCMI BUY - ok

The selling seems to happen on time (should be 366 days for Nodays as it works on calendar days ). I don’t know yet if it is selling the expected amount when a position has been increased over time.

Here is the corresponding screen: https://www.portfolio123.com/app/screen/summary/143812?mt=1

What kind of tweaking did you have in mind?
Cheers
Frederic

Hallo Frederic,

I fixed the Nodays number in the simulation, so with a few exceptions most holdings sell at 371 days.

The reason why the port never gets up to 52 holdings in a year, is that you can have two or three consecutive weeks with the same stock being the highest (Rank=1) in the ranking system. While this is the case, the sim cannot buy any new stock. I tried to get around this by creating the following rule:

Eval(Rank=RankPrev(1) AND Rank=RankPrev(0), RankPos=3, Eval(Rank=RankPrev(0), RankPos=2, RankPos=1))

It basically says, that when the rank position is the same as in the previous week or two weeks ago, the sim would buy the next lower ranked stock. Now imagine that you want to go to 52 holdings, you will have to create rules that in theory would eliminate up to 51 highest rank stocks.
The rankings change more quickly if you have a high-turnover system. Using the above buy rule, I can get up to 40% of holdings within a year with P123’s “Balanced 4” ranking system. If I use my own “7sisters Gourmet” ranking system, I get up to 60% of holdings into the portfolio within a year (see attached screen capture) - but still not the 100%.

If you only have one different stock each week as purchase candidate, then the rule RankPos<2 should suffice. If not, perhaps Marco or someone else in the forum has a better suggestion.

Cheers,
Florian


Merci beaucoup florian,
I will build on your suggestion unless someone has a better alternative - marco ?
Cheers
Frederic

There are basic problems that make it impossible to achieve perfection but you can work from this example.

https://www.portfolio123.com/performance.jsp?portid=1372770

You will have to fiddle with the buy rule a bit to get the optimal 52 week startup. I think it may be impossible to get one buy per week during the startup phase but you may get close. The other basic problem is it is pretty much impossible to stay in sync … one sell/one buy every week. The reason is that some stocks disappear or are bought up, or the cash on hand due to dividend payouts or selling a big gainer or loser causes either zero or two stocks to be bought.

The example uses the S&P 500 universe to minimize stock disappearances and also allows mergers…

You will have to override some buy/sells after you convert to a portfolio. And also delete the buy rule as SimWeeks may not be supported in a portfolio. I wouldn’t trust it in a port.

Steve


Nice ramp Steve,

Unfortunately, looking at the stock transaction list, I can see some gap weeks where no buy were triggered. In your example, the first gap week is between transaction 6 and 7 :

7 09/13/10 BUY INTC[5D][1Y] 106.0 $18.38 $-1,951.28 $-3.00 99.2
6 08/30/10 BUY LXK[5D][1Y] 54.0 $35.76 $-1,933.25 $-2.48 99.0

No transaction took effect on the 09/06/10 - this sim buy behaviour puzzles me…

This may be due again to repeat consecutive recommendations that do not increase the stake in an existing holding - but why would it be so?

Cheers
Frederic

As I said you have to play with the buy rule CashPct>=1.89*(52-SimWeeks). You may be able to find a constant (i.e. 1.89) that works with no gaps or double buys up to 52 weeks. But in the limited tests I did I wasn’t able to get ‘perfection’. There is a delicate balance between CashPct and position tolerance. You want a wide tolerance for after 52 weeks but a small tolerance for the first 52 weeks. Add in the complication of dividends paid out (unknown / uncontrollable) by stocks already held, mergers, etc and it becomes very difficult …

Steve

Thanks Steve
I will test calibrate this constant and my cash reserve.
Many Thanks again.
Frederic

Frederic,

The Sim approach that Steve suggested works well for testing the system. When you are ready to convert the Sim to a Port and start buying stocks if you don’t want to tie up at the start of the Port the full amount of cash necessary for buying 52 stocks you might consider this:

Change you Sim to a 1 stock Port and set the cash to 1/52 of your desired cash for the 52 stocks. Then each week revise the Port adding 1 stock and adding another 1/52 of the cash. Since (hopefully) the total market value will increase over the next year, you can adjust the cash you add to account for the change in value.