One thing we need to state clearly from the start is that when you specify pre-market data you are expressly omitting the previous days after-market data. Which means this is very different than “extended hours” data. Because we are only going to capture the pre-market section of the extended hours data.
I see that your code uses a secondary aggregation period of “DAY”. This is not supported in custom columns. The time frame for a custom column is determined by a setting at the very top of the Custom Quote Formula window. And in your case, you will need to set that to an intraday time frame. Something like 15 minute would be ideal.
Why? Because you can only reference extended hours chart data from the intraday time frame. Impossible to do it from the daily or higher time frame.
So we have that clear. Here is the code:
def newDay = GetDay() <> GetDay()[1];
rec todaysVolume = if newDay then volume else todaysVolume[1] + volume;
plot data = todaysVolume;
Two screenshots below. One shows the custom quote formula is set to 15 min. (notice the “Include EXT” box is checked!!!). The other shows the result applied to a custom watchlist column.