First, 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.
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):
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:
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:
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):
A screenshot of the BSVPACD compared to the MACD (MACD up top, BSVPACD on bottom):
Happy Trading!
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.
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):
A screenshot of the BSVPACD compared to the MACD (MACD up top, BSVPACD on bottom):
Happy Trading!
Last edited: