Premarket Volume For ThinkOrSwim

9am this morning, same scan criteria/parameters on all 3.

3RmDTlf.png
 
Last edited:
I took the screenshot when I made this post, which was around 9am EST. But I scanned for stocks with 1million shares traded and only TSLA showed until nearly open. Used the standard stock hacker.

So as I stated previously, yes, perhaps the ToS scanner AND my other software count the previous day post market data and premarket data for the current day? Is fo, can you make it show that number to check?

Tomorrow if you have a chance please do a premarket scan for stocks with 1mil volume (standard stock hacker) and see what shows up vs. what this says.

Thanks for the help here too!

So you're saying you want this column to also include post market data as well?
 
This is Tsla. Something is wrong with your other two programs. Even if you included post market data, at 9:00 AM, there was well over 2 M volume. To take it a step further, if you remove post market data, the watchlist column you captured is accurate.

New.jpg



Edit:

The only thing I could think of was that your other programs did not include the first minute of postmarket, but even when I remove that, the ~1.3 m you get from your other programs is never reached until after the market opens. In order for Tesla to reach the ~1.3 million by 9:00 AM this morning, the first minute of post market must be included in the dataset.

ab.jpg
 
Last edited:
I don't know either, but somehow the ToS Scanner/Stock Hacker finds them when searching for 1mil volume, so it would seem it too knows these same stocks do indeed have over 1mil somehow. I guess without knowing how it and others know/calculate this it would be hard to list the number.
 
Last edited:
What I suspect is that the scanner you're using isn't pulling in the current day's premarket volume. You can verify this by choosing the 30 minute time frame and manually adding the premarket candles to verify.
 
And here is a simple scanner using above code.

Code:
Def requiredVolume = 100000;

def premarketStart = 0400;
def premarketEnd = 0930;


def premarketVolume = if getday() != Getlastday() then 0 else if PremarketVolume[1] == 0 then volume else if secondsFromtime(premarketStart) >= 0 and secondsFromTime(premarketEnd) < 0 then volume+premarketVolume[1] else PremarketVolume[1];

Plot PremarketV = if premarketVolume >=requiredVolume then 1 else 0;

How could I modify this script to search for stocks with certain required premarket volume for today or for X days in the past?
 
How could I modify this script to search for stocks with certain required premarket volume for today or for X days in the past?
Are you wanting an average or are you just wanting to see what the premarket volume was as an example 2 days ago?
 
Are you wanting an average or are you just wanting to see what the premarket volume was as an example 2 days ago?
The latter.

I want to be able to look for stocks with volume greater than X between 4am and 9:29am on a specific day: either today, or yesterday, or the day before, etc.
 
Last edited:
I figured out how to get the same number on all 3 at least (near 9am this morning):
3Ff8y1s.png


I had been using my custom rounded volume column, this is just the standard one. Now what are they all basing that number on, I don't know still. Doesn't matter, mystery solved for what I needed.
 
Here you go
Ruby:
# Box Volume Stats
# Version 1.2
# Created by: Enigma
# Created: 05/18/17
# Modified by: Surya Kiran C ## Included rVolume label and Changed length as input. ## Additionally Pre-Market, 1Hr Volume, AfterHour Volume labels are added.


declare on_volume;

input length = 30;
input ShowDayAvg = yes;
input ShowTodayVolume = yes;
input ShowPercentOfDayAvg = yes;
input UnusualVolumePercent = 200;
input ShowBarAvg = yes;
input ShowCurrentBar = yes;

input PreMktVol = yes;
input RTH1HrVol = yes;
input PostMktVol = yes;


def VolDayAvg = (fold index = 1 to length + 1 with Avg = 0 do (Avg + volume(period = "DAY")[index])) / length;
def AvgBars = (fold index2 = 1 to length + 1 with Bar = 0 do (Bar + volume[index2])) / length;

def Today = volume(period = "DAY");
def PercentOfDayAvg = Round((Today / VolDayAvg) * 100, 0);

def CurVol = volume;


def offset = 1;
def ADV = Average(volume, length)[offset];
def rVol = volume / ADV;

# Labels

#if GetAggregationPeriod() >= AggregationPeriod.DAY then 0 else if 1HrRTHVol then 1 else 0,

