My Buy and Sell Rules

Very interesting post, thank you!

I often think that we should rely more on the ranking and less on the buy rules.
Buy rules like these:

MaxCorrel(40,1) < 0.3 SecWeight < 25 makes sense to me, but buy rules like these:

MktCap > 50 & MktCap < 1000 PctDev(60,5) < 0.2 & PctAvg(20,5) > 2 sound like… laziness!

I will try to be more clear: parameters like SecWeight or MaxCorrel make sense only in a portfolio, they are not stock factors, and cannot be used in a ranking.
But parameters like MktCap and PctDev could be used in a ranking system. And I think they should, because it doesn’t make any sense to buy XXX because MktCap=51 instead of YYY that has a higher ranking just because MktCap=50.

I think that all the stock factors should be in the ranking, not in the buy rules.
For example instead of this buy rule:

MktCap > 50 & MktCap < 1000 we should use this formula in the ranking:

eval(MktCap<30,0,eval(MktCap<100,(MktCap-70)/70,eval(MktCap<800,1,eval(MktCap<1400,(1400-MktCap)/600,0)))) I once tried to move these parameters from the buy/sell rules into the ranking, I failed at the first attempt, and the laziness toke over.
Has anybody ever tried?
Do you think is worth trying?

Stefano

Stefano,

Yes, all the stock factors could be added to the Ranking Systems, IF, you want to develop a private one or one that works for only a small part of the community.

The Ranking Systems rank all the stocks, and each individual can or will only buy a select range of stocks that meet his/her investing style. Many factors like MktCap, Price, AvgVol, AvgDailyTot, etc, need to be selected with respect to what each member is comfortable with and can or should buy.

It is VERY time consuming to develop a new Ranking System that meets personal goals and have that system even come close to the performance of many of the public systems. I think that the time is better spent testing new factors added to existing systems that might improve a system’s performance, and time spent optimizing the weightings of a system’s factors.

It takes enough time for me to develop good, well thought out Buy and Sell Rules that meet my needs.
I am using 8 different Ranking Systems. I can’t imagine the time it would take to add those factors to 8 ranking Systems and get them to perform nearly as well as my Sims do now. It is just far easier and faster (lazy? OK, I’ll go with lazy) to develop personal Sims than personal Ranking Systems.

Denny :sunglasses:

I found that some of Denny’s sell rules in a port which I run using the TF-12 excellent ranking system could be replaced with some much simpler rules that yield >10% better annual return. There’s a 100% increase in turnover as well, but the port only holds 7 stocks.

Old Sell Rules:

Rank < 99 & nodays>20
GainPct< -20
PctFromHi < -15 & Rank < 99.

New Sell Rules

Rank < 99
GainPct< -15

With the new rules:

Annualized Return [color=royalblue]155.06%[/color]
Annual Turnover 688.96%
Max Drawdown -20.21%

The Old Rules:

Annualized Return [color=royalblue]143.56%[/color]
Annual Turnover 585.12%
Max Drawdown -20.09%

(Sim Date: 10/13/01 - 10/14/06)

Jerrod -
Could you explain how you toggle on and off your common buy rules. I have been trying to do this with the Excel Add-in, but have not quite figured it out. It would make my life a little easier. I do alot of cutting and pasting. Thanks

[quote]
Jerrod -
Could you explain how you toggle on and off your common buy rules. I have been trying to do this with the Excel Add-in, but have not quite figured it out. It would make my life a little easier. I do alot of cutting and pasting. Thanks
[/quote]Glad to, William.
Each Buy rule is a compound statement that is true if either part is true. So instead of a simple filter like (Rank>99), I would write
0 or (Rank>99), which is logically equivalent.

To disable the rule, change the 0 to 1. Now that compound rule is always true, thereby disabling the filter portion (Rank>99).

Sell rules work similarly, except that the compound is true only if both parts are true. Thus a filter (Rank<99) becomes
1 AND (Rank<99). To disable the filter, change the 1 to 0.

There is a feature request here that would simplify this procedure by adding a checkbox or special “COMMENT” character, but it hasn’t generated much interest.

Looks like a lot of users are using this technique or turning buy/sell rules on/off. While it works, it makes sims run slower because the logic still gets executed. We’ll bump up the requested feature priority.

Jerrod & William,

Have you ever tried something simpler? For simplicity, you cannot beat the followings: “Rank > 99” (to enable the buy filter) and “Rank > -99” (to disable the buy filter).

Old buy rules:
0 or (Rank>99) … // Enable
1 or (Rank>99)… // Disable

New buy rules:
Rank>99…// Enable. Buy, if rank is higher than 99.
Rank>-99…// Disable. Rank > -99 is always true.

Old sell rules:
1 AND (Rank<99)…// Enable
0 AND (Rank<99)…// Disable

New sell rules:
Rank<99…// Enable. Sell, if rank is lower than 99.
Rank<-99…// Disable. Rank < -99 is always false.

Advantage #1: Your sim will be simpler and easier to write.
Advantage #2: Your sim will be easier to manage. There will be no more confusion about zeroes and ones.
Advantage #3: Your sim will be Fast.
Advantage #4: Save time and money. There will be no need for the feature request that Marco has just bumped up to higher priority.

All of the above should work in Excel.

I hope this helps.

Robert

Robert,

