Wannaspeed
New member
I created a simple $vol column using
however for premarket it uses yesterday's volume and is way off. I tried playing around with it and came up with what you see in the screenshot, which I was able to get a variation of that code working as an indicator.
however it shows an error about secondary time can't be less than primary. Someone told me For premarket I have to check if today’s bar is on a different day than yesterday’s bar. If they are different use the bar volume and start adding that up each bar. But i'm not sure how to implement that? Here's the working code for an indicator on the chart for $vol, but the VWAP period has to be something other than "DAY" to work premarket.
Code:
def Data = Floor(vwap * volume(period = "day"));
Addlabel(yes, data, Color.W
Code:
#Created By Brent Vogl
#Created 11/25/19
#Version 2.4
#Paypal Donate: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=4CRL8BNAESUHW&source=url
########################
Input VWAPPeriod = AggregationPeriod.DAY;
Input showVWAP = yes;
Input showVWAPCurrentChart = yes;
def isRollover = GetYYYYMMDD() != GetYYYYMMDD()[1];
def beforeStart = GetTime() < RegularTradingStart(GetYYYYMMDD());
def vol = if isRollover and beforeStart then volume else if beforeStart then vol[1] + volume else volume(period="day");
#plot PreMarketVolume = vol;
def Dollarvolume = Floor(vwap(period=vwapPeriod) * vol);
Addlabel (yes,"$Vol: " + Dollarvolume,Color.dARK_GRAY);
Addlabel (showvWAP, "VWAP: " + round(VWAP(period=VWAPPeriod)),Color.dARK_GRAY);
Addlabel (showVWAPCurrentChart, "Chart VWAP: " +Round(VWAP),Color.dARK_GRAY);