Yeah, only because the two before that are more meant to show you the raw numbers. With the third, it's imitating a MACD in a sense using values from the second indicator. But without exponential smoothing, the changes from one bar to the next were too erratic to really get any useful information out of it. The fast line of the indicator would fluctuate dramatically and cross below and above the signal line too often, giving far too many signals that are mostly unimportant making it difficult to discern anything of significant importance between the signals. I can always provide the code if you want to add exponential smoothing to the other two indicators if that's why you're asking. That's not a problem, I just personally don't think it's all that important to include it with the first two indicators because they're meant to show the raw volume as percentages of the candle. The raw numbers are a more important aspect with those particular indicators, in my opinion. Doesn't mean I can't include that as an option by any means, just giving you my two cents on it, but who knows it's always possible that someone sees something of more significant importance that I may have not thought about or overlooked.@jmancsn you add exponential smoothing option for the 3rd indicator?
Are you talking about the Buy And Sell Volume Pressure Averages or the BSVPACD or both? Either way, I'm sure I can implement it in either one. However, unless someone is able to answer for me whether it's possible to have an indicator display both on the chart and below the chart and how to do that, I'd have to provide a copy of either indicator that doesn't display on the bottom and only displays the arrows on the price chart itself, if that's what you're intending to accomplish.Would it be possible to add green and red arrows to the respective crossovers (whether that's in addition to or instead of the labels)?
The problem with labels is that they don't stay on the chart and therefore lose out on the history of the data.
Thank youFirst, I'll start by saying I think someone else has posted a similar base indicator for the indicators I'm about to post here, but I didn't look into the details of their calculations.
I first started by creating an indicator that essentially separates buy volume pressure from sell volume pressure. The calculation is as follows:
Buy Volume Pressure = ((high - open) + (close - low)) / 2 / (high - low) * volume
Sell Volume Pressure = ((low - open) + (close - high)) / 2 / (high - low) * volume
Edit: Below, I did my best to draw up a visual description using paint 3D of how my calculations of "Buying And Selling Volume Pressure" work. Also, I made the realization that I forgot to include "/ (high - low)" before "* volume" in the visual descriptions. Please forgive me for that for now until I update the image.
View attachment 3238
The Buy Volume Pressure is always a positive number while the Sell Volume Pressure is always a negative number. I simply call this indicator "Buy And Sell Volume Pressure" since it outputs a percentage of the volume as "Buying" or "Selling" Pressure. It also includes labels for the total volume, total buy volume pressure, and total sell volume pressure. Here's the code for the Buy And Sell Volume Pressure indicator:
Edit: Because someone asked for the percentages of buying and selling volume pressure for another indicator included in this thread, I've decided to include labels for that in this indicator as well (the code below has been updated):
Code:declare lower; def buyvol = Round(((high - open) + (close - low)) / 2 / (high - low) * volume(), 0); def sellvol = Round(((low - open) + (close - high)) / 2 / (high - low) * volume(), 0); def buyvolper = buyvol / volume() * 100; def sellvolper = absValue(sellvol) / volume() * 100; plot Zero = 0; plot BuyVolume = buyvol; plot SellVolume = sellvol; BuyVolume.setPaintingStrategy(paintingStrategy.HISTOGRAM); BuyVolume.setDefaultColor(color.GREEN); SellVolume.setPaintingStrategy(paintingStrategy.HISTOGRAM); SellVolume.setDefaultColor(color.RED); addLabel(yes, "Total Volume: " + volume(), color.LIGHT_GRAY); addLabel(yes, "Buy Volume: " + buyvol, color.GREEN); addLabel(yes, "Sell Volume: " + absValue(sellvol), color.RED); addLabel(yes, "BVP%: " + buyvolper, color.GREEN); addLabel(yes, "SVP%: " + sellvolper, color.RED);
The next indicator I created is a two average indicator, an average for buy volume pressure and an average for sell volume pressure. The average types and lengths are adjustable. In this case, I used the absolute value rather than the negative number output of the sell volume pressure for the sell volume pressure average. When the buy volume pressure average crosses above the sell volume pressure average it indicates that buy volume pressure is increasing at a faster rate than sell volume pressure and vice versa, or you could say if the buy volume pressure average crosses below the sell volume pressure average buy volume pressure is decreasing at a faster rate than sell volume pressure and vice versa. Here's the code for the Buy And Sell Volume Pressure Averages indicator:
Code:declare lower; input AvgTypes = averageType.EXPONENTIAL; input BuyVolumeAvgLength = 18; input SellVolumeAvgLength = 18; def buyvol = Round(((high - open) + (close - low)) / 2 / (high - low) * volume(), 0); def sellvol = Round(((low - open) + (close - high)) / 2 / (high - low) * volume(), 0); def buyvolavg = MovingAverage(AvgTypes, buyvol, BuyVolumeAvgLength); def sellvolavg = MovingAverage(AvgTypes, absValue(sellvol), SellVolumeAvgLength); plot BuyVolumeAverage = buyvolavg; plot SellVolumeAverage = sellvolavg; BuyVolumeAverage.setDefaultColor(color.GREEN); SellVolumeAverage.setDefaultColor(color.RED);
Last but certainly not least, I came up with a Buy And Sell Volume Pressure Average Convergence Divergence (BSVPACD) indicator. This indicator works and looks very similar to the MACD (Moving Average Convergence Divergence) indicator, however it is based on the Buy And Sell Volume Pressure Averages, can give slightly earlier signals than the MACD indicator, and divergences are more pronounced than on the MACD indicator (I honestly don't know if this has to do with the particular default settings I picked for it). What this indicator does is it calculates the difference between the Buy Volume Pressure Average and the Sell Volume Pressure Average, plots that difference, then plots an average of the difference between the two averages (the signal line), and finally plots the difference between the difference of the Buy Volume Pressure and Sell Volume Pressure Averages and the signal line as a histogram just like MACD. The average types and lengths are all adjustable. I've also included an option that exponentially smooths the difference between the Buy And Sell Volume Pressure Averages that's toggled on by default due to the fact that the change in the difference tends to be somewhat erratic. You can also change the smoothing factor which is set to 3 by default. Here's the code for the BSVPACD indicator:
Code:declare lower; input AvgTypes = averageType.EXPONENTIAL; input BuyVolumeAvgLength = 18; input SellVolumeAvgLength = 18; input ExponentialSmoothing = yes; input SmoothingFactor = 3; input SignalType = averageType.EXPONENTIAL; input SignalLength = 9; def buyvol = Round(((high - open) + (close - low)) / 2 / (high - low) * volume(), 0); def sellvol = Round(((low - open) + (close - high)) / 2 / (high - low) * volume(), 0); def buyvolavg = MovingAverage(AvgTypes, buyvol, BuyVolumeAvgLength); def sellvolavg = MovingAverage(AvgTypes, absValue(sellvol), SellVolumeAvgLength); def diff = if ExponentialSmoothing == yes then ExpAverage(ExpAverage(ExpAverage(buyvolavg - sellvolavg, SmoothingFactor), SmoothingFactor), SmoothingFactor) else buyvolavg - sellvolavg; def sigline = MovingAverage(SignalType, diff, SignalLength); def hist = diff - sigline; plot BSVACD = diff; plot SignalLine = sigline; plot Zero = 0; plot Histogram = hist; Histogram.setPaintingStrategy(paintingStrategy.HISTOGRAM); Histogram.assignValueColor(if hist > 0 and hist > hist[1] then color.GREEN else if hist > 0 and hist < hist[1] then color.DARK_GREEN else if hist < 0 and hist < hist[1] then color.RED else color.DARK_RED);
A screenshot of the indicators below a price chart of the SPY (from top to bottom, Buy And Sell Volume Pressure, Buy And Sell Volume Pressure Averages, and BSVPACD):
View attachment 3239
A screenshot of the BSVPACD compared to the MACD (MACD up top, BSVPACD on bottom):
View attachment 3240
Happy Trading!
declare lower;
input AvgTypes = averageType.EXPONENTIAL;
input BuyVolumeAvgLength = 18;
input SellVolumeAvgLength = 18;
input ExponentialSmoothing = yes;
input SmoothingFactor = 3;
input SignalType = averageType.EXPONENTIAL;
input SignalLength = 9;
def buyvol = Round(((high - open) + (close - low)) / 2 / (high - low) * volume(), 0);
def sellvol = Round(((low - open) + (close - high)) / 2 / (high - low) * volume(), 0);
def buyvolavg = MovingAverage(AvgTypes, buyvol, BuyVolumeAvgLength);
def sellvolavg = MovingAverage(AvgTypes, absValue(sellvol), SellVolumeAvgLength);
def diff = if ExponentialSmoothing == yes then ExpAverage(ExpAverage(ExpAverage(buyvolavg - sellvolavg, SmoothingFactor), SmoothingFactor), SmoothingFactor) else buyvolavg - sellvolavg;
def sigline = MovingAverage(SignalType, diff, SignalLength);
def hist = diff - sigline;
plot BSVACD = diff;
plot SignalLine = sigline;
plot Zero = 0;
plot Histogram = hist;
Histogram.setPaintingStrategy(paintingStrategy.HISTOGRAM);
Histogram.assignValueColor(if hist > 0 and hist > hist[1] then color.GREEN else if hist > 0 and hist < hist[1] then color.DARK_GREEN else if hist < 0 and hist < hist[1] then color.RED else color.DARK_RED);
Thanks for this indicator. I will like to remove the candle color modifications from my chart, i.e "the dark green and dark red".Again, this is not a representation of how many people are buying and selling, for every buyer there is a seller. When you look at total volume, that's how many shares were bought and sold as you can't have a buyer without a seller. But, to answer your question, I've added what you're looking for which is a percentage of buying pressure vs a percentage of selling pressure. I've added the labels for that in the code below:
Code:input smoothingLength = 3; input paintBars = yes; def buyvol = Round(((high - open) + (close - low)) / 2 / (high - low) * volume(), 0); def sellvol = Round(((low - open) + (close - high)) / 2 / (high - low) * volume(), 0); def haclose = (open + high + low + close) / 4; def haopen = CompoundValue(1, (haopen[1] + haclose[1]) / 2, (open[1] + close[1]) / 2); def diff = haclose - haopen; def Avg = Average(diff, smoothingLength); def buyvolper = buyvol / volume() * 100; def sellvolper = absValue(sellvol) / volume() * 100; plot TUBU = close > open and diff > 0; plot TUBD = close < open and diff > 0; plot TDBD = close < open and diff < 0; plot TDBU = close > open and diff < 0; TUBU.hide(); TUBD.hide(); TDBD.hide(); TDBU.hide(); DefineGlobalColor("TUBU", Color.GREEN); DefineGlobalColor("TUBD", Color.DARK_RED); DefineGlobalColor("TDBD", Color.RED); DefineGlobalColor("TDBU", Color.DARK_GREEN); AssignPriceColor(if !paintBars then Color.CURRENT else if TUBU then GlobalColor("TUBU") else if TUBD then GlobalColor("TUBD") else if TDBD then GlobalColor("TDBD") else if TDBU then GlobalColor("TDBU") else Color.Current); addLabel(yes, "Total Volume: " + volume(), color.LIGHT_GRAY); addLabel(yes, "Buy Volume: " + buyvol, color.GREEN); addLabel(yes, "Sell Volume: " + absValue(sellvol), color.RED); addLabel(yes, "BVP%: " + buyvolper, color.GREEN); addLabel(yes, "SVP%: " + sellvolper, color.RED);
BVP% = Buying Volume Pressure Percentage.
SVP% = Selling Volume Pressure Percentage.
Note that these will fluctuate when a candle is in progress as the percentage changes based on the candle structure.
Thanks for this indicator. I will like to remove the candle color modifications from my chart, i.e "the dark green and dark red".
is there any way to turn this into a scanner? Example: buying pressure crosses above selling pressure in a 5
@rad14733 I was looking for rad buy sell volume pressure everywhere on this website but I failed to found any of it. can you please share the code for that indicator? thank you.@littletamla While you could use the same Chart for both Stocks and Options, a separate Chart tends to work better as it can be customized for Options instead of Stocks...
One thing to keep in mind is that as an Option gets OTM it would skew some of the indicators that benefit from the continual data flow for Stocks... On top of that, you might want a different set of indicators and Chart Labels for Option contracts...
Here is a link where I go over a few more things a little better as well as links to some of what I use...
https://usethinkscript.com/threads/...lping-grid-for-thinkorswim.20511/#post-150472
Because I primarily scalp SPY Options these days I tend to keep a Chart for the Call I am actively monitoring as well as another identical Chart for the Put I am monitoring... My Chart labels and indicators, few as there may be, are for Option performance... For example, I want to know the current ATR and Delta of each contract... Below is the current Chart layout I am using for Options which is a two panel Chart Grid... Neither the BollingerBands nor VWAP are needed but I like having them... As you can see, I also have a label for the underlying symbols current price... I like having my custom lower OptionDelta indicator for historical purposes, which displays AbsValue() for both Calls and Puts... I also utilize several different OBO Brackets with varying Limit and StopLoss that I can select from, again, based on current market conditions...
View attachment 24661
All that said, most of my Option scalps are made from a Flexible Grid Chart that displays the underlying on the left and only Active Trader ladders for my preselected Call and Put stacked on the right... The image below shows just one of my scalping layouts... Either of the Option panels can be maximized and a Chart displayed if desired... I like flexibility...
View attachment 24662
Most of my trading actually happens from my Main Panel on its Flexible Grid... I can update my Call and Put selections at any time from the Option Hacker driven Option Watchlist on the lower left to maintain my desired Price and Delta range for the current market by Right-Clicking on an Option entry and sending it to the corresponding Numbered/Colored Option AT panel... See the image below...
View attachment 24663
Most of this information has been shared elsewhere in these forums, as well as other setups I have used over the years... Again, scalping SPY Options is my main endeavor and this system works well for that purpose...I hope you find this information helpful...
@rad14733 I was looking for rad buy sell volume pressure everywhere on this website but I failed to found any of it. can you please share the code for that indicator? thank you.
# rad14733_Buy_Sell_Volume_Pressure
# Based on Jman_Buy_and_Sell_Volume_Pressure
# https://usethinkscript.com/threads/jman-buy-and-sell-volume-pressure-for-thinkorswim.11739/post-101477
# Modified by rad14733 for personal use
# v1.0 : 2025-04-08 : Initial code release
# v1.1 : 2025-04-23 : Code modifiecations, including incorporating Global Colors
declare lower;
input AvgTypes = averageType.EXPONENTIAL;
input BuyVolumeAvgLength = 21;
input SellVolumeAvgLength = 21;
input lineWeight = 1;
input showLabels = yes;
def buyvol = Round(((high - open) + (close - low)) / 2 / (high - low) * volume(), 0);
def sellvol = Round(((low - open) + (close - high)) / 2 / (high - low) * volume(), 0);
def buyvolavg = MovingAverage(AvgTypes, buyvol, BuyVolumeAvgLength);
def sellvolavg = MovingAverage(AvgTypes, absValue(sellvol), SellVolumeAvgLength);
DefineGlobalColor("BV", Color.GRAY);
DefineGlobalColor("SV", Color.GRAY);
DefineGlobalColor("VTUp", Color.GREEN);
DefineGlobalColor("VTDn", Color.RED);
DefineGlobalColor("VTDf", Color.YELLOW);
plot BVA = buyvolavg;
BVA.SetPaintingStrategy(PaintingStrategy.LINE_VS_POINTS);
BVA.setDefaultColor(color.GREEN);
BVA.SetLineWeight(lineWeight);
plot SVA = sellvolavg;
SVA.SetPaintingStrategy(PaintingStrategy.LINE_VS_POINTS);
SVA.setDefaultColor(color.RED);
SVA.SetLineWeight(lineWeight);
def buyselldiff = AbsValue(buyvolavg - sellvolavg);
AddLabel(showLabels, " BV: " + Round(buyvolavg, 0) + " ", GlobalColor("BV")); #GREEN
AddLabel(showLabels, " SV: " + Round(sellvolavg, 0) + " ", GlobalColor("SV")); #RED
AddLabel(showLabels, " VolTrend ", if buyvolavg > sellvolavg then GlobalColor("VTUp") else if sellvolavg > buyvolavg then GlobalColor("VTDn") else GlobalColor("VTDf"));
AddLabel(showLabels, " BSDiff: " + Round(buyselldiff, 2), if buyselldiff > buyselldiff[1] then GlobalColor("VTUp") else if buyselldiff < buyselldiff[1] then GlobalColor("VTDn") else GlobalColor("VTDf"));
# END - rad14733_Buy_Sell_Volume_Pressure
Join useThinkScript to post your question to a community of 21,000+ developers and traders.
Start a new thread and receive assistance from our community.
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.
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.