Simple Volume Scan Issue

Am having trouble with a fairly simple volume scan. Have tried many configurations (with scripterbot), but still not getting correct results.

Scan for:
Within the past 10-days, has volume been the highest volume in previous 63 days and stock closed in the high of that days range.

Here is what I am using:

// Stock closes above midpoint of range
C = CLOSE();
L = LOW();
Range = HIGH() - L;
RngPosition = C - L;
CloseRange = ( RngPosition / Range ) * 100; // Close placement in range
Percent50 = L + ( Range * 0.5 ); // 50% of range above low
HighRange = C > Percent50; // Close greater than 50% of range

// Highest close in 63 days within past 10-days
HighestVQ = HIGHESTHIGH( VOL(), BARS=63 )[1];
HVQ = ( VOL() > HighestVQ ) and HighRange;
HVQT = TIMESINCESIGNAL(HVQ, OFFSET=10) <= 10;
HVQT

In the example below, it keeps showing a lot of stocks as true, when they are not. I think the problem is in the HVQ line.

t

In the example above, the script seems to find the highest volume in 63 days, but does not match todays volume against the high.

Assistance is kindly appreciated.

Many thanks,

EK

Hi Eric,

For some reason there’s an OFFSET in the TimeSinceSignal function (the scanningbot hasn’t been retrained over the last couple of weeks so we’ll get to that over the next few days, including teaching it the BARTYPES() function to easily find a close above the midpoint).

Does this work?

HighestVQ = HIGHESTHIGH( VOL(), BARS=63 );
HVQ = ( VOL() > HighestVQ ) and BARTYPES().CloseAboveMid;
HVQT = TIMESINCESIGNAL(HVQ)<=10;
HVQT

If you put TIMESINCESIGNAL(HVQ) in a watchlist column it will show you the timecount to verify it’s counting correctly.

Thanks Darren. I see the offset issue and fixed that, but still not getting the proper results. I changed the TimeSince to be 3 days so they are easier to spot.

Here is an example from PONY. Volume in last three days is not the highest in past quarter. Not sure what else the issue could be.

I think it’s because there isn’t enough data for PONY so a new 63 day high volume hasn’t yet occurred after the first trading day, resulting in a TIMESINCESIGNAL(HVQ) of -1.

This should work:

HVQT = TIMESINCESIGNAL(HVQ)>0 and TIMESINCESIGNAL(HVQ)<=10;

Also, the Market Cap field you are using is only compatible with certain 3rd party live data connections. Instead, type Market Cap in the search box to filter the list, and one of the options will be for Market Capitalization in the Fundamental section: