- Calculates the average volume of the last 30 days
- Grabs the volume from the current day (first 20 minutes) and compares it to the 30d average (as a label)

- CF_OpenVolume()."OpenVol" is greater than or equal to 20

**do not**meet the criteria. It forces me to use 'D', otherwise giving me a secondary aggregation period error.

Is there any hope to edit the code to allow it to work on the chart (as it currently is) AND return results intraday for OpenVol > X?

Code:

```
## DEF Volume Data
def volLast30DayAvg = (volume(period = "DAY")[1] + volume(period = "DAY")[2] + volume(period = "DAY")[3] + volume(period = "DAY")[4] + volume(period = "DAY")[5] + volume(period = "DAY")[6] + volume(period = "DAY")[7] + volume(period = "DAY")[8] + volume(period = "DAY")[9] + volume(period = "DAY")[10] + volume(period = "DAY")[11] + volume(period = "DAY")[12] + volume(period = "DAY")[13] + volume(period = "DAY")[14] + volume(period = "DAY")[15] + volume(period = "DAY")[16] + volume(period = "DAY")[17] + volume(period = "DAY")[18] + volume(period = "DAY")[19] + volume(period = "DAY")[20] + volume(period = "DAY")[21] + volume(period = "DAY")[22] + volume(period = "DAY")[23] + volume(period = "DAY")[24] + volume(period = "DAY")[25] + volume(period = "DAY")[26] + volume(period = "DAY")[27] + volume(period = "DAY")[28] + volume(period = "DAY")[29] + volume(period = "DAY")[30]) / 30;
def today = volume(period = "DAY");
def percentOf30Day = Round((today / volLast30DayAvg) * 100, 0);
### NEW LINE ###
plot TodayPctVs30Day = percentOf30Day;
## OPENING X MIN VOLUME
input startTime1 = 0930;
input endTime1 = 0949;
def Active1 = SecondsFromTime(startTime1) >= 0 and SecondsTillTime(endTime1) >= 0;
def VolMins1 = if Active1 and !Active1[1] then volume
else if Active1 then VolMins1[1] + volume
else VolMins1[1];
plot OpenVol = Round((VolMins1 / volLast30DayAvg) * 100, 0);
#AddLabel(1, "OpenVol: " + VolMins1 + " :: [" + OpenVol + "%] ", Color.CYAN);
AddLabel(1, "OpenVol: " + "[" + OpenVol + "%] " + "/ " + "Pct30d: " + "[" + TodayPctVs30Day + "%] ", Color.CYAN);
```