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:
Hi, I'm trying to program a script to plot the highest volume during the day (to be use in time frame 5m 1H).

I want to omit the first candle of the day due to that one is too big.

What i'm doing is comparing actual volume with last high, if Volume > Vol1 then Vol1== volume otherwise Vol1 hold the same value

If someone can give a hand I'll be glad and thankful
Code:
# Diego Leandro Suarez Solano
# Edit:01/03/2021
# Plot High Volume Line

declare lower;
declare once_per_bar;

input OpenTime = 0930;

def bn = BarNumber();
def nan = Double.NaN;
def sft = SecondsFromTime(OpenTime);

def vol1;
def vol = volume;
#def hv;

if sft==0
then
{
    vol1=0;
}
else
{
    if vol> vol1
    then
    {
    vol1=vol;
    }
    else
    {
        vol1=vol1;
    }
}

plot pvol = vol1;
pvol.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
 
@diego_suarez
here is
Highest Volume at Specified Time Frame
remember to thumbs up if you found this post useful.
Code:
#Highest Volume at Specified Time Frame
#By XeoNoX Via usethinkscript.com
declare lower;
input start_time = 0935;
input endtime = 1035;
def highervol = if GetLastDay() == GetDay() and SecondsFromTime(start_time) >= 0 and  0==0 and SecondsFromTime(endtime) < 0 and volume==volume and volume>volume[1] then volume else highervol[1];
plot study = highervol;
study.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
 
Last edited:
@diego_suarez
here is
Highest Volume at Specified Time Frame
remember to thumbs up if you found this post useful.
Code:
#Highest Volume at Specified Time Frame
#By XeoNoX Via usethinkscript.com
declare lower;
input start_time = 0935;
input endtime = 1035;
def highervol = if GetLastDay() == GetDay() and SecondsFromTime(start_time) >= 0 and  0==0 and SecondsFromTime(endtime) < 0 and volume==volume and volume>volume[1] then volume else highervol[1];
plot study = highervol;
study.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
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.
 
change the time and the painting strategy. if you want to skip the first bar just change the time, so 5 min chart would be start at 935 and 30 min chart would be 930 and so on. to draw line just change the painting strategy in the study settings or you can type it in.
 
Hi there,

I have this custom study i've made that finds the highest volume bar of the day and then times it by the price to give the total dollar value of that volume bar. I've been doing this on the 5 min chart as that's the value i'd like to see, the highest daily value within a 5 min time block, calculating it and then displaying it. I'm wondering if there is a way to have a custom script that does the exact same thing, calculating the 5 min dollar value for just the one day period and then displaying that calculation in the column. Thanks!

Code:
AddChartBubble(Volume ==  HighestAll(volume), close, "$" + volume, color.light_orange);
 
Hi there,

I have this custom study i've made that finds the highest volume bar of the day and then times it by the price to give the total dollar value of that volume bar. I've been doing this on the 5 min chart as that's the value i'd like to see, the highest daily value within a 5 min time block, calculating it and then displaying it. I'm wondering if there is a way to have a custom script that does the exact same thing, calculating the 5 min dollar value for just the one day period and then displaying that calculation in the column. Thanks!

AddChartBubble(Volume == HighestAll(volume), close, "$" + volume, color.light_orange);
that code just charts the highest volume on the entire chart, it doesnt times (multiply) anything with price.
 
i think i know what you wanted... highest volume of the day times its price

Money flow of the current day's highest volume bar ( as label or watchlist )
remember to leave a thumbs up if you found this post useful
Code:
#Forum Request March 18 2021 for thinkscript tos thinkorswim
#Money flow of the current day's highest volume bar ( as label or watchlist )
#(highest volume of the day times its price)
#by XeoNoX via usethinkscript.com
def highestvolofday  = highestall(if GetLastDay() == GetDay() and highestall(volume) then (volume) else double.nan);
def High_vol_Price =  if  volume == highestvolofday then high else High_vol_Price[1];
AddLabel (yes, "HighVol Price:  $" +  (High_vol_Price * highestvolofday )  );
 