AddLabel(ShowDayAvg, length + "Day Avg: " + Round(VolDayAvg, 0) + " ", Color.LIGHT_GRAY);
AddLabel(ShowTodayVolume, "Today: " + Today + " ", (if PercentOfDayAvg >= UnusualVolumePercent then Color.GREEN else if PercentOfDayAvg >= 100 then Color.ORANGE else Color.LIGHT_GRAY));
AddLabel(ShowPercentOfDayAvg, PercentOfDayAvg + "%", (if PercentOfDayAvg >= UnusualVolumePercent then Color.GREEN else if PercentOfDayAvg >= 100 then Color.ORANGE else Color.WHITE) );
AddLabel(ShowBarAvg, "Avg" + length + "Bars: " + Round(AvgBars, 0) + " ", Color.LIGHT_GRAY);
AddLabel(ShowCurrentBar, "Cur Bar: " + CurVol + " ", (if CurVol >= AvgBars then Color.GREEN else Color.ORANGE));

AddLabel(yes, "rVol :" + Round(rVol, 2));
#AddLabel(yes, "ADV :" + ADV);
#AddLabel(yes, asPercent(rVol)); # remove "#" infront of Addlabels to select prefer choice
#AssignPriceColor(if rVol >= 1 then color.dark_red else if rVol <=.5 then Color.black else color.Gray);

#Pre, 1Hr RTH, AfterHours Volumes.
##if GetAggregationPeriod() >= AggregationPeriod.DAY then 0 else if PreMktVol then 1 else 0

input PrestartTime = 0400;
input PreendTime = 0929;

def PreMkt = SecondsFromTime(PrestartTime) >= 0 and SecondsTillTime(PreendTime) >= 0;
def PreVolMins = if PreMkt and !PreMkt[1] then volume
else if PreMkt then PreVolMins[1] + volume
else PreVolMins[1];
AddLabel(if GetAggregationPeriod() >= AggregationPeriod.DAY then 0 else if PreMktVol then 1 else 0, "PreMktVol = " + PreVolMins + " ", Color.Gray);
# End Volume PreMarket

input RTH1HrstartTime = 0930;
input RTH1HrendTime = 1029;

def RTH1Hr = SecondsFromTime(RTH1HrstartTime) >= 0 and SecondsTillTime(RTH1HrendTime) >= 0;
def RTH1HrMins = if RTH1Hr and !RTH1Hr[1] then volume
else if RTH1Hr then RTH1HrMins[1] + volume
else RTH1HrMins[1];
AddLabel(if GetAggregationPeriod() >= AggregationPeriod.DAY then 0 else if RTH1HrVol then 1 else 0, "RTH1HrVol = " + RTH1HrMins + " ", Color.Gray);
#End Volume RTH First 60 Mins

input PoststartTime = 1600;
input PostendTime = 1959;

def PostMkt = SecondsFromTime(PoststartTime) >= 0 and SecondsTillTime(PostendTime) >= 0;
def PostVolMins = if PostMkt and !PostMkt[1] then volume
else if PostMkt then PostVolMins[1] + volume
else PostVolMins[1];
AddLabel(if GetAggregationPeriod() >= AggregationPeriod.DAY then 0 else if PostMktVol then 1 else 0, "PostMktVol = " + PostVolMins + " ", Color.Gray);
# End Volume PostMarket
16446[/ATTACH]']
pdDv5bo.png


What is the % based on?
rVol is What exactly.

Good job by the way on the indicator.
 

Attachments

  • pdDv5bo.png
    pdDv5bo.png
    196.8 KB · Views: 219
Last edited by a moderator:
Updated Code at 6:44 PM EST

Make sure you have the watchlist column on 1 minute and extended hours box checked (as I know that works). Another reason it could have been wrong is because if there is no premarket volume on the current day, it would have showed you yesterdays premarket volume (or whatever day previously had premarket volume). That's never an issue for me because I also have the default volume column next to my premarket volume and if they are different (during premarket only), I know it's showing the previous day's data. I did modify it so it should now show 0 if there is no premarket volume.

