in the future, just post the code you are trying, so others can see it and help guide you.
if you abandon one way and hop to another method, you (and others) aren't leaning.
i made a new study with just your 1st bar trigger formula. and a bubble. it worked.
Code:
def five = secondsFromTime(0930)>=0 and secondstilltime(0935) >0;
input test1_firstbar = no;
addchartbubble(test1_firstbar , low, five, ( if five then color.yellow else color.gray), no);
then i copied svanoy's code, addid it to my test code, and changed a couple variable names. it works.
i added a variable signal and set it = to five.
i added a variable to define the data, data = volume.
it will calculate an average for the whole chart, not just x days.
is this close to what you had?
Ruby:
#
def five = secondsFromTime(0930)>=0 and secondstilltime(0935) >0;
def signal = five;
def data = volume;
# -----------------------
def Runningdata;
def SignalCount;
If Signal {
Runningdata = Runningdata[1] + data;
SignalCount = SignalCount[1] + 1;
} else {
Runningdata = Runningdata[1];
SignalCount = SignalCount[1];}
plot Average1 = Runningdata / SignalCount;
Average1.SetPaintingStrategy(PaintingStrategy.Horizontal);
# ---------------------------
input test1_firstbar = no;
addchartbubble(test1_firstbar , low, five, ( if five then color.yellow else color.gray), no);
addlabel(1, "avg vol " + Average1, color.yellow);
#