Thanks very much for this code.
I’m trying to edit your code to build a VWAP that resets outside of mkt hours… eg, this new indicator would have a VWAP between 0930-1600 and then it resets and is a new VWAP between 1600-0930. I have this code so far to distinguish the time:
mkt_hours = time(period, "0930-1600" )
plot(na(mkt_hours) ? 0 : 1)
The logic behind this is that I trade futures which are a 24 hour market - so the VWAP during business hours is calculated cumulatively for only business hours, and then it resets for the overnight trading.
Thanks ever so much for your help!