AVWAP pinch scan

I try to make scan that finds stocks that are between AVWAP anchored to 52w highest high and 52w lowest low. I have made two scripts and then use them in scan with AND operator. I don’t get any results and I am wondering is there some problem in my scripts?

Script 1
[scode lang=“{language}”]Start = (BARDATE() == LAST(BARDATE()) - (52*7)) ;
Sig = HIGH() == HIGHESTSINCE(Start);
$DATE = BarDate(NonZero(Sig));
CLOSE() < AVWAP(BACKTYPE=Fixed, DATE=$DATE)[/scode]

Script 2
[scode lang=“{language}”]Start = (BARDATE() == LAST(BARDATE()) - (52*7)) ;
Sig = LOW() == LOWESTSINCE(Start);
$DATE = BarDate(NonZero(Sig));
CLOSE() > AVWAP(BACKTYPE=Fixed, DATE=$DATE);[/scode]

Thanks Pentti.

Are you scanning on the Last Bar? If you add the scripts to watchlist columns do you get results? Note that the symbols being scanned require reported volume, so AVWAPs won’t work on forex or some indices.

You could also try combining the formulas to see if that helps:

Start = (BARDATE() == LAST(BARDATE()) - (52*7)) ;
LSig = LOW() == LOWESTSINCE(Start);
HSig = HIGH() == HIGHESTSINCE(Start);
$LDATE = BarDate(NonZero(LSig));
$HDATE = BarDate(NonZero(HSig));
CLOSE() > AVWAP(BACKTYPE=Fixed, DATE=$LDATE) and
CLOSE() < AVWAP(BACKTYPE=Fixed, DATE=$HDATE)

Yes I am scanning Last Bar. I tried script that combines formulas but still no results. I added script to watchlist column in other scan and it returns true / false values correctly.

Thanks. I’m getting correct results on a daily scan of the S&P500 so I’m not sure why it’s not working for you. Please send a picture of your scan setup window along with your scan file to support and we’ll investigate. The scan file (.osn) can be found here:

Documents/Optuma/Local/Searches/Scans