Subject: Re: My new Program
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