Hi ddharder
The first of these explorations checks for the current HIGH being 5% or less away from the 1-year highest HIGH. The second checks for the current CLOSE being 5% or less away from the 1-year highest CLOSE. Securities with less than 1 year of history will not return a result unless the commented additional "Start" definition is enabled. The exploration looks back to the previous "anniversary" of the current date and begins its check for new highs from the first bar following that anniversary.
Notice that the result line includes a check for valid volume. Obviously this might need to be altered for securities not including volume. What these explorations do not do is validate the last bar of data as being for the current date. Explorations for new 1-year highs included with the October issue of MSTT did have a date checking mechanism to eliminate false new highs from securities that did not trade on the current date.
{ColA: NewHighH}
{Mark new 1-year highest HIGH}
{Date variables}
D:=DayOfMonth(); M:=Month(); Y:=Year();
LD:=LastValue(D); LM:=LastValue(M);
D1:=Ref(D,-1); M1:=Ref(M,-1); Y1:=Ref(Y,-1);
A:=(Y>Y1+1 OR (Y>Y1)*(M>M1 OR (M=M1)*(D>=D1)));
A:=ExtFml("Forum.Sum",A,1);
{1-year highest HIGHs}
G:=M*31+D-372*(M>LM OR (M=LM AND D>LD))-372*A;
Start:=ExtFml("Forum.Sum",G<ValueWhen(2,1,G),1);
{Start:=Start OR Cum(IsDefined(Start))=1;}
HH:=HighestSince(1,Start,H);
{Mark securities meeting test conditions}
H>=Ref(HH,-1)*0.95 AND V>0;
{Filter}
colA
{ColA: NewHighC}
{Mark new 1-year highest CLOSE}
{Date variables}
D:=DayOfMonth(); M:=Month(); Y:=Year();
LD:=LastValue(D); LM:=LastValue(M);
D1:=Ref(D,-1); M1:=Ref(M,-1); Y1:=Ref(Y,-1);
A:=(Y>Y1+1 OR (Y>Y1)*(M>M1 OR (M=M1)*(D>=D1)));
A:=ExtFml("Forum.Sum",A,1);
{1-year highest CLOSE}
G:=M*31+D-372*(M>LM OR (M=LM AND D>LD))-372*A;
Start:=ExtFml("Forum.Sum",G<ValueWhen(2,1,G),1);
{Start:=Start OR Cum(IsDefined(Start))=1;}
HC:=HighestSince(1,Start,C);
{Mark securities meeting test conditions}
C>=Ref(HC,-1)*0.95 AND V>0;
{Filter}
colA
Hope this helps
Roy
MetaStock Tips & Tools