Volume Stats Format, Watchlist, Scan, Label for ThinkOrSwim

@SuryaKiranC i search tradingview screener for todays premarket volume and compared to the volume indicator premark vol are incorrect.
the code gives 1 million more volume for some stocks. then i backtested on tos and found the 1sthour vol started adding up before market opened at 930.
 
@jngy2k Ok, I have always had this debate with myself, but never extended to test this out on some low volume stock myself. so, for the part about Pre-Market and RTH1Hr, I think the fix should be 1 min before what is current default configured.

Code:
input PreendTime = 0929;
input RTH1HrendTime = 1029;

as for PostendTime, guess we don't have to worry about this since we stop trading at that sec anyways. After changing this I shifted through multiple timeframes and got the same results across timeframes. Will looking to the other issue as well. Please verify multiple tickers with PreMKt Volumes against TradingView.

Thanks for extensive testing.
-S
 
Last edited:
@jngy2k Here is the breakdown.

First Off all Buy/Sell Volume used to be a separate script with colored histogram on volume bars, I have added it to this one on request.
  • W/D Buy/Sell Volume Higher timeframe volumes, if you are on mins charts automatically shows Current days Buys/Sell Volumes and percentage. if you are on 1D charts shows 1W Buy/Sell Volumes and percentage. you need to enable this by setting "yes" for "show higher vol stats" ## Note Available from version 1.5.1 from next page only.
  • Buy/Sell volume always shows the % of Buy vs Sell on the current candle in any given timeframe. When the ticker is done trading they are not displaying any info, except for higher timeframes, 1D and above.
  • 30DAvg, This is self explained. Just incase 30 Days is what the script default and this is changeable, at script properties, no need to edit code. Incase, if somebody prefers a different length.
  • Day: is todays Volume, during the day along with Pre/Post market hours this will keep showing the day volume. And is "RED" till it cross 30D Avg, "LIME" on cross, "GREEN" on 150% of 30D Avg volume.
  • Day-1 - Day-4 are "Day minus 1" to "Day minus 4", basically last 4 days in the order the candles would appear on 1D charts, and are visible by default on 1D charts, Ex: 1Y 1D, 180 1D, or any other 1D time frames you may have configured, These are disabled by default on Lower Timeframes, but can be enabled as script properties if somebody prefers to see them on lower time frame charts, Ex: 1m, 5m, 15m or 1H.
  • Unlabeled White box next to "Day" is volume in % for someone who prefers, and is compared with 30D Avg, or defined Avg if someone has a custom length.
  • 30BarAvg, is again self explained, basically 30Bars on your timeframe, it is redundant when you are on a 1D chart. unless you have. As of now both Avg Days and number of Bars use the same input variable in script called "length" hence, if you change the property of the script and define length to 45 or 60, the AvgBar count would change too.
  • Both DayAvg and BarAvg labels are dynamic and represent the input value for "length". Should anybody were to change the length property it will display appropriate value in the label.
  • CurBar, is literally what it says, volume on current bar on your chart timeframe.
  • rVol, is Relative Volume basically used by some traders to gaze the % of volume in comparison to previous trading session. it's round value of (DayVol / 30Day Avg)
  • PreMktVol, is Pre-Market Volume of the day, starting at 4:00 AM EST.
  • RTH1HrVol, is Real Trade Hours 1st hour Volume.
  • PostMktVol, is after 4:00 PM EST Volume, till extended hours of trading is closed.
  • Pre/RTH1Hr/PostVol(s) are displayed only on lower timeframe charts, Ex: 1m, 5m, 15m, 1H or 4H.
Hope that helps. Following is are the list of improvement, I want to do, at sometime.
  • Want to be able to identify futures tickers and have a different time period definitions for Pre/Post Volume calculations as they trade differently.
  • Want to be able to compare the volume against the previous days same time frame of same time period of the previous day, to be able to make trade judgements. Ex: AAPL, 9:30AM - 11:30 AM is 20% volume of previous session, and today same time period is more 30%, We could anticipate it's possibly a hight volume day.
Let me know if you think I skipped any details.

**Note : Additional details added for newer version here instead of repeating this post.


Hi @SuryaKiranC - is there a way we can add these volume bars to the upper chart
Conditions -
1. Complete Red Candle (sell) - should print red arrow of size 3 or 5
2. if sell > buy 75% or 80% volume - should be of size 2 Red arrow
3. if sell ~ buy size like 49/51 or 51/49 % then the red arrow of size 1 if previous arrows were all red else if the previous arrow were green then green
4. if Green Candle (buy) - should print green arrow size of 3 or 5
5. if buy > sell 75% or 80% volume - should be of size 2 green arrow

thank you so much in advance!
 
@jngy2k here is the screenshot for your reference with 5D 5M chart.

Z2qpqBT.png


this is awesome you guys rock. Please share the setup. the count for 1-13 is awesome. thank you again!
I am going to each page and lost at this as didn't knew where to get all this script. I am on 1.5.1 version right now
 
