Hi, Shrewd!        Login  
Shrewd'm.com 
A merry & shrewd investing community
Best Of BRK.A | Best Of | Favourites & Replies | All Boards | Post of the Week!
Search BRK.A
Shrewd'm.com Merry shrewd investors
Best Of BRK.A | Best Of | Favourites & Replies | All Boards | Post of the Week!
Search BRK.A


Stocks A to Z / Stocks B / Berkshire Hathaway (BRK.A)
Unthreaded | Threaded | Whole Thread (16) |
Post New
Author: TPOTO-2023   😊 😞
Number: of 3959 
Subject: New Highs and New Lows
Date: 04/19/2023 3:51 PM
Post Reply | Report Post | Recommend It!
No. of Recommendations: 18
This seems to be working out pretty well so I thought I'd share it.

We are counting NH and NL over a period of time and
if the former is the winner or ties the later, then BUY , else SELL.
(see math at bottom)

Looking at XLE here.
.
You will note that not only does this switching beat or match the B&H most
periods, it keeps you out of the big downturns.

First column is month number (used for indexing in EXCEL)
Second column is the ending date
Next two are the values
Last two are the % returns.

Sorry about formatting - not sure how to do it, yet!

PORTFOLIO B&H PORT B&H
0 4/1/23 566.71 149.65 90% 68%
36 4/1/20 298.03 88.99 76% 76%
72 4/1/17 169.67 50.66 59% 58%
108 4/1/14 106.99 32.16 44% 44%
144 4/1/11 74.49 22.39 43% 18%
180 4/1/08 52.11 19.04 21% 29%
216 4/1/05 42.95 14.76 5% -64%
280 12/1/99 40.93 40.93

