This is actually a very common request but it mostly applied to plots. Since I was not able to find a previous post which specifically mentioned a label I decided to approve this question and provide a solution.
Here is the basic structure of the code used to achieve this:
input startTime = 400;
input endTime = 929;
def okToPlot = SecondsTillTime(endTime) >= 0 and SecondsFromTime(startTime) >= 0;
This solution is weak, in that earliest time you can apply for the "starteTime" input is 4 pm Eastern. But this is the solution I can provide free of chart in this forum.
So you take that code above and immediately below it you can add your code. The modify the AddLabel() statement to use the "okToPlot" variable from above in place of the "yes" value in your original:
input recentBars = 10;
def recentVolume = Sum(volume, recentBars)/recentBars;
AddLabel(okToPlot, Concat(“Avg10 Vol: “, recentVolume), if recentVolume>450000 then Color.RED else Color.LIGHT_GRAY);