#declare on_volume;
input begin = 0900;
input till = 1600;
def bars = if getday()==getlastday() and SecondsFromTime(begin) >= 0 and
SecondsTillTime(till) > 0
then bars[1] + 1
else bars[1];
def todayvol = if getday()==getlastday() and SecondsFromTime(begin) >= 0 and SecondsTillTime(till) > 0
then todayvol[1] + volume
else 0;
input symbol1 = "JBLU";
def todayvol1 = if getday()==getlastday() and SecondsFromTime(begin) >= 0 and SecondsTillTime(till) > 0
then todayvol1[1] + volume(symbol1)
else 0;
input symbol2 = "DAL";
def todayvol2 = if getday()==getlastday() and SecondsFromTime(begin) >= 0 and SecondsTillTime(till) > 0
then todayvol2[1] + volume(symbol2)
else 0;
def totvol = todayvol + todayvol1 + todayvol2;
plot avgtime = totvol / bars;
input showlabel = yes;
AddLabel(showlabel, bars + " bars @ " + AsPrice(till) + " Total Volume : " + Round(totvol, 0) + " Avg : " + Round((avgtime), 0), if volume > avgtime then Color.GREEN else Color.RED);
input debug = yes;
#AddChartBubble(debug and SecondsFromTime(begin) >= 0 and SecondsTillTime(till) > 0, low, "B: " + Round(volume, 0) + "\nB1: " + Round(volume(symbol1), 0) + "\nB2: " + Round(volume(symbol2), 0)+ " \n T: " + Round(totvol, 0) + " \n A:" + Round(avgtime, 0), Color.WHITE );
#plot y = if !debug then Double.NaN else SecondsFromTime(0930) >= 0 and SecondsFromTime(1005) == 0;
#y.SetPaintingStrategy(PaintingStrategy.VALUES_BELOW);
def B1 = if getday() == getlastday() then volume(symbol1) else 0;
def B2 = if getday() == getlastday() then volume(symbol2) else 0;
addlabel(debug, B1 + " " + B1[1] + " " + (B1 > B1[1]), color.white);
addlabel(debug, B2 + " " + B2[1] + " " + (B2 < B2[1]), color.white);
plot up = If B1 > B1[1] and B2 < B2[1] then 1 else 0;#(place an arrow below the price on the upper chart).
plot dn = If B1 < B1[1] and B2 > B2[1] then 1 else 0;#(place arrow above the price on the chart above).
up.setpaintingStrategy(paintingStrategy.BOOLEAN_ARROW_UP);
dn.setpaintingStrategy(paintingStrategy.BOOLEAN_ARROW_DOWN);