The idea is Buying + Selling = Volume. Thus plotting Buying/Volume and Selling/Volume tells us which side is more aggressive. If my strategy says go long then I enter the trade when the Buyers are more aggressive and volume is above average.
*This is just something early stages I am working on as far as volume confirmations, I hope to add to its value more later
**In the future I will probably consider adding multi time frame so then I have multiple confirmations from different angles.
*This is just something early stages I am working on as far as volume confirmations, I hope to add to its value more later
**In the future I will probably consider adding multi time frame so then I have multiple confirmations from different angles.
Code:
declare lower;
input length = 12;
def O = open;
def H = high;
def C = close;
def L = low;
def V = volume;
def BuyingPer = (C-L)/(H-L);
def SellingPer = (H-C)/(H-L);
plot up = BuyingPer;
def down = SellingPer;
def avgVolume = Average(volume, length = length);
def isGreen = up > down and volume > avgVolume[1];
def isLightGreen = up > down and volume < avgVolume[1];
def isOrange = up < down and volume < avgVolume[1];
def isRed = up < down and volume > avgVolume[1];
up.DefineColor("Green", Color.GREEN);
up.DefineColor("LightGreen", Color.Light_GREEN);
up.DefineColor("Orange", Color.ORANGE);
up.DefineColor("Red", Color.RED);
up.AssignValueColor(if isGreen then up.Color("Green") else if isLightGreen then up.Color("LightGreen") else if isOrange then up.Color("Orange") else if isRed then up.Color("Red") else Color.LIGHT_GRAY);
Here is Version 1
Code:
input agg = AggregationPeriod.WEEK;
input length = 12;
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);
Assert(length > 0, "'length' must be positive: " + length);
#def avgPrice = ExpAverage(close(period = agg), length = length);
def avgVolume = ExpAverage(volume, length = length);
def isGreen = Buying > Selling and volume > avgVolume[1];
def isLightGreen = Buying > Selling and volume < avgVolume[1];
def isOrange = Buying < Selling and volume < avgVolume[1];
def isRed = Buying < Selling and volume > avgVolume[1];
plot Vol = volume;
Vol.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Vol.SetLineWeight(3);
Vol.DefineColor("Green", Color.GREEN);
Vol.DefineColor("LightGreen", Color.Light_GREEN);
Vol.DefineColor("Orange", Color.ORANGE);
Vol.DefineColor("Red", Color.RED);
Vol.AssignValueColor(if isGreen then Vol.Color("Green") else if isLightGreen then Vol.Color("LightGreen") else if isOrange then Vol.Color("Orange") else if isRed then Vol.Color("Red") else Color.LIGHT_GRAY);
Last edited by a moderator: