Useful Intraday Stats for ThinkorSwim

But do you use relative volume in premarket? I am looking for relative volume not average volume in premarket.

Is this script to put it on chart as a study or for scan or for watchlist? The reason i ask is i am getting an error if i use for watchlist column.
Thanks. Apology for my lack of knowledge.

I apologize but is it possible to use for premarket? I like it this study for intraday it works really well.
 
@Vimal Mittal

Try the new revised version of the chart labels near the top of the page. This will show premarket stats and then change to intraday stats after 9:30. If you want volume, just add "Volume" as a column to your premarket scan. I only use Mark % Change, Mark, and Volume as columns in my premarket scan.
 
@soary

I fixed the errors you had in your code. Just add this code to the bottom of the revised big code I posted near the top of page 3:

Code:
#Volume Today
AddLabel (L1 < 5, "VT: " + today, CreateColor(206, 177, 128));
AddLabel (L1 between 4.5 and 5.5, "VT: " + Round((today / 1000), 0) + "K", CreateColor(206, 177, 128));
AddLabel (L1 > 5, "VT: " + Round((today / 1000000), 1) + "M", CreateColor(206, 177, 128));

#Yest Vol
def YV = volume(period=AP)[1];
def L2 = RoundDown(Lg(YV), 0);
AddLabel (L2 < 5, "YV: " + YV, CreateColor(30,182,228));
AddLabel (L2 between 4.5 and 5.5, "YV: " + Round((YV / 1000), 0) + "K", CreateColor(30,182,228));
AddLabel (L2 > 5, "YV: " + Round((YV / 1000000), 1) + "M", CreateColor(30,182,228));

#Dif bet yest volume and today
def DV2 = today - YV;
def L3 = RoundDown(Lg(DV2), 0);
AddLabel (L3 < 5, "DV2: " + DV2, CreateColor(208,209,238));
AddLabel (L3 between 4.5 and 5.5, "DV2: " + Round((DV2 / 1000), 0) + "K", CreateColor(208,209,238));
AddLabel (L3 > 5, "DV2: " + Round((DV2/ 1000000), 1) + "M", CreateColor(208,209,238));

