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 March 2025, in the thread "Re: OT, out", Umm asked the members: "Do you think it is because America is made up of magical soil that makes businesses based in America magically profitable?" 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 (40) |
Author: lizgdal ✶☼  😊 😞
Number: of 6243 
Subject: Re: My new Program
Date: 01/24/26 12:25 PM
Post New | Post Reply | Report Post | Recommend It!
No. of Recommendations: 8
For each stock, return 1 if at a new high. This can be written in 2 equivalent ways:

[A>1 ? 1 : 0]

If A>1 then 1 else 0

Each stock gets a 1 or 0 depending on if it is at a new high. Sum up all these values to get a count of the stocks at new highs.

======= more details ============

[PcntNHC252]: [100*[

[Sum [[[Closing g-price; quote_lag=0 days]/[Highest closing g-price over 251 days; lag=1 days]] > 1 ? 1 : 0] at step4]

/[StockCount]]]

1. For each stock, calculate the ration of the current price to the highest price over the previous 251 market days.

PriceToHighPriceRatio = [[Closing g-price; quote_lag=0 days]/[Highest closing g-price over 251 days; lag=1 days]]

2. If this is a new high price, set B=1.

if (PriceToHighPriceRatio > 1) then B=1 else B=0

3. Add up all the B's for the stocks eligible at step4.

SumB = Sum of B for stocks at step4

4. Divide by StockCount.

[PcntNHC252] = 100 * SumB / StockCount

Calculation #2 above can also be written as:

B = (PriceToHighPriceRatio > 1) ? 1 : 0
Post New | Post Reply | Report Post | Recommend It!
Print the post
Members reply directly to lizgdal here — and replies get answered. Reading is free; so is joining the conversation. Join Shrewd'm »
This community has written 6,227 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 (40) |


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