Mixed Volume Average

A

anty

New member
I added volume average to the Mixed Volume indicator to plot the average Buy and average Sell volume. Would it be possible to combine the Buy and Sell averages into one line that changes colors based on whether the dominant average is a Buy or Sell?


declare on_volume;

def O = open;
def H = high;
def C = close;
def L = low;
def V = volume;
def Buying = V*(C-L)/(H-L);
def Selling = V*(H-C)/(H-L);

# Selling Volume
Plot SV = selling;
SV.setPaintingStrategy(PaintingStrategy.Histogram);
SV.SetDefaultColor(Color.Red);
SV.HideTitle();
SV.HideBubble();
SV.SetLineWeight(5);

# Buying Volume
# Plot BV = Buying;
# Note that Selling + Buying Volume = Volume.
Plot BV = volume;
BV.setPaintingStrategy(PaintingStrategy.Histogram);
BV.SetDefaultColor(Color.Dark_Green);
BV.HideTitle();
BV.HideBubble();
BV.SetLineWeight(5);

input length = 50;


plot VolAvg = Average(sv, length);
plot VolAvg2 = Average(bv, length);
VolAvg.SetDefaultColor(GetColor(8));
VolAvg.SetDefaultColor(GetColor(7));
 
H

horserider

Well-known member
VIP
Warehouse
@anty

I think there is an error in your calculations. VolAvg2 is plotting total volume.
 
A

anty

New member
@anty

I think there is an error in your calculations. VolAvg2 is plotting total volume.
Thanks for pointing that out! I quickly copied and pasted it together. Hopefully it is fixed now.

declare on_volume;

def O = open;
def H = high;
def C = close;
def L = low;
def V = volume;
def Buying = V*(C-L)/(H-L);
def Selling = V*(H-C)/(H-L);

# Selling Volume
Plot SV = selling;
SV.setPaintingStrategy(PaintingStrategy.Histogram);
SV.SetDefaultColor(Color.Red);
SV.HideTitle();
SV.HideBubble();
SV.SetLineWeight(5);

# Buying Volume
# Plot BV = Buying;
# Note that Selling + Buying Volume = Volume.
Plot BV = volume;
BV.setPaintingStrategy(PaintingStrategy.Histogram);
BV.SetDefaultColor(Color.Dark_Green);
BV.HideTitle();
BV.HideBubble();
BV.SetLineWeight(5);

input length = 26;
plot VolAvg = Average(selling, length);
plot VolAvg2 = Average(buying, length);
VolAvg.SetDefaultColor(GetColor(2));
VolAvg2.SetDefaultColor(GetColor(6));
 
H

horserider

Well-known member
VIP
Warehouse
Not sure those plots are going to help. I am betting they will not separate enough to be useful.

I hope everyone is interpreting this indicator correctly. The histogram is showing total volume in dark green and selling volume in red. So to see buying vs selling you will need to judge how high the selling bar is compared to total volume bar.

@anty Updated this same study I posted a while ago. See if it suits you.
 

Top