All Buy / Sell Volume Pressure Indicators & Labels For ThinkOrSwim

Good Afternoon,
I was seeing if anybody could convert this to ThinkorSwim
Volume Trend Meter - Trading View
https://www.tradingview.com/script/ywEEvEtI-Volume-Trend-Meter/

Is this possible to be converted to thinkorswim?
Author states:
The indicator sums up all green candles volume and red candles volumes over a specific period of bars (you set in settings) and plots their values.
Use this indicator to identify increasing volume with the green candles (close higher than open) and increasing volume of the red candles (close is lower than open).

======= Calculation ==========
For Green Column: Total volume of green candles is higher than total red candles volume.
For Red Column: Total volume of red candles is higher than total green candles volume.
DvrmnuS.png


find below. I added price and volume trend meter along with MTF option

CSS:
#// This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License https:/
#// © dman103
#// Sweet little indicator which measures volume pressure over a specific period of time.
#// The indicator sums up all green candles volume and red candles volumes over a specific period of bars (you set in settings) and plots their values.
#// Use this indicator to identify increasing volume with the green candles (close bigger than open) and increasing volume of the red candles (close is smaller than open).
#study("Price/Volume Trend Meter","PVTM",overlay=false)
# Converted by Sam4Cok@Samer800     - 02/2024
Declare Lower;

input useChartTimeframe = yes;
input customTimeframe = AggregationPeriod.FIFTEEN_MIN;
input source = FundamentalType.CLOSE;
input PreviousBarsToCheck = 9;
input PositiveValuesOnly = no;
input calculationType = {Default "Volume Trend", "Price Trend"};

def na = Double.NaN;
def last = isNaN(close);
def tf = GetAggregationPeriod();
def v = volume(Period = if useChartTimeframe then tf else customTimeframe);
def o = open(Period = if useChartTimeframe then tf else customTimeframe);
def c = Fundamental(FundamentalType = source, Period = if useChartTimeframe then tf else customTimeframe);
def vol = calculationType==calculationType."Volume Trend";
def src = calculationType==calculationType."Price Trend";

def up = c > o;
def vol_up = sum(if up then v else 0, PreviousBarsToCheck);
def vol_dn = sum(if up then 0 else v, PreviousBarsToCheck);
def src_up = sum(if up then c else 0, PreviousBarsToCheck);
def src_dn = sum(if up then 0 else c, PreviousBarsToCheck);

def total_up_dn_vol = (vol_up - vol_dn);
def total_up_dn_src = (src_up - src_dn);

def col = if total_up_dn_src>0 and total_up_dn_vol>0 then  2 else
          if total_up_dn_src<0 and total_up_dn_vol<0 then -2 else
          if (col[1]== 2 or col[1]== 1) then  1 else
          if (col[1]==-2 or col[1]==-1) then -1 else 0;

plot volHist = if !vol or last then na else
               if PositiveValuesOnly then AbsValue(total_up_dn_vol) else total_up_dn_vol;
volHist.SetPaintingStrategy(PaintingStrategy.SQUARED_HISTOGRAM);
volHist.AssignValueColor(if col== 2 then Color.GREEN else
                         if col== 1 then Color.DARK_GREEN else
                         if col==-2 then Color.RED else
                         if col==-1 then Color.DARK_RED else Color.RED);

plot priceHist = if !src or last then na else
                 if PositiveValuesOnly then AbsValue(total_up_dn_src) else total_up_dn_src;
priceHist.SetPaintingStrategy(PaintingStrategy.SQUARED_HISTOGRAM);
priceHist.AssignValueColor(if col== 2 then Color.GREEN else
                         if col== 1 then Color.DARK_GREEN else
                         if col==-2 then Color.RED else
                         if col==-1 then Color.DARK_RED else Color.RED);


#-- END of CODE
 
Last edited by a moderator:
Author states:
The indicator sums up all green candles volume and red candles volumes over a specific period of bars (you set in settings) and plots their values.
Use this indicator to identify increasing volume with the green candles (close higher than open) and increasing volume of the red candles (close is lower than open).

