ThinkorSwim Plot Highest Volume Bar

XeoNoX

Expert
VIP
Lifetime
I was wondering if someone could help make this thinkscript, its just drawing HORIZONTAL lines at the price high and price low of the highest volume bar within the last 240 bars as pictured below. I get tired of manually having to do this all the time. Much appreciation if someone can help with this. Example below.

I can get this far in finding the highest volume bar, but i don't know how to plot it with the price lines.

Code:
input barsago = 240;

def HighestVolume =  Highest(volume, barsago);

gKNwn6I.png


Edit: Found this by Mobius. High Volume Nodes (plots the high/low price of the highest volume bar within x bars).

g08kAfS.png


Code:
# High Volume Nodes

# Mobius

# V01.02.2018

# Looks for the highest volume candle in "n" periods and plots the candle range.

# As Volatility increases this study has two values. Plotting a current high volume node as a channel which price will be drawn back to and test since a very high volume node will move price quickly, and price will retest that area. And, with the legacy plots a way to quickly see if larger traders, those that can generate a high volume node, are accumulating or distributing inventory.



input n = 20;

input LegacyPoints = yes;



def h = high;

def l = low;

def c = close;

def v = volume;

def x = barNumber();

def HighVolume = if ((v - Lowest(v, n)) / (Highest(v, n) - Lowest(v, n))) >= 1

                 then x

                 else Double.NaN;

def hh = if !IsNaN(HighVolume)

         then h

         else hh[1];

def ll = if !IsNaN(HighVolume)

         then l

         else ll[1];

plot hhLine = if x >= HighestAll(HighVolume)

              then HighestAll(if IsNaN(c)

                              then hh

                              else Double.NaN)

              else Double.NaN;

hhLine.SetDefaultColor(Color.GRAY);

plot llLine = if x >= HighestAll(HighVolume)

              then HighestAll(if IsNaN(c)

                              then ll

                              else Double.NaN)

              else Double.NaN;

llLine.SetDefaultColor(Color.GRAY);

plot legacy = if LegacyPoints and !IsNaN(HighVolume)

              then l - (2*TickSize())

              else Double.NaN;

legacy.SetStyle(Curve.POINTS);

legacy.SetLineWeight(3);

legacy.SetDefaultColor(Color.Gray);

AddCloud(llLine, hhLine, Color.GRAY, Color.GRAY);

# End Code High Volume Nodes
 
Last edited:
Hello everyone, I am looking for an indicator that will draw me a horizontal line at the top of the first volume bar (lower) with the market open, as well as to give me an alert of any subsequent volume exceeding this line drawn. I've looked everywhere and haven't found anything. Thanks in advance
 

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

@markos Hey, a valiant effort! It is probably easiest to capture the bar number where that high volume occurred and then note the high/low levels. After which you can then plot the lines forward from the bar number identified. I am working on this, should have this done in 5, maybe 10 minutes.

@XeoNoX Per your request, here is your COMPLETED study. I have used the input of 240 bars that you mentioned in your description. This can be configurable in the user interface.

Here is the methodology - As with most things in the ThinkScript world, it would simplify things if you captured the bar number when the event took place. Then take note of the high/low at the bar number. Then you can do your plots forward from that bar number to the end of the chart. I have tested this against both intraday as well as daily, and ran it against charts of PCG (think that was your exmaple), AAPL, FB, etc

Here then is your study

Code:
# Plots High/Low Price at Highest Volume
# tomsk
# 12.4.2019

input barsago = 240;

def bar = barNumber();
def HighVolBar = if ((volume - Lowest(volume, barsago)) /
                     (Highest(volume, barsago) - Lowest(volume, barsago))) >= 1
                 then bar
                 else Double.NaN;
def VolHighLevel = if !IsNaN(HighVolBar) then high else VolHighLevel[1];
def VolLowLevel = if !IsNaN(HighVolBar) then low else VolLowLevel[1];

plot HighLine = if bar >= HighestAll(HighVolBar) then VolHighLevel else Double.NaN;
plot LowLine = if bar >= HighestAll(HighVolBar) then VolLowLevel else Double.NaN;