this is awesome you guys rock. Please share the setup. the count for 1-13 is awesome. thank you again!
I am going to each page and lost at this as didn't knew where to get all this script. I am on 1.5.1 version right now

Instead of re-posting the code everytime. I kept replacing the code https://usethinkscript.com/threads/custom-thinkscript-volume-stats-for-thinkorswim.970/post-33275, if your version reads 1.5.1 you are current. Only other change I have done and not posted is, put those volume labels in Millions to make it easy on the eyes. the 1-13 counter is a TOS default study called "SequenceCounter" nothing to do with my labels though.
 
Hi @SuryaKiranC - is there a way we can add these volume bars to the upper chart
Conditions -
1. Complete Red Candle (sell) - should print red arrow of size 3 or 5
2. if sell > buy 75% or 80% volume - should be of size 2 Red arrow
3. if sell ~ buy size like 49/51 or 51/49 % then the red arrow of size 1 if previous arrows were all red else if the previous arrow were green then green
4. if Green Candle (buy) - should print green arrow size of 3 or 5
5. if buy > sell 75% or 80% volume - should be of size 2 green arrow

thank you so much in advance!

Just the labels as upper study shouldn't be a big deal, but adding arrows or indicating using this data on any candle though would be lagging in my opinion. That would be another lagging indicator. There are many other methods and mechanisms to indicate Momentum.
 
Thank you @SuryaKiranC. My only challenge to identify if to identify pressure on either side. I tried looking into many indicator but none of these have that feature. this volume is the closest. I see another indicator which is called volume projection which is good but the graph is very complicated :) thank you again for quick response.
 
Hello,
I would like to add two more colors to the label below, but am having trouble wrapping my head around it. I'm not a coder, I can do little basics but that's about it.

AddLabel(ShowSellVolumePercent, "Cur Bar Sell %: " + SellVolPercent, (if SellVolPercent > 85 then Color.RED else if SellVolPercent < 15 then Color.GREEN else Color.GRAY));

What I'm looking to do is when the percent is 70 to 84, the label would be yellow. 85 or above it would be red. Conversely, if the percent is between 30 to 16, the label is light blue, and 15 or lower it is green. Is this possible? Thank you.
 
@Rojo Grande

Try something like the below. I used your examples. Beware there is a gap between 30 - 70 % with no color assignment, either adjust the numbers or add one more condition.

AddLabel(ShowSellVolumePercent, "Cur Bar Sell %: " + SellVolPercent, (if SellVolPercent > 85 then Color.RED else if SellVolPercent <= 70 and SellVolPercent >74 then Color.Yellow else if SellVolPercent <30 and SellVolPercent >16 then Color.Light_Blue else Color.GRAY));
 
@SuryaKiranC

Is there any way to hide the "D buy" and "D sell" labels?

While I love this indicator, my eyes get so busy having all 4 "D buy/sell" and "buy/sell" labels next to one another. Thank you

rpTFe6I.png
 
@Rojo Grande

Try something like the below. I used your examples. Beware there is a gap between 30 - 70 % with no color assignment, either adjust the numbers or add one more condition.

AddLabel(ShowSellVolumePercent, "Cur Bar Sell %: " + SellVolPercent, (if SellVolPercent > 85 then Color.RED else if SellVolPercent <= 70 and SellVolPercent >74 then Color.Yellow else if SellVolPercent <30 and SellVolPercent >16 then Color.Light_Blue else Color.GRAY));
Thank you. It gives me the following error.


xlgHsaf.png
Thank you. It gives me the following error
 
@twitty_twit my bad for now watching the thread over the weekend. most of the labels are on and off, at script property levels. Look for "ShowHigherVolStats" and set this to no should turn them off on IntraDay charts.
 
Last edited:
@twitty_twit BTW, if the numbers are too much to process, you could easily convert those to Millions. the addition is " * .000001" in the formula and +"M" next to it in practically all labels that are related to Volumes or Price.


EX:
AddLabel(ShowTodayVolume, "Day: " + Round(Vol * .000001, 2) + " M ", (if PercentOfDayAvg >= UnusualVolumePercent then Color.GREEN else if PercentOfDayAvg >= 100 then Color.LIME else Color.RED));
 
I revisited this indicator for trading and research the other day and found where there can be more value that can be added to the indicator. Most value is if we can grab average volume for the previous 180 days for the premarket and first hour of trading. Why 180 days is because thinkorswim cannot capture the intraday minutes and premarket data more than 180 days. Having premarket and first hour average volume for the previous 180 days is important because it gives the user an early signal of high relative volume during those hours of trading. A higher relative volume in those early hours will mean more price action in coming hours. Right now I use Volume avg and compare the volume for today to the avg but it is a slower signal of high relative volume because it gives daily volume instead of intraday volume. Knowing earlier if there is higher volume with the previous premarket and 1st hour volume data is a huge edge.
Anyone know how to code for the capture of previous 180 days data?
Code:
input PrestartTime = 0400;
input PreendTime = 0930;
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: " + Round(PreVolMins * .000001, 2) + "M", Color.YELLOW);
This is @SuryaKiranC code for Premarket.
 

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