======= Calculation ==========
For Green Column: Total volume of green candles is higher than total red candles volume.
For Red Column: Total volume of red candles is higher than total green candles volume.
DvrmnuS.png


find below. I added price and volume trend meter along with MTF option

CSS:
#// This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License https:/
#// © dman103
#// Sweet little indicator which measures volume pressure over a specific period of time.
#// The indicator sums up all green candles volume and red candles volumes over a specific period of bars (you set in settings) and plots their values.
#// Use this indicator to identify increasing volume with the green candles (close bigger than open) and increasing volume of the red candles (close is smaller than open).
#study("Price/Volume Trend Meter","PVTM",overlay=false)
# Converted by Sam4Cok@Samer800     - 02/2024
Declare Lower;

input useChartTimeframe = yes;
input customTimeframe = AggregationPeriod.FIFTEEN_MIN;
input source = FundamentalType.CLOSE;
input PreviousBarsToCheck = 9;
input PositiveValuesOnly = no;
input calculationType = {Default "Volume Trend", "Price Trend"};

def na = Double.NaN;
def last = isNaN(close);
def tf = GetAggregationPeriod();
def v = volume(Period = if useChartTimeframe then tf else customTimeframe);
def o = open(Period = if useChartTimeframe then tf else customTimeframe);
def c = Fundamental(FundamentalType = source, Period = if useChartTimeframe then tf else customTimeframe);
def vol = calculationType==calculationType."Volume Trend";
def src = calculationType==calculationType."Price Trend";

def up = c > o;
def vol_up = sum(if up then v else 0, PreviousBarsToCheck);
def vol_dn = sum(if up then 0 else v, PreviousBarsToCheck);
def src_up = sum(if up then c else 0, PreviousBarsToCheck);
def src_dn = sum(if up then 0 else c, PreviousBarsToCheck);

def total_up_dn_vol = (vol_up - vol_dn);
def total_up_dn_src = (src_up - src_dn);

def col = if total_up_dn_src>0 and total_up_dn_vol>0 then  2 else
          if total_up_dn_src<0 and total_up_dn_vol<0 then -2 else
          if (col[1]== 2 or col[1]== 1) then  1 else
          if (col[1]==-2 or col[1]==-1) then -1 else 0;

plot volHist = if !vol or last then na else
               if PositiveValuesOnly then AbsValue(total_up_dn_vol) else total_up_dn_vol;
volHist.SetPaintingStrategy(PaintingStrategy.SQUARED_HISTOGRAM);
volHist.AssignValueColor(if col== 2 then Color.GREEN else
                         if col== 1 then Color.DARK_GREEN else
                         if col==-2 then Color.RED else
                         if col==-1 then Color.DARK_RED else Color.RED);

plot priceHist = if !src or last then na else
                 if PositiveValuesOnly then AbsValue(total_up_dn_src) else total_up_dn_src;
priceHist.SetPaintingStrategy(PaintingStrategy.SQUARED_HISTOGRAM);
priceHist.AssignValueColor(if col== 2 then Color.GREEN else
                         if col== 1 then Color.DARK_GREEN else
                         if col==-2 then Color.RED else
                         if col==-1 then Color.DARK_RED else Color.RED);


#-- END of CODE

You're awesome! Thanks @samer800!
 
What's the proper way to interpret the Dev Increase and Dev Decrease, what does this mean, and what action would someone take when these bars occur?
 
What's the proper way to interpret the Dev Increase and Dev Decrease, what does this mean, and what action would someone take when these bars occur?
Please provide the script that you are referring to.
A quick perusal of the 9 pages of this thread, did not locate the use of the variables that you are referencing.
Perhaps you are looking at a different thread?
 
Last edited:
Hello All,

Can anyone please help me with a script that shows the up/down volume ratio as histogram bars? I would like to use it on any aggregation period.

Thank you
 

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