i think i know what you wanted... highest volume of the day times its price

Money flow of the current day's highest volume bar ( as label or watchlist )
remember to leave a thumbs up if you found this post useful
Code:
#Forum Request March 18 2021 for thinkscript tos thinkorswim
#Money flow of the current day's highest volume bar ( as label or watchlist )
#(highest volume of the day times its price)
#by XeoNoX via usethinkscript.com
def highestvolofday  = highestall(if GetLastDay() == GetDay() and highestall(volume) then (volume) else double.nan);
def High_vol_Price =  if  volume == highestvolofday then high else High_vol_Price[1];
AddLabel (yes, "HighVol Price:  $" +  (High_vol_Price * highestvolofday )  );

Thank you! I found out how to find within 5 mins, i just had to change the time frame from D to 5 min. Is there a way to change the font color of values over $1M to say blue or something?
 
Last edited:
Hey thanks again for the code! I noticed when I sort from high to low or low to high, The numbers sort by $100,000, 10,000,000, $900,000, $9,000,000, $800,000, $8,000,000 etc... Is there a way to sort from actually high to low or low to high, so $10,000,000, $9,000,000, $8,000,000 etc...
 
remove the line
Code:
AddLabel (yes, "HighVol Price:  $" +  (High_vol_Price * highestvolofday )  );

and add the line:

Code:
Plot scan = High_vol_Price * highestvolofday;
 
remove the line
Code:
AddLabel (yes, "HighVol Price:  $" +  (High_vol_Price * highestvolofday )  );

and add the line:

Code:
Plot scan = High_vol_Price * highestvolofday;
Thanks so much! And just to check but i'm guessing I can't keep the "$" and comma structure like the way the label code had it?

Example: 8645908 (now) vs $8,645,905 (before)
 
Thanks so much! And just to check but i'm guessing I can't keep the "$" and comma structure like the way the label code had it?

Example: 8645908 (now) vs $8,645,905 (before)

The Thinkscript Learning Center is your friend... Had you researched there you should have found the AsDollars() function... Make it a habit to check there, and use the forums search feature, before posting questions as there is no need for us to answer the same questions repetitively or do members research for them...
 
The Thinkscript Learning Center is your friend... Had you researched there you should have found the AsDollars() function... Make it a habit to check there, and use the forums search feature, before posting questions as there is no need for us to answer the same questions repetitively or do members research for them...

Thanks for this. I've tried a couple different lines but it doesn't seem to be working for me...

Plot scan = AsDollars(High_vol_Price * highestvolofday);

nor,

Plot scan = AsDollars(High_vol_Price) * highestvolofday;
 
Thanks for this. I've tried a couple different lines but it doesn't seem to be working for me...

Plot scan = AsDollars(High_vol_Price * highestvolofday);

nor,

Plot scan = AsDollars(High_vol_Price) * highestvolofday;

You cannot use AsDollars() for a plot, unfortunately... It works perfectly for AddLabel(), however... Where are you looking to display this formatted number...??? AsDollars() works for custom watchlist columns, chart labels, and chart bubbles, using AddLabel() and AddChartBubble()... Plots are used for indicators...
 
Hi - just looking for a simple arrow (or any symbol) over the highest volume bar on the daily chart. Would love to highlight that bar and then eventually scan for recent 'highest volume bars' for stocks. I searched this forum -ahem- high and low, but to no avail.

Thanks, all!
 
Hi,

A newbie here. I wrote a simple script (copied mostly) to plot a line which represent high of day with highest volume. (in last N days).
Code is below.

Now I want the same plot to be shown on lower timeframes. When I switch to lower timeframes (line 30min, 15min, etc), the script automatically uses that timeframe to plot the graph. Can I still use DAY as period even in lower timeframes?

Code:
input n = 20;

def c = close;

def v = volume;

def h = high;

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];


plot hhLine = if x >= HighestAll(HighVolume)

              then HighestAll(if IsNaN(c) then hh else Double.NaN)

              else Double.NaN;

hhLine.SetDefaultColor(Color.ORANGE);
hhLine.SetLineWeight(3);
 

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