Average Effective Volume Indicator

germanburrito

Active member
In case anyone is interested, I made a rough estimate of Pascal Willain's Effective Volume function (from this book). you can download the book and how it works here its https://b-ok.cc/book/720566/248b4b page 32. The book starts by outlining the formula, then it explains that not all volume is useful, only about 25 percent of volume could be used to gauged the overall sentiment of where the stock might go. The issue with this indicator is that is a rough estimate of where the big players and the small payers could lie within the formula, I have the small players turned off, I only have the average turned on, I found that on the 20 day 4 hour it outlines where there might be a turn in the stock or where the sentiment according to volume might change. I don't think the indicator is done, if anyone has a better way to average the small players and large players it would be of great help. The way I use this is sometimes there's is divergences in volume and direction of price. Mind you the way I am using this indicator is my take on it so you are subject to my ideas unless you read the book, or if you have some ideas to make this indicator better, I am still backtesting it. In case you're wondering the indicator ignores the first bar of trading, the book outlines why this is the case. No where in the book does the indicator say that you should average effective volume.

zCiSLaP.png
, but this is what im doing so there that....

f2alNaL.png


Code:
declare lower;

def h = Max(high, close[1]);
def l = Min(low, close[1]);
input priceIncrement = 0.01;
def ev = volume * (close - close[1] + priceIncrement) / (h - l + priceIncrement);
# version without opening noise
def ev2 = if(secondsFromTime(930)>600,ev,0);
def EffectiveVolume = ev2;
#plot elapsedtime = secondsFromTime(930);

def ev_mag_avg = Average(data = AbsValue(ev2), length = 144);
#def small_ev = if(AbsValue(ev2) < ev_mag_avg, ev2, 0);
def large_ev = if(AbsValue(ev2) >= ev_mag_avg, ev2, 0);
#plot SmallEffectiveVolume = small_ev;
plot LargeEffectiveVolume = large_ev;
#plot SmallEffectiveVolumeAvg = Average(data = small_ev, length = 33);
#plot LargeEffectiveVolumeAvg = Average(data = large_ev, length = 33);
plot average = average(largeEffectiveVolume);

plot zeroline = 0;

largeEffectiveVolume.hide();


average.SetDefaultColor(GetColor(5));
average.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
average.SetLineWeight(3);
average.DefineColor("Positive and Up", Color.GREEN);
average.DefineColor("Positive and Down", Color.yellow);
average.DefineColor("Negative and Down", Color.RED);
average.DefineColor("Negative and Up", Color.yellow);
average.AssignValueColor(if average >= 0 then if average > average[1] then average.color("Positive and Up") else average.color("Positive and Down") else if average < average[1] then average.color("Negative and Down") else average.color("Negative and Up"));
 

Adeodatus

Member
VIP
Interesting method, great visual effect. it seems (in my viewer) to be more readable with candle stick, instead of straight lines for LargeEffective (LE) and an Orange negative up, Yellow positive down. Note that an LE buyer won't "lead the trading", but as conditions indicate buyers going into a stock, LE will do a big buy, perhaps more, and then wait. Also noted, as the price is hitting a -2 deviation, LE's may start in, helping support PPS, thereby moving SE trader buys. To be able to separate perhaps institutional and retail, its a great indicator. But trading is still like an auction, where getting the right entry is as important as market direction
 

germanburrito

Active member
Interesting method, great visual effect. it seems (in my viewer) to be more readable with candle stick, instead of straight lines for LargeEffective (LE) and an Orange negative up, Yellow positive down. Note that an LE buyer won't "lead the trading", but as conditions indicate buyers going into a stock, LE will do a big buy, perhaps more, and then wait. Also noted, as the price is hitting a -2 deviation, LE's may start in, helping support PPS, thereby moving SE trader buys. To be able to separate perhaps institutional and retail, its a great indicator. But trading is still like an auction, where getting the right entry is as important as market direction
-2 tsandard deviation from what? what is the average that you use.
 

Adeodatus

Member
VIP
Using "StandardDevChannel" indicator from TOS, placed 3 or 4 times on the top chart, each varied at "Input Devation" ~ @ 0.5, the next @ 1.0, the next @ 2.0, and if placing a 4th, then @ 3.0. Changed "input fullRange" to No, and also changed "input length" ~ 480 on all, results are placed along side the price, then its compared to Average Effect Volume Indicator in a lower field. Relative to where the price vs deviation lines, sometimes it amplifies where Institutional buys effect price movement.