Your recommendation will work fine for many of the simpler Buy and Sell Rules.
Buy is not workable for more complex Rules and even some simple ones. A few examples:

Buy Rules;
MktCap > 50 & MktCap < 500
SecWeight <15
MaxCorrel(60,1) < 0.5

Sell Rules;
NoDays > 20 and GainPct < BenchPct
PctFromHi < -20
Pr4W%Chg / 20 <.1 & NoDays > 30

You could reverse the > and < signs on some of them and make it work, but that is not simpler, and it is easy to over look when changing it back.

Denny :sunglasses:

Denny is right on both counts regarding the 0/1 switch.

First off, it’s easier to spot whether a rule is active or not just by looking at the first character.

Secondly, it’s easy to copy & paste the switch into all rules when developing a new sim.

Finally (with apologies for the cheap shot), without usiing the switch method, how would you deactivate these recently posted candidate rules?

(GainPct < -14 & Rank < 95) OR (GainPct < -20 & Rank < 98) OR Rank<90

or

Eval(HighestBar(#High,25,0)=1,1,0) OR Eval(HighestBar(#High,25,0)=2,1,0) OR Eval(HighestBar(#High,25,0)=3,1,0) OR Eval(HighestBar(#High,25,0)=4,1,0) OR Eval(HighestBar(#High,25,0)=5,1,0) OR Eval(HighestBar(#High,25,0)=6,1,0) OR Eval(HighestBar(#High,25,0)=7,1,0) OR Eval(HighestBar(#High,25,0)=8,1,0) OR Eval(HighestBar(#High,25,0)=9,1,0) OR Eval(HighestBar(#High,25,0)=10,1,0) OR Eval(HighestBar(#High,25,0)=11,1,0) OR Eval(HighestBar(#High,25,0)=12,1,0)

Denny & Jerrod,

I see the point you guys have made.

Naturally, the more complex buy and sell rules you guys create, the more likely that you guys will need additional features, like check boxes, just to be able to manage those highly complex rules.

Maybe I should use complex buy and sell rules, too. However, currently, I make serious attempts to keep them as simple as possible. I’m concerned about using too many rules, because too many (or too complex) rules mean data mining. And data mining usually leads to high sim returns, but low port returns. And if returns on my ports are low, then why did I go through this whole exercise (of creating complex buy and sell rules)? And, if I didn’t need the exercise, then why did I ask for the additional feature Marco has talked about?

I’m still undecided on this issue. As soon as I have some time, I will run a large number of sims, just to help me decide if I can keep all of my buy and sell rules simple. In my whole life, I’ve always tried to keep things simple.

But I see the point you guys have made.

Robert

Good morning Dan:

I’m rebalancing my portfolio and got a Sell on one of the stocks. The reason: Buy/Sell Difference. The rebalance didn’t replace thios sell order with a corresponding buy.

Any thoughts.

Judy G

judyg@mechanicalwoman.com

Hi Denny,

I would like to ask how to search for higher values of “Gain/Stk/Day” in Sims/Ports ?

Happy Trading
isam

Hi Isam,

The answer you require is contained on page 1 of this thread, in Denny’s post. Re-read his post and put your thinking cap on; and there, as far as I understand your question, you will likely find the answer.

:slight_smile:

Isam,

There is no way to search the public Sims or Ports for high values of Gain/Stock/Day.
You can narrow your search by adding a high value of Sortino Ratio such as 4.0 to your search criteria. Sims and Ports that have a high Gain/Stock/Day inevitably also have a high Sortino Ratio. Then you can calculate the Gain/Stock/Day from the Statistics; Trading page.

I have a Feature request to add the Gain/Stk/Day calculation to the Summery page. You can vote for it here:

http://www.portfolio123.com/feature_request.jsp?poll=249

Denny :sunglasses:

Hi Denny & jtbaccarat,

Thanks a lot for your highlight.

isam

Bumping this thread for beliving it can be extremely useful. Thank you very much for sharing!

Denny:

 Thanks for sharing so much. It's appreciated.

Best,

Bill

16 Years later… Thank you Denny.

Thank you, Mr. @AndorraInvestor , sir, for bringing this thread to the present and thus to my attention. I had been getting discouraged over the months because of my lack of progress and had considered leaving Portfolio 123. But in the past few weeks a lot of things have happened to make me think there is hope for me yet!

Thanks, again!

Cary

Thank you for sharing!!
It would be interesting if you could publish some screenshots of the strategy from the simulator, just to see how it does in terms of turnover, overall winners and annual returns?
And do you sometimes run into problems with your buy when using “AvgDailyTot(20)"? I see that sometimes stocks -that are almost non-buyable- can have very high volumes for short periods of time. How about Mediandailytot(120)>( 70* 1000) and StaleStmt = 0

I added the buy and sell rules indiscriminately in my test system with United States (Primary), but it did not give much better results in the period 06-22:


Could bee to much into cash:

Buy : Rank > 98 and Price > 1 and MktCap > 50 & MktCap < 500 and AvgDailyTot(20) > 100000 and Pr4W%ChgInd > 0
Sell : Rank < 99 or PctFromHi < -15 and GainPct < BenchPct & NoDays > 30 or Pr4W%Chg /20 < 0.1 & NoDays > 20

Original system, but with the buy AvgDailyTot(20) > 100000 and sell Rank < 99

I will keep on testing different settings :slight_smile: And again, thank you for sharing!