Help with this Relative Volume scan?

M

Moonman

New member
Hello,
I "borrowed" some code, I think from here, and added my own tweaks to try and use it as a scan. I KNOW there are stocks where the signal comes back true on a 15 minute chart, no after hours data. When I run it as a scan with the same parameters, I get no results. Anyone see what I have wrong?

Code:
input length = 10;
input StartTime = 0930;
input EndTime = 0945;
input multiplier = 2.0;

#If this is the bar we want a signal for
def active = secondsFromTime(StartTime) >= 0 and secondsTillTime(EndTime) > 0;

#if this bar is on the latest day then 1 else 0
def istoday = if GetLastDay() == GetDay() then 1 else 0;

#Number the daily bars
#rec barcounter = if GetDay() != GetDay()[1] then 1 else barcounter[1] + 1;

plot barCount = Ceil((RegularTradingEnd(20191107) - RegularTradingStart(20191107))
                / GetAggregationPeriod());

plot avgVolume = (fold day = 0 to length
                 with s
#                 do s + GetValue(volume, day * barCount, 0)) / length;
                 do s + GetValue(volume, day * barCount, (length - 1) * barCount)) / length;
avgVolume.setPaintingStrategy(paintingStrategy.DASHES);

plot signal = (volume >= multiplier * avgVolume and active);
signal.setpaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
 

Top