Code:
# TD Ameritrade IP Company, Inc. (c) 2009-2021
#

input price = close;
input deviations = 2.0;
input fullRange = Yes;
input length = 21;

def regression;
def stdDeviation;
if (fullRange) {
    regression = InertiaAll(price);
    stdDeviation = stdevAll(price);
} else {
    regression = InertiaAll(price, length);
    stdDeviation = stdevAll(price, length);
}

plot UpperLine = regression + deviations * stdDeviation;
plot MiddleLine = regression;
plot LowerLine = regression - deviations * stdDeviation;

UpperLine.SetDefaultColor(GetColor(8));
MiddleLine.SetDefaultColor(GetColor(8));
LowerLine.SetDefaultColor(GetColor(8));
 

lmk99

Member
VIP
In case anyone is interested, I made a rough estimate of Pascal Willain's Effective Volume function (from this book). you can download the book and how it works here its https://b-ok.cc/book/720566/248b4b page 32. The book starts by outlining the formula, then it explains that not all volume is useful, only about 25 percent of volume could be used to gauged the overall sentiment of where the stock might go. The issue with this indicator is that is a rough estimate of where the big players and the small payers could lie within the formula, I have the small players turned off, I only have the average turned on, I found that on the 20 day 4 hour it outlines where there might be a turn in the stock or where the sentiment according to volume might change. I don't think the indicator is done, if anyone has a better way to average the small players and large players it would be of great help. The way I use this is sometimes there's is divergences in volume and direction of price. Mind you the way I am using this indicator is my take on it so you are subject to my ideas unless you read the book, or if you have some ideas to make this indicator better, I am still backtesting it. In case you're wondering the indicator ignores the first bar of trading, the book outlines why this is the case. No where in the book does the indicator say that you should average effective volume.

zCiSLaP.png
, but this is what im doing so there that....

f2alNaL.png


Code:
declare lower;

def h = Max(high, close[1]);
def l = Min(low, close[1]);
input priceIncrement = 0.01;
def ev = volume * (close - close[1] + priceIncrement) / (h - l + priceIncrement);
# version without opening noise
def ev2 = if(secondsFromTime(930)>600,ev,0);
def EffectiveVolume = ev2;
#plot elapsedtime = secondsFromTime(930);

def ev_mag_avg = Average(data = AbsValue(ev2), length = 144);
#def small_ev = if(AbsValue(ev2) < ev_mag_avg, ev2, 0);
def large_ev = if(AbsValue(ev2) >= ev_mag_avg, ev2, 0);
#plot SmallEffectiveVolume = small_ev;
plot LargeEffectiveVolume = large_ev;
#plot SmallEffectiveVolumeAvg = Average(data = small_ev, length = 33);
#plot LargeEffectiveVolumeAvg = Average(data = large_ev, length = 33);
plot average = average(largeEffectiveVolume);

plot zeroline = 0;

largeEffectiveVolume.hide();


average.SetDefaultColor(GetColor(5));
average.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
average.SetLineWeight(3);
average.DefineColor("Positive and Up", Color.GREEN);
average.DefineColor("Positive and Down", Color.yellow);
average.DefineColor("Negative and Down", Color.RED);
average.DefineColor("Negative and Up", Color.yellow);
average.AssignValueColor(if average >= 0 then if average > average[1] then average.color("Positive and Up") else average.color("Positive and Down") else if average < average[1] then average.color("Negative and Down") else average.color("Negative and Up"));

Thanks for sharing. I'd wanted to get at the concept of large effective buying vs. selling using the sizes of the buys and sells in T&S being X standard deviations larger than average (furthermore, the horizontal lines on the volume bars are color coded as positive vs. negative based on whether the trades were around the bid or around the ask). I made a thread about this here: https://usethinkscript.com/threads/...-that-show-the-size-of-the-trades-in-t-s.7003

zXQ5SoV.jpg


