######################################################################################
# Script Name: Pre market Volume percent
# Author: Denver Stair
# 2/15/2026
# Version 1.1
######################################################################################
#Hint Gives user option to select to display todays volume, and pre/post market volume. Shows pre / post market percent volume
declare lower;
input ShowTodaysVolume = yes; #hint ShowTodaysVolume: show todays volume label in study below
input ShowTodaysPreMrktVolume = yes; #hint ShowTodaysPreMrktVolume: show todays preMarPerVolPer / post market volume below
input aggregationPeriod = AggregationPeriod.MIN; #hint aggregationPeriod: Select time frame for your chart
input startTime = 0400; #hint startTime: post market start time
input endTime = 0930; #hint endTime: pre market end time
########################## Pre/Post Market Volume####################################
def CurPer = aggregationPeriod;
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[1] then volume(GetSymbol(), CurPer) else if targetPeriod then volumeTotal[1] + volume(GetSymbol(), CurPer) else volumeTotal[1];
####################################################################################
def DayVol = volume(period = “DAY”);
def preMarPerVolPer = volumeTotal / DayVol[1];
AddLabel(ShowTodaysVolume, "Vol Today: " + DayVol, Color.LIGHT_GRAY);
AddLabel(ShowTodaysPreMrktVolume, Concat("PreMrket Vol: ", volumeTotal), Color.VIOLET);
AddLabel(yes, "Pre Market Vol %: " + Round(preMarPerVolPer * 100, 1) + "%");