declare on_volume;
def Clock =
GetTime();
def Date =
GetYYYYMMDD();
def Begin =
RegularTradingStart(Date);
def Finish =
RegularTradingEnd(Date);
def isOpen =
Between(Clock, Begin, Finish);
def isClosed =
!Between(Clock, Begin, Finish);
def isFirstBar =
Clock == (Begin + 1)
or (isOpen and isClosed[1])
or (isOpen and GetDay() != GetDay()[1])
;
def RunBars =
if isFirstBar then 1
else if isOpen then RunBars[1] + 1
else 0
;
def RunVol =
if isFirstBar then Volume
else if isOpen then RunVol[1] + Volume
else 0
;
def Toggle =
if isFirstBar and Toggle[1] then No
else if isFirstBar and !Toggle[1] then Yes
else Toggle[1]
;
plot Vol1 =
if Toggle and isOpen then RunVol /...