This is the last trading day of TSLA. You can see that it appears that the Time and Sales trade sizes being larger on buy volumes in a cluster appears to sometimes precede upward price moves. I don't understand the math behind Willain's effective volume function, but it seems like that may be a more refined way of trying to get at the same idea -- my thinking was that larger block trades are being executed by traders who are richer, and the traders who are richer are going to be smarter buyers and sellers so they should be followed.

The current code for the volume study is not updated in the original thread I linked, so I'm pasting it here:

Code:
#
# TD Ameritrade IP Company, Inc. (c) 2014-2021
#

declare lower;
declare zerobase;

input length = 60;
input numDev = 2.0;
input allowNegativeValues = yes;

def rawRelVol = (volume - Average(volume, length)) / StDev(volume, length);
plot RelVol = if allowNegativeValues then rawRelVol else Max(0, rawRelVol);
plot StDevLevel = numDev;

RelVol.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
RelVol.SetLineWeight(3);
RelVol.DefineColor("UpCandleAbove", Color.Light_Green);
RelVol.DefineColor("DownCandleAbove", Color.Red);
RelVol.DefineColor("UpCandleBelow", Color.CYAN);
RelVol.DefineColor("DownCandleBelow", Color.DARK_ORANGE);
RelVol.DefineColor("DownCandleNegBelow", CreateColor(60,25,25));
RelVol.DefineColor("UpCandleNegBelow", CreateColor(25,60,25));
RelVol.AssignValueColor(if RelVol >= numDev and RelVol>0 and open<close then RelVol.Color("UpCandleAbove") else if RelVol < numDev and RelVol<0 and open>close then RelVol.Color("DownCandleNegBelow") else if RelVol < numDev and RelVol<0 and open<close then RelVol.Color("UpCandleNegBelow")  else if RElVol>0 and open<close then RelVol.Color("UpCandleBelow") else if RelVol >= numDev and RelVol>0 and open>close then RelVol.Color("DownCandleAbove") else if RElVol>0 and open>close then  RelVol.Color("DownCandleBelow") else  Color.Gray);
StDevLevel.SetDefaultColor(GetColor(7));
StDevLevel.SetStyle(Curve.SHORT_DASH);

def TradeCount = tick_count;
def MoneyCount = volume;

def TickBullish = (tick_count(priceType = PriceType.ASK)) > (tick_count(priceType = PriceType.bid)) ;

def TickBearish = (tick_count(priceType = PriceType.ASK)) < (tick_count(priceType = PriceType.bid)) ;

def avgTradeCount = ((MoneyCount[1] + MoneyCount) / 2) / ((TradeCount + TradeCount[1]) / 2);

def ticksizestddev = (avgTradeCount - Average(avgTradeCount, length)) / StDev(avgTradeCount, length);

plot relticksize = RelVol;

input numDev2 = 4.0;

relticksize.SetPaintingStrategy(PaintingStrategy.HoriZONTAL);
relticksize.SetLineWeight(3);
relticksize.AssignValueColor(if ticksizestddev >= numDev2 and ticksizestddev>0 and TickBullish is true then RelVol.Color("UpCandleAbove") else if ticksizestddev < numDev2 and ticksizestddev<0 and TickBearish is true then RelVol.Color("DownCandleNegBelow") else if ticksizestddev < numDev2 and ticksizestddev<0 and TickBullish is true then RelVol.Color("UpCandleNegBelow")  else if ticksizestddev>0 and TickBullish is true then RelVol.Color("UpCandleBelow") else if ticksizestddev >= numDev2 and ticksizestddev>0 and TickBearish is true then RelVol.Color("DownCandleAbove") else if ticksizestddev>0 and TickBearish is true then  RelVol.Color("DownCandleBelow") else if ticksizestddev >= numDev2 and ticksizestddev>0 and close[0]>close[1] then RelVol.Color("UpCandleAbove") else if ticksizestddev < numDev2 and ticksizestddev<0 and close[0]<close[1] then RelVol.Color("DownCandleNegBelow") else if ticksizestddev < numDev and ticksizestddev<0 and close[0]>close[1] then RelVol.Color("UpCandleNegBelow") else if  ticksizestddev>0 and close[0]>close[1] then RelVol.Color("UpCandleBelow") else if ticksizestddev >= numDev2 and ticksizestddev>0 and close[0]<close[1] then RelVol.Color("DownCandleAbove") else if ticksizestddev>0 and close[0]<close[1] then  RelVol.Color("DownCandleBelow") else Color.Gray);