For getting in/out:
Over the last 7 months, count up the number New Highs
and the New Lows each months over the last 2 months'
If H>=L buy or hold, L<H , sell
(note some leeway is possible in the 7,2 combination, but
these seem to be the "mound of toast"
Works on other sectors as well as QQQ and DIA and SPY

Notes:

Counting highs-
=+IF(C2=MAX(C2:OFFSET(C2,$K$1,0,1,1)),1,0)
Col C has the monthly highs.
If this month's value C2 is better than the Max, the count is 1
$K$1 held the number of months to check back- in this case 7.
Another column would have all the monthly lows.
Then do the math the add up the Highs and Lows to determine strategy.
Print the post


Author: mechinv   😊 😞
Number: of 3959 
Subject: Re: New Highs and New Lows
Date: 04/19/2023 11:37 PM
Post Reply | Report Post | Recommend It!
No. of Recommendations: 5
tpoto,

This is interesting. Did I format your table correctly below?

If so, since the end dates are every 3 years, what does each number represent?

Please note that you can format tables of numbers by using pre inside angle brackets before the table and /pre inside angle brackets after it. Angle brackets look like <>

           PORTFOLIO    B&H    PORT B&H
0 4/1/23 566.71 149.65 90% 68%
36 4/1/20 298.03 88.99 76% 76%
72 4/1/17 169.67 50.66 59% 58%
108 4/1/14 106.99 32.16 44% 44%
144 4/1/11 74.49 22.39 43% 18%
180 4/1/08 52.11 19.04 21% 29%
216 4/1/05 42.95 14.76 5% -64%
280 12/1/99 40.93 40.93
Print the post


Author: CathyInOhio   😊 😞
Number: of 3959 
Subject: Re: New Highs and New Lows
Date: 04/20/2023 10:43 AM
Post Reply | Report Post | Recommend It!
No. of Recommendations: 5
Welcome back, TPOTO, you were missed!

Thanks for posting this strategy. Maybe I haven't had enough coffee yet, but I'm not sure I understand what you mean by "Over the last 7 months, count up the number New Highs
and the New Lows each months over the last 2 months'" - could you elaborate, or maybe provide an example? I'm thinking that you are comparing the last 2 months to the last 7 months, but I just want to be sure.

Thanks so much!
Cathy
Print the post


Author: anchak   😊 😞
Number: of 3959 
Subject: Re: New Highs and New Lows
Date: 04/20/2023 11:02 AM
Post Reply | Report Post | Recommend It!
No. of Recommendations: 3
Tpoto...

So the rule is
(1) Cumulative Highs vs Cumulative lows over a 7 month period
(2) Check whether CH > CL .... 2 checks ..... last 2 months
(3) As long as CL < CH ....Stay LONG else Exit

Is that correct?

Best
Print the post


Author: Aussi   😊 😞
Number: of 3959 
Subject: Re: New Highs and New Lows
Date: 04/20/2023 11:20 AM
Post Reply | Report Post | Recommend It!
No. of Recommendations: 3
Tpoto

<Over the last 7 months, count up the number New Highs
and the New Lows each months over the last 2 months'
If H>=L buy or hold, L<H

Is that 52 week high and lows or some other duration?

Craig
Print the post


Author: TPOTO-2023   😊 😞
Number: of 3959 
Subject: Re: New Highs and New Lows
Date: 04/20/2023 7:22 PM
Post Reply | Report Post | Recommend It!
No. of Recommendations: 17
Thanks to all for looking at what I posted.

So many questions so
here is an example for Amazon with some of the Excel data that I used.

The results:
The summary values are for every three years.
Not every grouping was a winner, but survived the downturns well.

Next section has a slice of the calculations to see whether
or not to buy or sell.

In this case, a 6 month lookback was used counting up the last 7 months values.
(that will become more clear with the example below - I hope.)

Yes, every stock or ETF can be varied (from the 6/7 criteria) - this
one is for Amazon and was optimized by Excel's solver-
(
I did not do walk-forward testing or other concepts to minimize
any datamining- least I excite anyone...)

		AMAZON-switch      B&H	       AMAZON-sw  B&H			
value values period return
4/1/23 417.20 102.30 32% -17%
4/1/20 316.62 123.70 176% 167%
4/1/17 114.71 46.25 171% 204%
4/1/14 42.29 15.21 52% 55%
4/1/11 27.82 9.79 93% 149%
4/1/08 14.41 3.93 60% 143%
4/1/05 8.99 1.62 136% -57%
EOM 12/1/99 3.81 3.81

And for the monthly calculations:

A	 B	 C	 D	E	F	G	H	I
4/1/22 168 122 124 0 1 0 3 0
3/1/22 171 134 163 0 1 0 2 0
2/1/22 164 138 154 0 0 1 1 1
1/1/22 171 135 150 0 1 1 1 1
12/1/21 178 165 167 0 0 1 0 1
11/1/21 188 164 175 0 0 2 0 1
10/1/21 174 159 169 0 0 2 0 1
9/1/21 177 164 164 0 0 0 2 0

High Low close NH? NL? Sum of NH
Sum of NL BUY /SELL for next month


Now, for calculation of values in col F1 and H1 - looking at the lows and whether to sell or not

Col A Date
Col B Stock High
Col c Stock Low
Col D Adjusted Close
Col E Is this a New High over the past 6 months, if so, cell get a +1, else 0
Note not any new highs, thus a string of zeros.

Col F Is this a New Low over the past 6 months, if so, cell get a +1, else 0
YES, 122 (C1) IS LESS THAN 134,138,135,165,164,159 SO THIS CELL (F1)GETS A "1"

col G Add up the previous 7 months counts of NH leaving a 0. In col G

Coil H Add up the previous 7 months counts of NL ( in col F)
1+1+0+0+1+0+0= 3 (H1)

Do the same for the Highs- to get values for col E and G

Since H1 has more NL counts, than the NHs G1, a sell indicator is issued "0" I1.

If new high count is >= new low count, BUY or hold FOR THE NEXT MONTH.
else sell FOR THE NEXT MONTH.

WHY, because all the numbers in col B,C,D are end of month.
You are calculating what to do next after the monthly data is in.
(I guess can try using weekly data if that works for you)

After typing all this up it sure looks complicated, but once it's coded up
in Excel, it's pretty straight forward.

Is this better than all the other previous bear catchers, I don't know and
with the nice weather coming up I will be on the golf course and not doing
any more calculations!

If you find a simpler method, let me know, but I was just trying to look at
and use new highs and new lows (incorporating capturing higher highs and
lower lows vs using moving averages or other of my
favorite indicators - CCI and MACD.)

It's nice to be back after getting a GIST (Google that one!) removed
and 44 radiation treatments for prostate cancer.
- tpoto







Print the post


Author: anchak   😊 😞
Number: of 3959 
Subject: Re: New Highs and New Lows
Date: 04/21/2023 9:39 AM
Post Reply | Report Post | Recommend It!
No. of Recommendations: 5
QUOTE : "It's nice to be back after getting a GIST (Google that one!) removed
and 44 radiation treatments for prostate cancer."

Wishing you a complete recovery!
Print the post


Author: Philly Tide   😊 😞
Number: of 15062 
Subject: Re: New Highs and New Lows
Date: 04/21/2023 10:11 AM
Post Reply | Report Post | Recommend It!
No. of Recommendations: 9
Here are the Excel formulas I calculated for this. Hope it saves others some time.

Assuming row 14 (4/1/22) thru 21 (9/1/21)

Column E
=IF(B14=MAX(B14:B20),1,0)

Column F
=IF(C14=MIN(C14:C20),1,0)

Column G
=SUM(E14:E20)

Column H
=SUM(F14:F20)

Column I
=IF(G14>=H14,1,0)
Print the post


Author: TPOTO-2023   😊 😞
Number: of 15062 
Subject: Re: New Highs and New Lows
Date: 04/21/2023 11:07 AM
Post Reply | Report Post | Recommend It!
No. of Recommendations: 2
Philly Tide-

Yes, those formulas look fine- thank you.

I added a second line right after your formula that varies
the lookback number and the summation to be a variable
(using K1 and M1 below)
instead of a fixed number.

That way you can make a 2x2 table in Excel
(lookback values as a row and summation values a column)
and see the results of changing the variables.

Or use the solver add-in of Excel.
(If you have never used solver, take a few minutes to check it out.

Column E
=IF(B14=MAX(B14:B20),1,0) - (Philly Tide's)
=IF(B14=MAX(b14:OFFSET(B14,$K$1,0,1,1)),1,0) (using a variable)

Column F
=IF(C14=MIN(C14:C20),1,0)
=IF(C14=MAX(c14:OFFSET(C14,$K$1,0,1,1)),1,0)

Column G
=SUM(E14:E20)
=SUM(E14:OFFSET(E14,$M$1,0,1,1))

Column H
=SUM(F14:F20)
=SUM(F14:OFFSET(F14,$M$1,0,1,1))

NOTE:

(this is assuming the data is sorted with the latest (newest) first
and the oldest last and in this case that the data starts (say, April 2023).
in the 14th row)
Print the post


Author: TPOTO-2023   😊 😞
Number: of 15062 
Subject: Re: New Highs and New Lows
Date: 04/21/2023 11:18 AM
Post Reply | Report Post | Recommend It!
No. of Recommendations: 3
A slight correction-

Column F
=IF(C14=MIN(C14:C20),1,0)
=IF(C14=MAX(c14:OFFSET(C14,$K$1,0,1,1)),1,0)

should be
Column F
=IF(C14=MIN(C14:C20),1,0)
=IF(C14=MIN(C14:OFFSET(C14,$K$1,0,1,1)),1,0)
Print the post


Author: FlyingCircus   😊 😞
Number: of 15062 
Subject: Re: New Highs and New Lows
Date: 04/23/2023 11:37 PM
Post Reply | Report Post | Recommend It!
No. of Recommendations: 11
Anyone - here's a simple Google Sheet that will generate a current signal for any valid symbol entered into the yellow Symbol data entry cell.
Prices are WEEKLY from Googlefinance (which is essentially Yahoo Finance).

Anyone up for backtesting this on index(es) at Portfolio Visualizer?

https://docs.google.com/spreadsheets/d/1NNaTj7rET_...

As of posting, AMZN is on SELL; SPY and IWM are on SELL; EFA is on BUY; and for shiggles, XLK (Tech Sector) is on BUY.

FC
Print the post


Author: Baltassar   😊 😞
Number: of 15062 
Subject: Re: New Highs and New Lows
Date: 04/24/2023 2:37 AM
Post Reply | Report Post | Recommend It!
No. of Recommendations: 5
FlyingCircus: Very nice work!

I wasn't sure from Tpoto's (welcome back!) discussion whether this method is meant to serve as a bear-catcher or as a free-standing buy-sell screen. It certainly seems worth backtesting in the latter role if anyone can figure out how to do it. I wouldn't have thought Portfolio Visualizer could do it, but I'm by no means familiar with all its capabilities.

It seems to me to bear relation to Mungofitch's "no new high's lately" approach, which he has discussed in varying applications over the years.

Anyway, an interesting way of detecting momentum, or lack thereof.

Baltassar

Print the post


Author: Baltassar   😊 😞
Number: of 15062 
Subject: Re: New Highs and New Lows
Date: 04/24/2023 2:36 PM
Post Reply | Report Post | Recommend It!
No. of Recommendations: 9
I have done a "back of the envelope" backtest of weekly ^GSPC high/low prices back to December 1927. Weekly BUY and SELL signals were calculated using FlyingCircus's spreadsheet. For each BUY signal the index was purchased at the high for that Week, and eventually sold at the low when the BUY signals stopped. This is obviously a worst-case scenario as far as buys and sells are concerned.

On this basis (and this was done by hand, so caveat lector), there have been 34 trades since 1927. Eight were sold at a loss, one was a wash.

Total return over the whole period was 31,720%. Buying and holding the index over the same period returned 23,195%.

Obviously, this is an interesting preliminary result, but it needs to be checked by somebody with better Excel skills than I possess.

Baltassar
Print the post


Author: TPOTO-2023   😊 😞
Number: of 15062 
Subject: Re: New Highs and New Lows
Date: 04/24/2023 5:20 PM
Post Reply | Report Post | Recommend It!
No. of Recommendations: 4
Thank you, Flying Circus for your spreadsheet.

From your example, I tried weekly data on Amazon.

Some interesting results if you change/pick/optimize the
two criteria values:
1- how far to lookback to count new highs/lows
2- how far to sum those counts

If you do your own spreadsheet, I encourage you to
plot the results vs viewing just the final numbers.


										
# WEEKS # WEEKS
LOOKBACK TO SUM AND
COUNTING DETERMINE
HIGHS/LOWS BUY/SELL
SWITCHING B&H 5/25/98
START
Excel optimizer >16 37 736.52 106.96 0.367
31 31 437.17
27 27 244.88
12 12 85.18
Print the post


Author: anchak   😊 😞
Number: of 15062 
Subject: Re: New Highs and New Lows
Date: 04/24/2023 6:51 PM
Post Reply | Report Post | Recommend It!
No. of Recommendations: 12
After looking at FC's spreadsheet ..... I echo the comment made previously....

This is basically a new avatar of Jim's DBE ie Dying Bullish Euphoria. IIRC Zee had done some work around optimization of the 99-day lookback ( which Jim basically picked due to its sorta simplicity it conjures - no high for a 100 days) - and it landed somewhere around the 110-120 marks - which is basically around 6 months - Jim's is 5.

The ONLY difference that Tpoto's method requires is an additional condition

A new 6 month low also ( if you do weekly for a few running weeks for the H-L count to go negative) or monthly for 2 months.

So the count of cases that would differ - Note - Tpoto's is almost PERFECT SUBSET of DBE ( ie if DBE then guaranteed trigger)

SELL SIDE
(a) Cases where the index just meanders around for 100 days without going anywhere - but not reaching a 6 monthly low either
(b) OR Where the index is reaching a 6 month low - but the H-L count never goes Negative - ie the Index had a very good run in exactly 6 months prior - so for every New Low day - there's a New High day in the lookback. If the DBE count exceeds 100 here also - it would trigger DBE but not this signal.

BUY SIDE
Is same really - a new DBE for a few days should put the h-L in positive territory.

So the results of this Strategy should closely mimic DBE for all practical purposes if one matches up the lookback criteria.

Print the post


Author: FlyingCircus   😊 😞
Number: of 15062 
Subject: Re: New Highs and New Lows
Date: 04/26/2023 8:32 PM
Post Reply | Report Post | Recommend It!
No. of Recommendations: 4
Tpoto mentioned: Some interesting results if you change/pick/optimize the
two criteria values:
1- how far to lookback to count new highs/lows
2- how far to sum those counts


Which, obviously but needs to be said, may be very different depending on the investment or asset class. For example, I've found that 26 weeks is a much better lookback for US Real Estate than the general 33 week to 40 week lookback for the other GTAA asset classes. (RE also needs a specific "risk level" to monitor its short term volatility v shorter moving averages, but another topic, that.)

FC
Print the post


Post New
Unthreaded | Threaded | Whole Thread (16) |


Announcements
Berkshire Hathaway FAQ
Contact Shrewd'm
Contact the developer of these message boards.

Best Of BRK.A | Best Of | Favourites & Replies | All Boards | Followed Shrewds