HighLine.SetDefaultColor(Color.CYAN);
HighLine.SetLineWeight(3);
LowLine.SetDefaultColor(Color.YELLOW);
LowLine.SetLineWeight(3);
# End Plots High/Low Price at Highest Volume
Hi! Is there way to ADD second or third highest bar dates within the same time frame and plot them at the same time?!
 
That is a standard way of comparing range of high-low volumes across an extended period.
Compute the ratio divided by the range of the high-low volume.

If the value that is returned is > 1 then you got your higher volume scenario.
Let's say the ratio returned is 0.4, then you immediately know that you're running at 40% of the high-low volume

It does this computation as it works through every single bar across the chart
Double.NaN is the standard ThinkScript way of assigning NO VALUE
It's just the way I've learnt to do this.

EDIT: I thought it might be instructive to illustrate this by way of a simple example
Let's say you are trading AMZN and want to know how it is performing relative to it's high to low range
Run the following script and you'll see that it is at 18%, so not doing too good today.
Compare that with a ticker symbol of AAPL, it is running at about 68% so is doing good today
That is the general principle I was using in my calculations above.

Code:
# Range Performance
# tomsk
# 12.5.2019

input symb = "AMZN";

def h = high(symbol = symb, period = AggregationPeriod.DAY);
def l = low(symbol = symb, period = AggregationPeriod.DAY);
def c = close(symbol = symb, period = AggregationPeriod.DAY);
def R = (c - l) / (h - l);

AddLabel(1, symb + " currently at " + AsPercent(R) + " of daily range", Color.Yellow);
# End Range Performance
How to revise the script {input symb = "AMZN";} to fit any stock for range performance?
 
@tradeking313 Per your request here is a chart label that displays highest volume of the year together with the date that was traded.
make sure you run this on a DAILY aggregation. Interesting to note that on a stock like AAPL, the highest volume was precisely one year ago, on 1/3/2019. Have fun running this against your favorite stocks!

Code:
# Highest Daily Volume Label
# tomsk
# 1.3.2020

declare hide_on_intraday;

def H = volume == HighestAll(volume);
def HV = if H then volume else HV[1];
def MM = HighestAll(if H then GetMonth() else Double.NaN);
def DD = HighestAll(if H then GetDayOfMonth(GetYYYYMMDD()) else Double.NaN);
def YY = HighestAll(if H then GetYear() else Double.NaN);
AddLabel(1, "Highest Daily Volume (" + HV + ") Traded On " + MM + "/" + DD + "/" + AsPrice(YY), Color.Yellow);
# End Highest Daily Volume Label
How to change the lookback period to be flexiable: 30D, 60D, 90D....And to modify to find the second, third largest volume bars over the same period?
 
@markos Hey, a valiant effort! It is probably easiest to capture the bar number where that high volume occurred and then note the high/low levels. After which you can then plot the lines forward from the bar number identified. I am working on this, should have this done in 5, maybe 10 minutes.

@XeoNoX Per your request, here is your COMPLETED study. I have used the input of 240 bars that you mentioned in your description. This can be configurable in the user interface.

Here is the methodology - As with most things in the ThinkScript world, it would simplify things if you captured the bar number when the event took place. Then take note of the high/low at the bar number. Then you can do your plots forward from that bar number to the end of the chart. I have tested this against both intraday as well as daily, and ran it against charts of PCG (think that was your exmaple), AAPL, FB, etc

Here then is your study

Code:
# Plots High/Low Price at Highest Volume
# tomsk
# 12.4.2019

input barsago = 240;

def bar = barNumber();
def HighVolBar = if ((volume - Lowest(volume, barsago)) /
                     (Highest(volume, barsago) - Lowest(volume, barsago))) >= 1
                 then bar
                 else Double.NaN;
def VolHighLevel = if !IsNaN(HighVolBar) then high else VolHighLevel[1];
def VolLowLevel = if !IsNaN(HighVolBar) then low else VolLowLevel[1];

plot HighLine = if bar >= HighestAll(HighVolBar) then VolHighLevel else Double.NaN;
plot LowLine = if bar >= HighestAll(HighVolBar) then VolLowLevel else Double.NaN;