Do you think there's a way to combine the concept in my study with the concept in your Effective Volume study? Or might there be a useful complementarity to supplementing the Effective Volume calculations with the approach of calculating standard deviation for the trade sizes that are occurring? I think sometimes its plots can be suggestive but they're often hard to interpret in a consistent way. Perhaps the approach of Effective Volume, either singly or in combination with my approach of using trade sizes, could offer a more objective or quantifiable threshold for generating less ambiguous signals? I'd be really interested to hear your thoughts on this!
 
Last edited:

germanburrito

Active member
Thanks for sharing. I'd wanted to get at the concept of large effective buying vs. selling using the sizes of the buys and sells in T&S being X standard deviations larger than average (furthermore, the horizontal lines on the volume bars are color coded as positive vs. negative based on whether the trades were around the bid or around the ask). I made a thread about this here: https://usethinkscript.com/threads/...-that-show-the-size-of-the-trades-in-t-s.7003

zXQ5SoV.jpg


This is the last trading day of TSLA. You can see that it appears that the Time and Sales trade sizes being larger on buy volumes in a cluster appears to sometimes precede upward price moves. I don't understand the math behind Willain's effective volume function, but it seems like that may be a more refined way of trying to get at the same idea -- my thinking was that larger block trades are being executed by traders who are richer, and the traders who are richer are going to be smarter buyers and sellers so they should be followed.

The current code for the volume study is not updated in the original thread I linked, so I'm pasting it here:

Code:
#
# TD Ameritrade IP Company, Inc. (c) 2014-2021
#

declare lower;
declare zerobase;

input length = 60;
input numDev = 2.0;
input allowNegativeValues = yes;

def rawRelVol = (volume - Average(volume, length)) / StDev(volume, length);
plot RelVol = if allowNegativeValues then rawRelVol else Max(0, rawRelVol);
plot StDevLevel = numDev;

RelVol.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
RelVol.SetLineWeight(3);
RelVol.DefineColor("UpCandleAbove", Color.Light_Green);
RelVol.DefineColor("DownCandleAbove", Color.Red);
RelVol.DefineColor("UpCandleBelow", Color.CYAN);
RelVol.DefineColor("DownCandleBelow", Color.DARK_ORANGE);
RelVol.DefineColor("DownCandleNegBelow", CreateColor(60,25,25));
RelVol.DefineColor("UpCandleNegBelow", CreateColor(25,60,25));
RelVol.AssignValueColor(if RelVol >= numDev and RelVol>0 and open<close then RelVol.Color("UpCandleAbove") else if RelVol < numDev and RelVol<0 and open>close then RelVol.Color("DownCandleNegBelow") else if RelVol < numDev and RelVol<0 and open<close then RelVol.Color("UpCandleNegBelow")  else if RElVol>0 and open<close then RelVol.Color("UpCandleBelow") else if RelVol >= numDev and RelVol>0 and open>close then RelVol.Color("DownCandleAbove") else if RElVol>0 and open>close then  RelVol.Color("DownCandleBelow") else  Color.Gray);
StDevLevel.SetDefaultColor(GetColor(7));
StDevLevel.SetStyle(Curve.SHORT_DASH);

def TradeCount = tick_count;
def MoneyCount = volume;

def TickBullish = (tick_count(priceType = PriceType.ASK)) > (tick_count(priceType = PriceType.bid)) ;

def TickBearish = (tick_count(priceType = PriceType.ASK)) < (tick_count(priceType = PriceType.bid)) ;

def avgTradeCount = ((MoneyCount[1] + MoneyCount) / 2) / ((TradeCount + TradeCount[1]) / 2);

def ticksizestddev = (avgTradeCount - Average(avgTradeCount, length)) / StDev(avgTradeCount, length);

plot relticksize = RelVol;

input numDev2 = 4.0;