Code:
def PremarketVolume = if getday() != Getlastday() then 0 else If secondsFromTime(0400) >= 0 and SecondsFromTime(0930) < 0 then volume+PremarketVolume[1] else PremarketVolume[1];
def VolumeR = If SecondsFromTime(0400) >= 0 and SecondsFromTime(0930) < 0 then Volumer[1]+Volume else 0;

Plot PremarketV = If secondsFromTime(0400) >= 0 and SecondsFromTime(0930) < 0 then VolumeR else PremarketVolume;

a.jpg
Is there any way to get the Average premarket volume and average premarket volume vs today's percent difference?
 
Last edited:
Is there any way to get the Average premarket volume and average premarket volume vs today's percent difference?
Hi Wiinii - Sorry for the late reply. I actually already have something very similar to what you're asking (Relative PM volume is bottom-most chart. There was not a lot of time put into it, but here's the code:

eXnFRks.jpg


Code:
Declare Lower;
Declare zerobase;
def Day0PMVol = If getday() <> GetDay()[1] then If SecondsFromTime(0930) < 0 then volume else 0 else If secondsFromTime(0400) >= 0 and SecondsFromTime(0930) < 0 then Volume+Day0PMVol[1] else Day0PMVol[1];

plot pmvolplotted = If secondsFromTime(0400) >= 0 and SecondsFromTime(0930) < 0 then Day0PMVol else Double.nan;
pmvolplotted.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Def PmBack1Day = If GetDay() <> GetDay()[1] then Day0PMVol[1] else PmBack1Day[1];
Def PMBack2Day = If GetDay() <> GetDay()[1] then PmBack1Day[1] else PmBack2Day[1];
Def PmBack3Day = If GetDay() <> GetDay()[1] then PmBack2Day[1] else PmBack3Day[1];
Def PMBack4Day = If GetDay() <> GetDay()[1] then PmBack3Day[1] else PmBack4Day[1];
Def PmBack5Day = If GetDay() <> GetDay()[1] then PmBack4Day[1] else PmBack5Day[1];
Def PMBack6Day = If GetDay() <> GetDay()[1] then PmBack5Day[1] else PmBack6Day[1];
Def PmBack7Day = If GetDay() <> GetDay()[1] then PmBack6Day[1] else PmBack7Day[1];
Def PMBack8Day = If GetDay() <> GetDay()[1] then PmBack7Day[1] else PmBack8Day[1];
Def PmBack9Day = If GetDay() <> GetDay()[1] then PmBack8Day[1] else PmBack9Day[1];
Def PMBack10Day = If GetDay() <> GetDay()[1] then PmBack9Day[1] else PmBack10Day[1];

Def PMAvgVol = (PmBack1Day + PmBack2Day +  PmBack3Day + PmBack4Day + PmBack5Day + PmBack6Day + PmBack7Day + PmBack8Day + PmBack9Day + PmBack10Day)/10;

plot AvgPmVol = If secondsFromTime(0400) >= 0 and SecondsFromTime(0930) < 0 then PMAvgVol else Double.nan;
AvgPmVol.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
AddLabel(1,"Average:" + PmAvgVol + "|" + "Today:" + Day0PMVol + "|" + "Relative:" + (Day0PMVol/PmAvgVol)*100 + "%");

Make sure you are displaying at least 10 days worth of data. With a little effort I can fix this but for me, there's no point.
 
Hi Wiinii - Sorry for the late reply. I actually already have something very similar to what you're asking (Relative PM volume is bottom-most chart. There was not a lot of time put into it, but here's the code:

eXnFRks.jpg


Code:
Declare Lower;
Declare zerobase;
def Day0PMVol = If getday() <> GetDay()[1] then If SecondsFromTime(0930) < 0 then volume else 0 else If secondsFromTime(0400) >= 0 and SecondsFromTime(0930) < 0 then Volume+Day0PMVol[1] else Day0PMVol[1];

