Finding stocks hiting X-week high/low consistently

#1
I was trying to find an exploration afl for amibroker which would let me find stocks that are hiting x-week (x=52, 8, whatever you wish) high/low consistently for the past few sessions to look for probable long/short candidates. On searcing google, i found the following

http://www.purebytes.com/archives/amibroker/2001/msg05492.html

See the followups on that message.

Some code was suggested in that post which is as follows:

backP = 260;
shortP = 10;
sumNewHigh = sum( hhv(H,backP)==H, shortP);
graph0 = sumNewHigh;
filter = sumNewHigh >= 2;
This seems to be incomplete and when I tried it with amibroker it did not work.

Could someone please help me out complete this exploration wihch would scan stocks which were hitting x-week high/low in the past few sessions quite frequently.
 

Similar threads