relticksize.SetPaintingStrategy(PaintingStrategy.HoriZONTAL);
relticksize.SetLineWeight(3);
relticksize.AssignValueColor(if ticksizestddev >= numDev2 and ticksizestddev>0 and TickBullish is true then RelVol.Color("UpCandleAbove") else if ticksizestddev < numDev2 and ticksizestddev<0 and TickBearish is true then RelVol.Color("DownCandleNegBelow") else if ticksizestddev < numDev2 and ticksizestddev<0 and TickBullish is true then RelVol.Color("UpCandleNegBelow")  else if ticksizestddev>0 and TickBullish is true then RelVol.Color("UpCandleBelow") else if ticksizestddev >= numDev2 and ticksizestddev>0 and TickBearish is true then RelVol.Color("DownCandleAbove") else if ticksizestddev>0 and TickBearish is true then  RelVol.Color("DownCandleBelow") else if ticksizestddev >= numDev2 and ticksizestddev>0 and close[0]>close[1] then RelVol.Color("UpCandleAbove") else if ticksizestddev < numDev2 and ticksizestddev<0 and close[0]<close[1] then RelVol.Color("DownCandleNegBelow") else if ticksizestddev < numDev and ticksizestddev<0 and close[0]>close[1] then RelVol.Color("UpCandleNegBelow") else if  ticksizestddev>0 and close[0]>close[1] then RelVol.Color("UpCandleBelow") else if ticksizestddev >= numDev2 and ticksizestddev>0 and close[0]<close[1] then RelVol.Color("DownCandleAbove") else if ticksizestddev>0 and close[0]<close[1] then  RelVol.Color("DownCandleBelow") else Color.Gray);

Do you think there's a way to combine the concept in my study with the concept in your Effective Volume study? Or might there be a useful complementarity to supplementing the Effective Volume calculations with the approach of calculating standard deviation for the trade sizes that are occurring? I think sometimes its plots can be suggestive but they're often hard to interpret in a consistent way. Perhaps the approach of Effective Volume, either singly or in combination with my approach of using trade sizes, could offer a more objective or quantifiable threshold for generating less ambiguous signals? I'd be really interested to hear your thoughts on this!
you know to be honest i been a bit upset with the idea of volume and i totally discarded the idea that volume might be helpful in someway, my reasons is that i constantly see how volume is manipulated/skewed to throw of traders in a different way than price might be, for example certain volume spikes to activate scanners, or delay volume, meaning i have a strong sense that algos are always front running trades and in some ways this is legal, also another idea is the idea of dark pools where a majority of really large trades are done to keep the market less volatile and retail is not allow to peek into these trades, now since you refreshed my mind as to the possibility that there might be an edge here i am more than happy to work on these ideas if you like, another way or indicator that i had a small success with for a week before i discarded it was the volumeflowindicator that comes in tos, i usto change the settings from 130 to 34 and i found this helpful, also changing the cutoff could help. lets link up my twetter handle is @GermanBrito17
 

lmk99

Member
VIP
you know to be honest i been a bit upset with the idea of volume and i totally discarded the idea that volume might be helpful in someway, my reasons is that i constantly see how volume is manipulated/skewed to throw of traders in a different way than price might be, for example certain volume spikes to activate scanners, or delay volume, meaning i have a strong sense that algos are always front running trades and in some ways this is legal, also another idea is the idea of dark pools where a majority of really large trades are done to keep the market less volatile and retail is not allow to peek into these trades, now since you refreshed my mind as to the possibility that there might be an edge here i am more than happy to work on these ideas if you like, another way or indicator that i had a small success with for a week before i discarded it was the volumeflowindicator that comes in tos, i usto change the settings from 130 to 34 and i found this helpful, also changing the cutoff could help. lets link up my twetter handle is @GermanBrito17

Thanks, I've reached out on Twitter.

Using "StandardDevChannel" indicator from TOS, placed 3 or 4 times on the top chart, each varied at "Input Devation" ~ @ 0.5, the next @ 1.0, the next @ 2.0, and if placing a 4th, then @ 3.0. Changed "input fullRange" to No, and also changed "input length" ~ 480 on all, results are placed along side the price, then its compared to Average Effect Volume Indicator in a lower field. Relative to where the price vs deviation lines, sometimes it amplifies where Institutional buys effect price movement.

Interesting observation. I'm curious, do you (or anyone reading this thread?) have thoughts about using whether trades are at the bid vs. the ask, along with calculating standard deviations of the sizes of the trades, to get at whether bigger money is buying or selling (like watching Time and Sales for large trades, but being able to display this as a signal on the chart), and how this approach might be complementary to what Germanburrito has done?
 

Similar threads

Top