plot pmvolplotted = If secondsFromTime(0400) >= 0 and SecondsFromTime(0930) < 0 then Day0PMVol else Double.nan;
pmvolplotted.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Def PmBack1Day = If GetDay() <> GetDay()[1] then Day0PMVol[1] else PmBack1Day[1];
Def PMBack2Day = If GetDay() <> GetDay()[1] then PmBack1Day[1] else PmBack2Day[1];
Def PmBack3Day = If GetDay() <> GetDay()[1] then PmBack2Day[1] else PmBack3Day[1];
Def PMBack4Day = If GetDay() <> GetDay()[1] then PmBack3Day[1] else PmBack4Day[1];
Def PmBack5Day = If GetDay() <> GetDay()[1] then PmBack4Day[1] else PmBack5Day[1];
Def PMBack6Day = If GetDay() <> GetDay()[1] then PmBack5Day[1] else PmBack6Day[1];
Def PmBack7Day = If GetDay() <> GetDay()[1] then PmBack6Day[1] else PmBack7Day[1];
Def PMBack8Day = If GetDay() <> GetDay()[1] then PmBack7Day[1] else PmBack8Day[1];
Def PmBack9Day = If GetDay() <> GetDay()[1] then PmBack8Day[1] else PmBack9Day[1];
Def PMBack10Day = If GetDay() <> GetDay()[1] then PmBack9Day[1] else PmBack10Day[1];

Def PMAvgVol = (PmBack1Day + PmBack2Day +  PmBack3Day + PmBack4Day + PmBack5Day + PmBack6Day + PmBack7Day + PmBack8Day + PmBack9Day + PmBack10Day)/10;

plot AvgPmVol = If secondsFromTime(0400) >= 0 and SecondsFromTime(0930) < 0 then PMAvgVol else Double.nan;
AvgPmVol.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
AddLabel(1,"Average:" + PmAvgVol + "|" + "Today:" + Day0PMVol + "|" + "Relative:" + (Day0PMVol/PmAvgVol)*100 + "%");

Make sure you are displaying at least 10 days worth of data. With a little effort I can fix this but for me, there's no point.

No need to apologize, you don't owe anybody anything bud. And thank you for sharing!

Premarket RVOL, exactly what I was looking for! We're obviously looking for stocks with volume in the morning.

EDIT: I made a scanner and watchlist column based on your code.

c4FEEd5.png


Add this as a study: http://tos.mx/NvAn3MK (or use code below). Click here for --> Easiest way to load shared links
Code:
#https://usethinkscript.com/threads/premarket-volume-for-thinkorswim.2383/post-116609
#Use 30min timeframe

Declare Lower;
Declare zerobase;
def Day0PMVol = If getday() <> GetDay()[1] then If SecondsFromTime(0930) < 0 then volume else 0 else If secondsFromTime(0400) >= 0 and SecondsFromTime(0930) < 0 then Volume+Day0PMVol[1] else Day0PMVol[1];

def pmvolplotted = If secondsFromTime(0400) >= 0 and SecondsFromTime(0930) < 0 then Day0PMVol else Double.nan;

Def PmBack1Day = If GetDay() <> GetDay()[1] then Day0PMVol[1] else PmBack1Day[1];
Def PMBack2Day = If GetDay() <> GetDay()[1] then PmBack1Day[1] else PmBack2Day[1];
Def PmBack3Day = If GetDay() <> GetDay()[1] then PmBack2Day[1] else PmBack3Day[1];
Def PMBack4Day = If GetDay() <> GetDay()[1] then PmBack3Day[1] else PmBack4Day[1];
Def PmBack5Day = If GetDay() <> GetDay()[1] then PmBack4Day[1] else PmBack5Day[1];
Def PMBack6Day = If GetDay() <> GetDay()[1] then PmBack5Day[1] else PmBack6Day[1];
Def PmBack7Day = If GetDay() <> GetDay()[1] then PmBack6Day[1] else PmBack7Day[1];
Def PMBack8Day = If GetDay() <> GetDay()[1] then PmBack7Day[1] else PmBack8Day[1];
Def PmBack9Day = If GetDay() <> GetDay()[1] then PmBack8Day[1] else PmBack9Day[1];
Def PMBack10Day = If GetDay() <> GetDay()[1] then PmBack9Day[1] else PmBack10Day[1];

Def PMAvgVol = (PmBack1Day + PmBack2Day +  PmBack3Day + PmBack4Day + PmBack5Day + PmBack6Day + PmBack7Day + PmBack8Day + PmBack9Day + PmBack10Day)/10;

