Hi, Shrewd!        Login  
Shrewd'm.com 
A merry & shrewd investing community
Best Of MIBest OfAll BoardsThe Shrewd’m WeeklyLearn to InvestHow to Become Shrewd
Search
Shrewd'm.com Merry shrewd investors
Search
Best Of MIBest OfAll BoardsThe Shrewd’m WeeklyLearn to InvestHow to Become Shrewd


The week's question
In December 2024, in the thread "Re: BRK: Why Not XOM?", BreckHutHigh asked the members: "What about the long road trips with kids?" This week it is put to everyone again. The button below opens the small thread re-asking it - read what others have said so far, then give your own answer as an ordinary reply.
Answer this questionContinue to Shrewd'mThis note won't appear again
Investment Strategies / Mechanical Investing
Unthreaded | Threaded | Whole Thread (23) |
Author: Aussi   😊 😞
Number: of 6131 
Subject: Re: Technical Indicators & Market Timing
Date: 02/09/23 10:14 AM
Post New | Post Reply | Report Post | Recommend It!
No. of Recommendations: 13
From GTR for Dummies

The steps for counting the number of new Highs are:
step0: dspo >= 252 only stocks listed for at least 1 year (needed to find High for the year)
step1: excd.a = 3 only Nasdaq stocks
step2: styp.a = 10!11 restrict to ordinary stocks (US listed and foreign listed)
step3: ratio(gprc(0), hgprc(1,251)) > 1 discussed below

Note that you need to use g-prices to compensate for splits. Also note that this is an approximation because dividends are included in g-prices, and strictly speaking, a new High is typically based on the closing price (adjusted for splits, but not for dividends), or the intraday High. Stated another way, there is no universal agreement on how a new High (or Low) is calculated, so take care in comparing GTR1 new High/new Low signals to another source 'disagreements are normal. See post 258804 for a good discussion on this subject.

step3 takes last posted g-price(lag = 0) and divides by the highest g-price with a lag of 1, and going back 251 days beyond the last posted day (a year is 252 days). If last g-price is higher than the highest g-price of the 251 days prior to the last posted day (lag=1), then the result of step3 will be >1, implying a new 252-day high has been established.
Finally we need a way to count the stocks passing step3. We get this by using the sum function.

Field Label: Expression is:
CountofHighs: sum(1,1,step4) (step references must be lower case)
This function will count the number of stocks entering step4 (the next step from the prior list of steps). For now, ignore the two '1's'.

As the final step, it can be anything involving the term CountofHighs (if CountofHighs is not referenced in at least one step, an error message occurs). For example, make step4 anything that results in no stocks passing.
step4: CountofHighs = -1
Put these steps into GTR1 and run the backtest. You will get:
gtr1.net: GTR1 Backtester
Post New | Post Reply | Report Post | Recommend It!
Print the post
Members reply directly to Aussi here — and replies get answered. Reading is free; so is joining the conversation. Join Shrewd'm »
This community has written 6,115 posts about Mechanical Investing. The article-length ones it recommended most:
Dividend investing · 52 recs · 2025
Non-Mag7 screen · 34 recs · 2025
OT - Div yields and returns · 32 recs · 2024
Using AI to generate backtesting programs · 30 recs · 2025
Rankings for 19Dec2022 · 29 recs · 2022
Unthreaded | Threaded | Whole Thread (23) |


Announcements
Mechanical Investing FAQ
Contact Shrewd'm
Contact the developer of these message boards.

Best Of MI | Best Of | Favourites & Replies | All Boards | Followed Shrewds | Open Questions | Moving a community