HighLine.SetDefaultColor(Color.CYAN);
HighLine.SetLineWeight(3);
LowLine.SetDefaultColor(Color.YELLOW);
LowLine.SetLineWeight(3);
# End Plots High/Low Price at Highest Volume
This is amazing and it works great! THANK YOU! Would it be possible to take start and end time as use inputs instead of barsago? For example, plot lines for high/low of the candle with the highest volume between 0800 and 0930 (extend the line until end of the day)?
 
Thanks for your help and replay @XeoNoX
May be I have something wrong if my setup, because your code did not plot anything figure to me.

What I'm trying to do is a dynamic plot that show during the day from 9:30 to 16:00 the highest volume. Plot a horizontal line from the highest volume till the end of the day. The starting point is the second bar from the frame time. Each time the actual volume is higher than the last the line must change.
Did anyone finally figure out how to plot the highest volume for each day vs. using a hard look back number
 
@markos Hey, a valiant effort! It is probably easiest to capture the bar number where that high volume occurred and then note the high/low levels. After which you can then plot the lines forward from the bar number identified. I am working on this, should have this done in 5, maybe 10 minutes.

@XeoNoX Per your request, here is your COMPLETED study. I have used the input of 240 bars that you mentioned in your description. This can be configurable in the user interface.

Here is the methodology - As with most things in the ThinkScript world, it would simplify things if you captured the bar number when the event took place. Then take note of the high/low at the bar number. Then you can do your plots forward from that bar number to the end of the chart. I have tested this against both intraday as well as daily, and ran it against charts of PCG (think that was your exmaple), AAPL, FB, etc

Here then is your study

Code:
# Plots High/Low Price at Highest Volume
# tomsk
# 12.4.2019

input barsago = 240;

def bar = barNumber();
def HighVolBar = if ((volume - Lowest(volume, barsago)) /
                     (Highest(volume, barsago) - Lowest(volume, barsago))) >= 1
                 then bar
                 else Double.NaN;
def VolHighLevel = if !IsNaN(HighVolBar) then high else VolHighLevel[1];
def VolLowLevel = if !IsNaN(HighVolBar) then low else VolLowLevel[1];

plot HighLine = if bar >= HighestAll(HighVolBar) then VolHighLevel else Double.NaN;
plot LowLine = if bar >= HighestAll(HighVolBar) then VolLowLevel else Double.NaN;

HighLine.SetDefaultColor(Color.CYAN);
HighLine.SetLineWeight(3);
LowLine.SetDefaultColor(Color.YELLOW);
LowLine.SetLineWeight(3);
# End Plots High/Low Price at Highest Volume
Nice one Tom. Thank you . Is there any way to scan whether any stocks/ etfs has the HIghest Volume Ever (HVE) printed on this month / earnings season ( Volume compared to last 2 years) . Like PLTR's volume on 02/06/2024

Nice one Tom. Thank you . Is there any way to scan whether any stocks/ etfs has the HIghest Volume Ever (HVE) printed on this month / earnings season ( Volume compared to last 2 years) . Like PLTR's volume on 02/06/2024
Can anyone share some thoughts on how to scan for Highest Volume ever in TOS? ( Like TSM today )
 
Last edited by a moderator:
Nice one Tom. Thank you . Is there any way to scan whether any stocks/ etfs has the HIghest Volume Ever (HVE) printed on this month / earnings season ( Volume compared to last 2 years) . Like PLTR's volume on 02/06/2024


Can anyone share some thoughts on how to scan for Highest Volume ever in TOS? ( Like TSM today )

Sadly no.
The data feeds do not carry that amount of history.

Each timeframe only goes back so far:
1 to 30 min 15 astronomical days
1 to 4 hours 270 astronomical days
1 to 4 days 4 years
Week 6 years
 
Nice one Tom. Thank you . Is there any way to scan whether any stocks/ etfs has the HIghest Volume Ever (HVE) printed on this month / earnings season ( Volume compared to last 2 years) . Like PLTR's volume on 02/06/2024


Can anyone share some thoughts on how to scan for Highest Volume ever in TOS? ( Like TSM today )

you might want to check out this thread for HVE and other "highest volume" related studies https://usethinkscript.com/threads/highest-volume-labels.19017/
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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