plot PMRVOL = Day0PMVol/PmAvgVol*100;

And this as a watchlist column: http://tos.mx/fkbbmK5 (or use code below).

Code:
#https://usethinkscript.com/threads/premarket-volume-for-thinkorswim.2383/post-116609
#Use 30min timeframe

Declare Lower;
Declare zerobase;
def Day0PMVol = If getday() <> GetDay()[1] then If SecondsFromTime(0930) < 0 then volume else 0 else If secondsFromTime(0400) >= 0 and SecondsFromTime(0930) < 0 then Volume+Day0PMVol[1] else Day0PMVol[1];

def pmvolplotted = If secondsFromTime(0400) >= 0 and SecondsFromTime(0930) < 0 then Day0PMVol else Double.nan;

Def PmBack1Day = If GetDay() <> GetDay()[1] then Day0PMVol[1] else PmBack1Day[1];
Def PMBack2Day = If GetDay() <> GetDay()[1] then PmBack1Day[1] else PmBack2Day[1];
Def PmBack3Day = If GetDay() <> GetDay()[1] then PmBack2Day[1] else PmBack3Day[1];
Def PMBack4Day = If GetDay() <> GetDay()[1] then PmBack3Day[1] else PmBack4Day[1];
Def PmBack5Day = If GetDay() <> GetDay()[1] then PmBack4Day[1] else PmBack5Day[1];
Def PMBack6Day = If GetDay() <> GetDay()[1] then PmBack5Day[1] else PmBack6Day[1];
Def PmBack7Day = If GetDay() <> GetDay()[1] then PmBack6Day[1] else PmBack7Day[1];
Def PMBack8Day = If GetDay() <> GetDay()[1] then PmBack7Day[1] else PmBack8Day[1];
Def PmBack9Day = If GetDay() <> GetDay()[1] then PmBack8Day[1] else PmBack9Day[1];
Def PMBack10Day = If GetDay() <> GetDay()[1] then PmBack9Day[1] else PmBack10Day[1];

Def PMAvgVol = (PmBack1Day + PmBack2Day +  PmBack3Day + PmBack4Day + PmBack5Day + PmBack6Day + PmBack7Day + PmBack8Day + PmBack9Day + PmBack10Day)/10;

plot PMRVOL = Day0PMVol/PmAvgVol*100;

Set both to 30min timeframe. Then scan the study (the first code) with, for example >100 (for greater than 100%), or like so:
PM_RVOL() is greater than 100
The bold part is the default name of the study, so if you rename it, you will need to change that to whatever you named it.


Now, if you're looking for RVOL once the market opens, head this way!
 
Last edited:
No need to apologize, you don't owe anybody anything bud. And thank you for sharing!

Premarket RVOL, exactly what I was looking for! We're obviously looking for stocks with volume in the morning.

But I'm not sure why this requires you to display 10 days on your chart to work (I'm a n00b to coding, forgive me), I was hoping to have PremktRvol as a watchlist column and something I could scan for. I'm just looking at it now, maybe I can figure it out, but if you already have that lemme know plz, and thanks again!
It iterates through each day and assigns the volume to a variable and then divides it by 10. If there's not 10 days worth of data, it will divide the total pm volume by 10, regardless of the amount of days you're looking at.
 
Can someone help me to create a label for premarket volume that captures the premarket volume shown in the TOS Trade tab?

sTyt46S.png
 
Make sure you check "include extended hours".

Code:
def PmV = if getday() != Getlastday() then Volume else if SecondsFromTime(0930) < 0 then volume+PmV[1] else PmV[1];
plot PmVplotted = PmV;
 
Thank you so much for response, Darkejo! I will give it a try and let you know.
I wanted to give you a feedback. The number DOES NOT match with TOS Trade tab. Would you mind to double check?

Make sure you check "include extended hours".

Code:
def PmV = if getday() != Getlastday() then Volume else if SecondsFromTime(0930) < 0 then volume+PmV[1] else PmV[1];
plot PmVplotted = PmV;
I wanted to give you a feedback. The number DOES NOT match with TOS Trade tab. Would you mind to double check?
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
396 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top