Volume Stats Format, Watchlist, Scan, Label for ThinkOrSwim

@jngy2k Had something similar idea in my wishlist for a while. maybe I could take sometime this weekend to testout some code. done right, we should be able to do what you want and more.

-S
 

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

There are so many changes and versions... can someone please share the link for latest indicator with all the settings options.
 
I think I fixed it. While at it tried to fold Pre-Market, 1H Market and Post-Market volumes added to the labels, must work Equity, if not with futures.

Code:
# 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.YELLOW);
# 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.YELLOW);
#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.YELLOW);
# End Volume PostMarket
Please advise why I can't get the line shown on volume graph?!
9R6tzKE.png

it seems no way to change/show color of the vol change line
9YFhuBx.png
 
@cswu1211 What, version of the code you grabbed? and I am assuming you are referring to Buy/Sell Color coding in the Volume area. If not please explain what Lines are you referring to.
 
@jngy2k did you see the thread i posted for you??
yeah i'm looking at it trying to figure it out
edit: benten unfortunately uses two functions that i can't incorporate into my study
1) GetTime() < RegularTradingStart(GetYYYYMMDD());
i'm using input for closing time and open time
and def secondstilltime to assign a value non 0 value in seconds
and that will record my premarket time in seconds
instead of assigning a specific date
i can move premarket time to actually anytime i want 1600-930 or even 2000-400
2) if BarNumber() == HighestAll(ONhighBar)
this function takes too much effort on the cpu.
i run thinkorswim on my laptop and rather use isnan
according to this https://tlc.thinkorswim.com/center/...dvanced/Chapter-12---Past-Offset-and-Prefetch

i'm learning from his code though so thanks for the link
 
Last edited:
Can someone quickly explain what the different colors on the volume bars represent? I can gather that green are buys and red are sells, but what about the dark green vs lighter neon green, and what about red vs orange.

Other than that the explanation given on this thread has been truly helpful. These are the exact type of labels I was looking for.
 
@LuKaSi
When the Sell Volume is increasing it's darker Red, Light Red with sell volume is decreasing,
Increase in Buy Volume is Dark Green, Light Green if the Buy volume is decreasing. Let me know if you have questions.
 
I'm looking for a simple total volume label that displays just like in the watchlist columns.

yN7VliI.png
 
@Alex This should work. Add it as a new indicator and move it to the upper section of your Studies list.

Code:
AddLabel(yes, Concat("Total Volume = ", volume), color.orange);
 
@Alex Here you go:

Code:
declare upper;

input aggregationPeriod = AggregationPeriod.DAY;
def vol = volume(period = aggregationPeriod);
AddLabel(yes, Concat("Total Volume = ", vol), color.orange);
 
@BenTen I noticed today during the pre market session that the volume label does not display the volume, while the watchlist volume does show. Any idea maybe why?
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
268 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