Daily Volume Percentage (watchlist) Column for PreMarket

mattastic1

New member
Hi fellas - For my trading plan, I tend to look at the Average volume for 60days and compare that number with today's volume every morning (During Pre-Market hours) to come up with a list of stocks of interest to trade.

I figured maybe now is a good time to create a volume percentage column on the watchlist to quickly see what's moving in my list of stocks.

to recap idea is:
• see a percentage of today's volume in comparison to the last 60days
• if today's premarket volume is greater than 10% I'm interested and would like to see that as a Green percentage value!! (see red color)
• place the "%" sign at the end as well for each value

Here is what I have so far

Code:
def avgVol = Average(volume, 60);

def today = volume(period = "DAY");

plot VolumePercentage = Round((today / avgVol) * 100, 0);

VolumePercentage.assignvalueColor(if VolumePercentage >10 then color.green else color.red);

something is off...it's not displaying the data I'm looking for... any tweaks above? Thanks again!

Solution
With different aggregations your volume is still added through the day (1 day, 1 hour, 5 min etc). Meaning in the watchlist column the volume continues to increase even through regular market trading hours. My guess is you will need a defined range of data for the premarket as an example 400 am to 929 am time frame. There is a premarket code here

plot Data = close;#PreMarket Volume
input startTime = 0400;
input endTime = 0929;
def startCounter = SecondsFromTime(startTime);
def endCounter = SecondsTillTime(endTime);
def targetPeriod = if startCounter >= 0 and endCounter >= 0 then 1 else 0;
rec volumeTotal = if targetPeriod and !targetPeriod then volume else if targetPeriod then volumeTotal + volume else volumeTotal...

New member
With different aggregations your volume is still added through the day (1 day, 1 hour, 5 min etc). Meaning in the watchlist column the volume continues to increase even through regular market trading hours. My guess is you will need a defined range of data for the premarket as an example 400 am to 929 am time frame. There is a premarket code here

plot Data = close;#PreMarket Volume
input startTime = 0400;
input endTime = 0929;
def startCounter = SecondsFromTime(startTime);
def endCounter = SecondsTillTime(endTime);
def targetPeriod = if startCounter >= 0 and endCounter >= 0 then 1 else 0;
rec volumeTotal = if targetPeriod and !targetPeriod then volume else if targetPeriod then volumeTotal + volume else volumeTotal;
• 