#Relative Volume 2d
def R2 = Average(volume(period = AP)[1], 2);
def RV2 = today/R2;
Addlabel(1, “RV2: "+ Round(RV2,1), createcolor(254,216,177));

#Relative Volume 100d
def R3 = Average(volume(period = AV)[1], 100);
def RV3 = today/R3;
Addlabel(1, "RV100: "+ Round(RV3,1), createcolor(178,255,102));

#Difference between AV and today's volume
def AVD = today-R3;
def L4 = RoundDown(Lg(AVD),0);
AddLabel (L4 < 5, "AVD: " + AVD, CreateColor(206, 177, 128));
AddLabel (L4 between 4.5 and 5.5, "AVD: " + Round((AVD / 1000), 0) + "K", CreateColor(206, 177, 128));
AddLabel (L4 > 5, "AVD: " + Round((AVD / 1000000), 1) + "M", CreateColor(206, 177, 128));
 
Last edited:
Hi @Sonny, The labels showed up aftermarket with the volume stats for aftermarket hours. I am guessing that it will update during RTH. I'll let you know. Thanks
 
@Sonny, thank you very much, all the updated scripts work great. It shows the price and volume stats for the current session whether it's RTH or extended hours, the premarket open so can know the gap and it works with any market including futures. .Happy trading everyone!
 
@Sonny , I like the code for VWAP difference. It shows "AV" for above VWAP and "BV" for below it. Is there any way can shows in percent value at watchlist column when the close price up/below vwap( how far from VWAP). thanks anyway.
 
I revised the code again and now it shows premarket volume and premarket relative volume. Keep in mind that premarket volume label is not exact since it's hard to measure but this label is a great approximation of it.

Code:
#LABELS
#
#Current Price
AddLabel (1, "P: " + Round(close, 2), Color.CYAN);

#Percent Change from yesterday close
def AP = AggregationPeriod.DAY;
def Priorclose = close(period = AP)[1];
def PctChange = (close - Priorclose) / Priorclose;
def PC1 = Round(PctChange, 3);
AddLabel(1, "Ch: " + AsPercent(PC1), if PctChange > 0 then CreateColor(238, 210, 238) else CreateColor(255, 153, 153));

#Check if time is premarket
def pmopen = if SecondsFromTime(0400) >= 0 and SecondsTillTime(0930) >= 0 then 1 else 0;
def pmclosed = if SecondsFromTime(0400) >= 0 and SecondsTillTime(0930) >= 0 then 0 else 1;
def pastten = if SecondsFromTime(0400) >= 0 and SecondsTillTime(1000) >= 0 then 1 else 0;

#Prior Close
AddLabel (1, "Y: " + Round(Priorclose, 2), Color.LIGHT_GREEN);

#Open price
def open1 = open(period = AP);
AddLabel (pmclosed, "O: " + Round(open1, 2), CreateColor(254, 216, 177));

#High of Day
def high1 = Highest(high(period = AP), 1);
AddLabel (pmclosed, "H: " + Round(high1, 2), Color.CYAN);

#Low of Day
def low1 = Lowest(low(period = AP), 1);
AddLabel (pmclosed, "L: " + Round(low1, 2), CreateColor(178, 255, 102));

#Volume Today
def today = volume(period = AP);
def L1 = RoundDown(Lg(today), 0);
def M1 = if L1 > 5 and L1 < 8 then 1 else 0;
AddLabel (L1 < 5, "V: " + today, CreateColor(144, 171, 255));
AddLabel (L1 between 4.5 and 5.5, "V: " + Round((today / 1000), 0) + "K", CreateColor(144, 171, 255));
AddLabel (M1, "V: " + Round((today / 1000000), 1) + "M", CreateColor(206, 177, 128));
AddLabel (L1 > 7, "V: " + Round((today / 1000000), 0) + "M", CreateColor(206, 177, 128));

#Change From Open
def CFO = Round(100*((close/open1)-1),1);
AddLabel(pmclosed, "C: " + CFO + "%", if CFO > 0 then CreateColor(0, 255, 128) else CreateColor(255, 153, 153));

#Relative Volume
def AV = AggregationPeriod.DAY;
def x1 = Average(volume(period = AV)[1], 60);
def v1 = volume(period = AV);
def z1 = v1 / x1;
def z2 = if Lg(z1) >= 2 then 0 else 1;
AddLabel(pmclosed, "R: " + Round(z1, z2), CreateColor(208, 209, 238));
#Addlabel(1,x1,color.PINK);

def h = high;
def v = volume;
def bar = BarNumber();
def GlobeX = GetTime() < RegularTradingStart(GetYYYYMMDD());

#Premarket Volume
def vol = if GlobeX and !GlobeX[1] then v else if GlobeX then vol[1] + v else Double.NaN;
def L2 = RoundDown(Lg(vol), 0);
def C1 = if L2 > 4.5 and L2 < 5.5 then 1 else 0;
AddLabel (pmopen and L2 < 5, "PV: " + vol, CreateColor(196, 212, 207));
AddLabel (pmopen and C1, "PV: " + Round((vol / 1000), 0) + "K", CreateColor(196, 212, 207));
AddLabel (pmopen and L2 > 5, "PV: " + Round((vol / 1000000), 1) + "M", CreateColor(196, 212, 207));

#Premarket Open
def newDay = GetDay() <> GetDay()[1];
def start = newDay or SecondsTillTime(400) == 0;
rec premarketOpen = if start then open else premarketOpen[1];
def x = premarketOpen;
AddLabel(pmopen, "PO: " + Round(x, 2), CreateColor(110, 160, 208));

#Premarket High
def ONhigh = if GlobeX and !GlobeX[1] then h else if GlobeX and h > ONhigh[1] then h else ONhigh[1];
def ONhighBar = if GlobeX and h == ONhigh then bar else Double.NaN;
def OverNightHigh = if BarNumber() == HighestAll(ONhighBar) then ONhigh else OverNightHigh[1];
AddLabel(pastten, "PH: " + Round(OverNightHigh, 2), Color.CYAN);

#Pct difference between price and premarket open
def z = Round(100 * ((close / x) - 1), 1);
AddLabel(pmopen, "PG: " + z + "%", if z < 0 then CreateColor(255, 153, 153) else CreateColor(197, 239, 161));

#Premarket Relative Volume
def z3 = vol / x1;
AddLabel(pmopen, "PR: " + Round(z3, 2), CreateColor(254, 216, 177));
 
@Sonny , I like the code for VWAP difference. It shows "AV" for above VWAP and "BV" for below it. Is there any way can shows in percent value at watchlist column when the close price up/below vwap( how far from VWAP). thanks anyway.

Here is the column code for percent above or below VWAP:

def x = vwap;
def y = Round((100*(close/vwap)-1),1);
plot z=y;
z.assignValueColor(if y>0 then color.GREEN else color.RED);
 
Last edited:
Hi Sonny,

Thanks for your piece of code.
Is your gap different than your momentum scan?
What's the difference?
 
Last edited:
Hi Sonny,

Thanks for your piece of code.
Is your gap different than your momentum scan?
What's the difference?

My gap scan is listed below:

Last: 1 to 15
% change: 15 to No Max
Volume: 100,000 to No Max

The difference in gap and Momentum scans is this - Gap scan shows you the highest percent gainers for the day but momentum scan shows which stocks have high percent gains but also positive change from open percentage as well.
 
Thank you for explanation, and of course gap scan is valid both pre-market and regular trading!
One more question.
The previous code you shared the pre-market RV1 and the regular Rv1, I didn't get different numbers between the two the numbers come out the same always. what's the difference?
Or are they the same. Thank you for your willingness to help.
 
Last edited:
@k8be The premarket RV1 is (PM volume) / (60 day aver. volume) and the regular RV1 is (today's volume) / (60 day aver. volume). I coded it so premarket RV1 stops showing up after 9:31 and the regular RV1 is shown after that.
 
@k8be The premarket RV1 is (PM volume) / (60 day aver. volume) and the regular RV1 is (today's volume) / (60 day aver. volume). I coded it so premarket RV1 stops showing up after 9:31 and the regular RV1 is shown after that.
That makes so much sense now! Got it. I was mixing them up.

Do you take any relationship going from gap scan to mom scan, to filter the tickers.
I know you said focus on top 3 rV, like today EQ was not #1 even though it was the clear winner.

What I did was to look at the results and check the news for each one.


From your code, if I am in the west coast using PDT, do I need to change this time to 0630 instead of 0930 and 0100 instead of 0400?
#Check if time is premarket
def pmopen = if SecondsFromTime(0400) >= 0 and SecondsTillTime(0930) >= 0 then 1 else 0;
def pmclosed = if SecondsFromTime(0400) >= 0 and SecondsTillTime(0930) >= 0 then 0 else 1;
def pastten = if SecondsFromTime(0400) >= 0 and SecondsTillTime(1000) >= 0 then 1 else 0;
 
That makes so much sense now! Got it. I was mixing them up.

Do you take any relationship going from gap scan to mom scan, to filter the tickers.
I know you said focus on top 3 rV, like today EQ was not #1 even though it was the clear winner.

What I did was to look at the results and check the news for each one.


From your code, if I am in the west coast using PDT, do I need to change this time to 0630 instead of 0930 and 0100 instead of 0400?
#Check if time is premarket
def pmopen = if SecondsFromTime(0400) >= 0 and SecondsTillTime(0930) >= 0 then 1 else 0;
def pmclosed = if SecondsFromTime(0400) >= 0 and SecondsTillTime(0930) >= 0 then 0 else 1;
def pastten = if SecondsFromTime(0400) >= 0 and SecondsTillTime(1000) >= 0 then 1 else 0;

EQ was definitely #1 in RV today, then ECOR, then ANTE and they all spiked at some point. If you are in west coast, then change the times in the code like you said.
 
EQ was definitely #1 in RV today, then ECOR, then ANTE and they all spiked at some point. If you are in west coast, then change the times in the code like you said.
Thank you! @Sonny, yes, as you said it did up #1. morning time I checked it hadn't moved up the list. Makes sense the tool is dynamic.

I want to follow what zeek has requested to ask for a Column version in Watchlist that will show only pre-market volume (instead of label version)
1. Traded volume for pre-market. I only need it to show traded volume from 4:00AM to 09:30AM.
2. The RVOL in pre-market over a 10 day period comparing the relative volume only between 04:00AM to 09:30AM

Thank you.
 
@k8be

TOS does not keep track of premarket volume for different days so you cannot compare these values. The most important stat is relative volume, not just premarket volume. If the premarket relative volume is greater than 1, then you know that the RV for the day will be big. The PM volume as a column already exists as "Volume"!
 
@k8be

TOS does not keep track of premarket volume for different days so you cannot compare these values. The most important stat is relative volume, not just premarket volume. If the premarket relative volume is greater than 1, then you know that the RV for the day will be big. The PM volume as a column already exists as "Volume"!
Thank you.
 
@k8be P is current price (close), Ch is percent change from yesterday close, O is open price, C is percent change from open, and R is relative volume.
 
Hey Sonny, I have a watchlist column that shows volume over the last 30 minutes to give a sense of morning liquidity. How would I modify this to look for the volume for the last 30 minutes including both regular volume and pre-market volume? Thanks!
 
Last edited:

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
309 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