i read your post several times, and i think i understand.
this looks back 50 bars to find the highest volume, starting from the previous bar.
multiplies that number by 1.4 ( 40% + 100%)
then checks if current volume is > it. if it is, then 1 else 0.
then check if at least 1 bar in the last 10, found higher volume.
Code:
dat = volume;
def lookback1 = 50;
def hivol = highest( dat[1] , lookback1);
def per = 40;
def hi_per_value = (1+ ( per/100))*hivol;
def isvol_ bigger = if (dat > hi_per_value) then 1 else 0;
def within_xbars = 10;
plot z = if sum(isvol_ bigger, within_xbars) >= 1 then 1 else 0;
when there is a big volume bar, it will cause hivol to be true for the next 50 bars.
z will be true on that bar and 9 bars after it. so when 1 big volume bar happens, there will be a trigger every bar , for 59 bars.