Coding Help for Welkin's Advanced Volume Indicator.

fungus12

Member
Hi I have a question on how to code something in Welkin's AVI. Here is the link to the thread for the script https://usethinkscript.com/threads/advanced-volume-indicator-for-thinkorswim.1665/

My question is about the buy/sell str for the second aggregation. First off let me just present two images so you know what I'm talking about.

Here is the indicator with the second aggregation turned off:

D6Z3iet.png


And here is the indicator with the second aggregation turned on:

tQjiaPG.png


My question is, is it possible to have some kind of percentage present in the second image that indicates the percentage of buy vs sell shown in the clouds? For example in that image from 6:30 - 7:00 it would show something like "95% buy/5% sell", then at 7:01 it would show "60% buy/40% sell". Something like that. I would prefer this also be favorable to backtesting. In other words, have the percentages present not only at the most current data but historical data as well.

Also along similar lines, I also would like to change the watchlist column in Welkin's post to show the buy/str for an aggregate (15m, for example) instead of just current bars. Here is the code in the thread for the watchlist:
Code:
#Buy/Sell Strength Column
def o = open;
def h = high;
def l = low;
def c = close;
def PR = h - l;
def BuyStr = ((c - l) / PR) * 100;

AddLabel(1,Round(BuyStr,1)+" | " + Round(100-BuyStr,1)+"%", Color.BLACK);

AssignBackgroundColor(if BuyStr >= 70 then Color.Green else if BuyStr > 50 then Color.DARK_GREEN else if BuyStr <= 30 then Color.RED else if BuyStr < 50 then Color.DARK_RED else Color.GRAY);

I wish Welkin was around to answer these questions but he's been inactive for several months now. If anyone knows how to code these things, please let me know. Thanks in advance.
 
I modified the script to change aggregationperiod2 from 30 miinutes to an input number of bars, currently set to 5.
im using it right now but its doesnt show real time data till the 5th or 30th or 60th bar depending on what you set it as
it works but its just about 50% complete right now its calculating past information you cant see if its positive or negative real time till the last bar of the period
i think the actual problem is the time itself, the time needs to be removed so it only goes by the bars which i dont know if its even possible its similar to welkins. its ploting the same information just instead of real time, its the history with the bubbles which is part of what i was thinking

lets say youre counting 30 bars its 11:42am it needs to count back to 11:12 and when it hits 11:43 counts back to 11:13 and it plots that percentage real time and so on

i think the time itself is the problem this might be too much to calculate im not sure
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

im using it right now but its doesnt show real time data till the 5th or 30th or 60th bar depending on what you set it as
it works but its just about 50% complete right now its calculating past information you cant see if its positive or negative real time till the last bar of the period
i think the actual problem is the time itself, the time needs to be removed so it only goes by the bars which i dont know if its even possible its similar to welkins. its ploting the same information just instead of real time, its the history with the bubbles which is part of what i was thinking

lets say youre counting 30 bars its 11:42am it needs to count back to 11:12 and when it hits 11:43 counts back to 11:13 and it plots that percentage real time and so on

i think the time itself is the problem this might be too much to calculate im not sure

The current bar's bubbles will reflect the buy/sell percentage for the rolling number of past bars (input at bars) prior to and including the current bar. Then when the full number of bars input at bars is reached from the prior stationary bubbles, the bubbles will be displayed and remain for the buy/sell percentage.

In the chart below (set at 10 bars) the last bubble shows 96.48%/3.52% which reflects the rolling 10 bar percentage of the ten bars including the those prior to and including the current bar. The 100%/0% reflects the stationary 10 bar buy/sell percentage from the last stationary bubble.
Screenshot-2021-08-30-115342.jpg
Ruby:
#Advanced Volume Study
#[email protected]
#v5.22.2020
declare on_volume;
input ShowVolumeAsCandlesticks = no;
input ShowBuySellStrengthOnVolumeBars = no;
input ShowBuySellStrength2ndAgg = no;
input AvgDayVolLength = 5;
input AvgVolLength = 20;
input ShowDayVolLabel = yes;
input ShowBarVolLabel = yes;
input ShowEthTotalVol = no;
input ShowBuySellStrength = yes;

#----------------------------------------
input bars  = 5;
def bar     = if BarNumber() >= 1
              then BarNumber()
              else bar[1] + 1;
def BuySellStrAgg2 = bar % bars == 0;# AggregationPeriod.THIRTY_MIN;
#----------------------------------------

input VolAverageType = AverageType.SIMPLE;
#if ShowBuySellStrengthOnVolumeBars is toggled on then the following volume bar paint options will not show, only the VolSignal Triangle set at the top of the bars will be painting according to volume average levels.
input PaintAboveAvgVolBars = yes;
input PaintAccordingToRelPrevVol = yes;
input RelativetoPrevVolTolerance = 1.25; #if volume is 1.25x greater than previous bar it will paint even if it is still below the average/sigma2/sigma3
input PaintBelowAvgVol = yes;
input PaintPriceAsVol = no;
input ShowVerticalTickLines = yes;
def ShowVertLines  = if ShowVerticalTickLines and GetAggregationPeriod() < AggregationPeriod.DAY then 1 else 0;
input TickLevel     = 1000;
input ShowTickLabel = yes;


def NA = Double.NaN;
def h  = high;
def l  = low;
def c  = close;
def o  = open;
def v  = volume;
def PriceRange              = h - l;
def TopShadowRange          = if o >= c then h - o else h - c;
def BottomShadowRange       = if o <= c then o - l else c - l;
def BodyRange               = PriceRange - (TopShadowRange + BottomShadowRange);
def VolumeTopShadowValue    = (1 - (TopShadowRange / PriceRange)) * v;
def VolumeBottomShadowValue = ((BottomShadowRange / PriceRange) * v);
def BodyRangeVolValue       = ((BodyRange + BottomShadowRange) / PriceRange) * v;
def DayVolAgg               = if GetAggregationPeriod() < AggregationPeriod.DAY then AggregationPeriod.DAY else GetAggregationPeriod();
def DayVol    = volume("period" = DayVolAgg);
def AvgDayVol = Average(DayVol, AvgDayVolLength);
def Start     = 0930;
def End       = 1600;
def conf      = SecondsFromTime(Start) >= 0 and SecondsFromTime(End) <= 0;

plot VolColor = NA;
VolColor.DefineColor("Bullish", Color.GREEN);
VolColor.DefineColor("Bearish", Color.RED);
VolColor.DefineColor("VolAvg", CreateColor(0, 100, 200));
VolColor.DefineColor("VolSigma2", Color.DARK_ORANGE);
VolColor.DefineColor("VolSigma3", Color.MAGENTA);
VolColor.DefineColor("Relative to Prev", Color.YELLOW);
VolColor.DefineColor("Below Average", Color.GRAY);
VolColor.DefineColor("ETH TVOL", Color.GRAY);
VolColor.DefineColor("TICK Vert", Color.GRAY);

#Current Candle Buy and Sell Strength
def BuyStr    = ((c - l) / PriceRange) * 100;
def SellStr   = ((h - c) / PriceRange) * 100;

def bar2count = if bar % bars == 0
                then bar2count[1] + 1
                else bar2count[1];
plot x2 = bar;
x2.SetPaintingStrategy(PaintingStrategy.VALUES_BELOW);
def high2     = if IsNaN(h)
                then high2[1]
                else if BarNumber() == bar
                then Highest(h, bars)
                else if bar2count != bar2count[1]
                then Highest(h, bars) else Double.NaN;
def close2    = if IsNaN(c)
                then close2[1]
                else if BarNumber() == bar
                then c
                else if bar2count != bar2count[1]
                then c else Double.NaN;
def low2      = if IsNaN(l)
                then low2[1]
                else if BarNumber() == bar
                then Lowest(l, bars)
                else  if bar2count != bar2count[1]
                then Lowest(l, bars) else Double.NaN;
def volume2   = if IsNaN(v)
                then volume2[1]
                else if BarNumber() == bar
                then  Highest(v, bars)
                else if bar2count != bar2count[1]
                then Highest(v, bars) else Double.NaN;
def v2       = volume2;

def BuyStr2  = if IsNaN((close2 - low2) / (high2 - low2) * 100)
               then BuyStr2[1]
               else (close2 - low2) / (high2 - low2) * 100;
def SellStr2 = if IsNaN((high2 - close2) / (high2 - low2) * 100)
               then SellStr2[1]
               else (high2 - close2) / (high2 - low2) * 100;

plot BuyVol = if ShowBuySellStrengthOnVolumeBars then (BuyStr / 100) * v else NA;
def SellVol = (SellStr / 100) * v;
def BuyVol2 = (BuyStr2 / 100) * volume2;
def SellVol2 = (SellStr2 / 100) * volume2;
AddCloud(if ShowBuySellStrength2ndAgg then BuyVol2 else NA, 0, VolColor.Color("Bullish"), VolColor.Color("Bullish"), yes);
AddCloud(if ShowBuySellStrength2ndAgg then v2 else NA, BuyVol2, VolColor.Color("Bearish"), VolColor.Color("Bearish"), yes);

BuyVol.SetDefaultColor(VolColor.Color("Bullish"));
BuyVol.SetPaintingStrategy(PaintingStrategy.SQUARED_HISTOGRAM);

plot Vol          = v;
plot VolumeBottom = if !ShowVolumeAsCandlesticks or ShowBuySellStrengthOnVolumeBars then NA else VolumeBottomShadowValue;
plot VolumeBody   = if !ShowVolumeAsCandlesticks or ShowBuySellStrengthOnVolumeBars then NA else BodyRangeVolValue;

VolumeBottom.HideTitle();
VolumeBody.HideTitle();

plot VolAvg = MovingAverage(VolAverageType, v, AvgVolLength);

#2Sigma and 3Sigma Vol Filter
def Num_Dev1          = 2.0;
def Num_Dev2          = 3.0;
def averageType       = AverageType.SIMPLE;
def sDev = StDev(data = Vol, length = AvgVolLength);

plot VolSigma2 = VolAvg + Num_Dev1 * sDev;
plot VolSigma3 = VolAvg + Num_Dev2 * sDev;


def RelDayVol     = DayVol / AvgDayVol[1];
def RelPrevDayVol = DayVol / volume("period" = DayVolAgg)[1];
#Daily aggregation volume labels
AddLabel(if GetAggregationPeriod() >= AggregationPeriod.DAY then 0 else if ShowDayVolLabel then 1 else 0, "DayVol: " + DayVol + " / " + Round(RelDayVol, 2) + "x Avg(" + AvgDayVolLength + ") / " + Round(RelPrevDayVol, 2) + "x Prev", if DayVol > AvgDayVol then VolColor.Color("VolAvg") else VolColor.Color("Below Average"));

def RelVol = Vol / VolAvg[1];
def RelPrevVol = v / v[1];

#Triangle Vol Signal
plot VolSignal = if Vol > VolSigma3 then v else if Vol > VolSigma2 then v else if Vol > VolAvg then volume else if RelPrevVol >= RelativetoPrevVolTolerance then v else NA;

#current aggregation's volume labels
AddLabel(ShowBarVolLabel, "Vol: " + v + " / " + Round(RelVol, 2) + "x Avg(" + AvgVolLength + ") / " + Round(RelPrevVol, 2) + "x Prev",  if Vol > VolSigma3 then VolColor.Color("VolSigma3") else if Vol > VolSigma2 then VolColor.Color("VolSigma2") else if Vol > VolAvg then VolColor.Color("VolAvg") else VolColor.Color("Below Average"));

#ETH Total Vol Label
def ETH_VOL = if !conf and conf[1] then v else if !conf then CompoundValue(1, ETH_VOL[1] + v, v) else ETH_VOL[1];

AddLabel(if !ShowEthTotalVol then 0 else if GetAggregationPeriod() >= AggregationPeriod.DAY then 0 else 1, "ETH TVOL: " + ETH_VOL, VolColor.Color("ETH TVOL"));

#$TICK Vertical Lines
def tickc = close("$TICK");
def tickh = high("$TICK");
def tickl = low("$TICK");

AddVerticalLine(if ShowVertLines and (tickh > TickLevel) or ShowVertLines and (tickl < -TickLevel) then 1 else 0, if (tickh > TickLevel) then tickh else if (tickl < -TickLevel) then tickl else Double.NaN, VolColor.Color("TICK Vert"));

#$TICK Label
AddLabel(if ShowTickLabel then 1 else 0, "$TICK: " + tickc, if tickc > 0 then Color.GREEN else Color.RED);

#current candle Buy/Sell strength labels
AddLabel(if ShowBuySellStrength then 1 else 0, " ", Color.BLACK);
AddLabel(if ShowBuySellStrength then 1 else 0, "1", Color.GRAY);
AddLabel(if ShowBuySellStrength then 1 else 0, "Sell " + Round(SellStr, 2) + "%", if SellStr > BuyStr then Color.RED else Color.DARK_RED);
AddLabel(if ShowBuySellStrength then 1 else 0, "Buy " + Round(BuyStr, 2) + "%", if BuyStr > SellStr then Color.GREEN else Color.DARK_GREEN);

#2nd Aggregation Buy/Sell strength labels
#AddLabel(if ShowBuySellStrength then 1 else 0, "Check BuySellAgg2 > Current Agg", Color.YELLOW);
AddLabel(if !ShowBuySellStrength then 0 else 1, " ", Color.BLACK);
AddLabel(if !ShowBuySellStrength then 0 else 1, "2", Color.GRAY);
AddLabel(if !ShowBuySellStrength then 0 else 1, "Sell " + Round(SellStr2, 2) + "%", if SellStr2 > BuyStr2 then Color.RED else Color.DARK_RED);
AddLabel(if !ShowBuySellStrength then 0 else 1, "Buy " + Round(BuyStr2, 2) + "%", if BuyStr2 > SellStr2 then Color.GREEN else Color.DARK_GREEN);

VolumeBottom.SetPaintingStrategy(PaintingStrategy.SQUARED_HISTOGRAM);
VolumeBottom.AssignValueColor(Color.BLACK);
VolumeBody.SetPaintingStrategy(PaintingStrategy.SQUARED_HISTOGRAM);

VolumeBody.AssignValueColor(if PaintAboveAvgVolBars and Vol > VolSigma3 then VolColor.Color("VolSigma3") else if PaintAboveAvgVolBars and Vol > VolSigma2 then VolColor.Color("VolSigma2") else if PaintAboveAvgVolBars and Vol > VolAvg then VolColor.Color("VolAvg") else if PaintAccordingToRelPrevVol and RelPrevVol >= RelativetoPrevVolTolerance then VolColor.Color("Relative to Prev") else if  PaintBelowAvgVol and Vol < VolAvg then VolColor.Color("Below Average") else if c > o then VolColor.Color("Bullish") else VolColor.Color("Bearish"));
#VolumeTop.SetPaintingStrategy(PaintingStrategy.SQUARED_HISTOGRAM);
#VolumeTop.AssignValueColor(if close > open then Color.Black else Color.Black);

VolAvg.SetDefaultColor(VolColor.Color("VolAvg"));
VolSigma2.SetDefaultColor(VolColor.Color("VolSigma2"));
VolSigma3.SetDefaultColor(VolColor.Color("VolSigma3"));

Vol.SetPaintingStrategy(if !ShowVolumeAsCandlesticks or ShowBuySellStrengthOnVolumeBars then PaintingStrategy.SQUARED_HISTOGRAM else PaintingStrategy.HISTOGRAM);

Vol.SetLineWeight(1);
Vol.AssignValueColor(if ShowBuySellStrengthOnVolumeBars then VolColor.Color("Bearish") else if PaintAboveAvgVolBars and v > VolSigma3 then VolColor.Color("VolSigma3") else if PaintAboveAvgVolBars and v > VolSigma2 then VolColor.Color("VolSigma2") else if PaintAboveAvgVolBars and v > VolAvg then VolColor.Color("VolAvg") else if PaintAccordingToRelPrevVol and RelPrevVol >= RelativetoPrevVolTolerance then VolColor.Color("Relative to Prev") else if PaintBelowAvgVol and v < VolAvg then VolColor.Color("Below Average") else if c > o then VolColor.Color("Bullish") else VolColor.Color("Bearish"));

AssignPriceColor(if PaintPriceAsVol and PaintAboveAvgVolBars and v > VolSigma3 then VolColor.Color("VolSigma3") else if PaintPriceAsVol and PaintAboveAvgVolBars and v > VolSigma2 then VolColor.Color("VolSigma2") else if PaintPriceAsVol and PaintAboveAvgVolBars and v > VolAvg then VolColor.Color("VolAvg") else if PaintPriceAsVol and PaintAccordingToRelPrevVol and RelPrevVol >= RelativetoPrevVolTolerance then VolColor.Color("Relative to Prev") else if PaintPriceAsVol and PaintBelowAvgVol and v < VolAvg then VolColor.Color("Below Average") else Color.CURRENT);

VolSignal.AssignValueColor(if Vol > VolSigma3 then VolColor.Color("VolSigma3") else if Vol > VolSigma2 then VolColor.Color("VolSigma2") else if Vol > VolAvg then VolColor.Color("VolAvg") else if RelPrevVol >= RelativetoPrevVolTolerance then VolColor.Color("Relative to Prev") else VolColor.Color("Below Average"));
VolSignal.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
VolAvg.SetLineWeight(2);
VolSignal.SetLineWeight(1);



########################################
#Buy/Sell Bubbles

input show_buy_sell_bubbles = yes;
input bubblemover           = 0;
def b                       = bubblemover;
def b1                      = b + 1;

def periods     = bar % bars == 0;
def periodCount = CompoundValue(1, if periods then periodCount[1] + 1 else periodCount[1], 0);
def thisperiod  = (HighestAll(periodCount) - periodCount) ;

AddChartBubble(show_buy_sell_bubbles and thisperiod[b1] != thisperiod[b], VolAvg[b], Round(SellStr2[b1]) + "%", if Round(SellStr2[b1]) > Round(BuyStr2[b1]) then Color.RED else Color.GRAY);
AddChartBubble(show_buy_sell_bubbles and thisperiod[b1] != thisperiod[b] , VolAvg[b], Round(BuyStr2[b1]) + "%", if Round(SellStr2[b1]) > Round(BuyStr2[b1]) then Color.GRAY else Color.GREEN);
AddChartBubble(show_buy_sell_bubbles and IsNaN(close[-1]) and !IsNaN(close) and BarNumber() == bar and thisperiod == thisperiod[1], VolAvg, Round(SellStr2) + "%", if Round(SellStr2) > Round(BuyStr2) then Color.RED else Color.GRAY);
AddChartBubble(show_buy_sell_bubbles and IsNaN(close[-1]) and !IsNaN(close) and BarNumber() == bar , VolAvg, Round(BuyStr2) + "%" , if Round(SellStr2) > Round(BuyStr2) then Color.GRAY else Color.GREEN);
#######################################
 
Did TOS nerf the Advanced Volume Study? https://usethinkscript.com/threads/advanced-volume-indicator-for-thinkorswim.1665/
I used to be able to see Buy & Sell % as it changed during 1minute time frame now it is static until it changes the next minute... was in a PUT on SPY with a sell % of 85 the next minute SPY reversed on me with a 90% Buy 10% Sell ratio... i know they didnt seek out this particular study but something has changed in the new update
 
@Gymini There is no way to find out if / what they changed in the new update to affect the study. If you call TOS Support their stock answer is that they don't offer support for custom studies. The author of the study isn't available on the forum to provide any insight either.
 
The current bar's bubbles will reflect the buy/sell percentage for the rolling number of past bars (input at bars) prior to and including the current bar. Then when the full number of bars input at bars is reached from the prior stationary bubbles, the bubbles will be displayed and remain for the buy/sell percentage.

In the chart below (set at 10 bars) the last bubble shows 96.48%/3.52% which reflects the rolling 10 bar percentage of the ten bars including the those prior to and including the current bar. The 100%/0% reflects the stationary 10 bar buy/sell percentage from the last stationary bubble.
wonderful adjustments adding the bubbles, thank you! Is there/could there be a way to only display the current bubble, and hide the previous bubbles?
 
wonderful adjustments adding the bubbles, thank you! Is there/could there be a way to only display the current bubble, and hide the previous bubbles?
Sure, this sets the input for show_buy_sell_bubbles to no and a new show_buy_sell_bubbles_last to yes
Capture.jpg
Ruby:
#Advanced Volume Study
#[email protected]
#v5.22.2020
declare on_volume;
input ShowVolumeAsCandlesticks = no;
input ShowBuySellStrengthOnVolumeBars = no;
input ShowBuySellStrength2ndAgg = no;
input AvgDayVolLength = 5;
input AvgVolLength = 20;
input ShowDayVolLabel = yes;
input ShowBarVolLabel = yes;
input ShowEthTotalVol = no;
input ShowBuySellStrength = yes;

#----------------------------------------
input bars  = 5;
def bar     = if BarNumber() >= 1
              then BarNumber()
              else bar[1] + 1;
def BuySellStrAgg2 = bar % bars == 0;# AggregationPeriod.THIRTY_MIN;
#----------------------------------------

input VolAverageType = AverageType.SIMPLE;
#if ShowBuySellStrengthOnVolumeBars is toggled on then the following volume bar paint options will not show, only the VolSignal Triangle set at the top of the bars will be painting according to volume average levels.
input PaintAboveAvgVolBars = yes;
input PaintAccordingToRelPrevVol = yes;
input RelativetoPrevVolTolerance = 1.25; #if volume is 1.25x greater than previous bar it will paint even if it is still below the average/sigma2/sigma3
input PaintBelowAvgVol = yes;
input PaintPriceAsVol = no;
input ShowVerticalTickLines = yes;
def ShowVertLines  = if ShowVerticalTickLines and GetAggregationPeriod() < AggregationPeriod.DAY then 1 else 0;
input TickLevel     = 1000;
input ShowTickLabel = yes;


def NA = Double.NaN;
def h  = high;
def l  = low;
def c  = close;
def o  = open;
def v  = volume;
def PriceRange              = h - l;
def TopShadowRange          = if o >= c then h - o else h - c;
def BottomShadowRange       = if o <= c then o - l else c - l;
def BodyRange               = PriceRange - (TopShadowRange + BottomShadowRange);
def VolumeTopShadowValue    = (1 - (TopShadowRange / PriceRange)) * v;
def VolumeBottomShadowValue = ((BottomShadowRange / PriceRange) * v);
def BodyRangeVolValue       = ((BodyRange + BottomShadowRange) / PriceRange) * v;
def DayVolAgg               = if GetAggregationPeriod() < AggregationPeriod.DAY then AggregationPeriod.DAY else GetAggregationPeriod();
def DayVol    = volume("period" = DayVolAgg);
def AvgDayVol = Average(DayVol, AvgDayVolLength);
def Start     = 0930;
def End       = 1600;
def conf      = SecondsFromTime(Start) >= 0 and SecondsFromTime(End) <= 0;

plot VolColor = NA;
VolColor.DefineColor("Bullish", Color.GREEN);
VolColor.DefineColor("Bearish", Color.RED);
VolColor.DefineColor("VolAvg", CreateColor(0, 100, 200));
VolColor.DefineColor("VolSigma2", Color.DARK_ORANGE);
VolColor.DefineColor("VolSigma3", Color.MAGENTA);
VolColor.DefineColor("Relative to Prev", Color.YELLOW);
VolColor.DefineColor("Below Average", Color.GRAY);
VolColor.DefineColor("ETH TVOL", Color.GRAY);
VolColor.DefineColor("TICK Vert", Color.GRAY);

#Current Candle Buy and Sell Strength
def BuyStr    = ((c - l) / PriceRange) * 100;
def SellStr   = ((h - c) / PriceRange) * 100;

def bar2count = if bar % bars == 0
                then bar2count[1] + 1
                else bar2count[1];
plot x2 = bar;
x2.SetPaintingStrategy(PaintingStrategy.VALUES_BELOW);
def high2     = if IsNaN(h)
                then high2[1]
                else if BarNumber() == bar
                then Highest(h, bars)
                else if bar2count != bar2count[1]
                then Highest(h, bars) else Double.NaN;
def close2    = if IsNaN(c)
                then close2[1]
                else if BarNumber() == bar
                then c
                else if bar2count != bar2count[1]
                then c else Double.NaN;
def low2      = if IsNaN(l)
                then low2[1]
                else if BarNumber() == bar
                then Lowest(l, bars)
                else  if bar2count != bar2count[1]
                then Lowest(l, bars) else Double.NaN;
def volume2   = if IsNaN(v)
                then volume2[1]
                else if BarNumber() == bar
                then  Highest(v, bars)
                else if bar2count != bar2count[1]
                then Highest(v, bars) else Double.NaN;
def v2       = volume2;

def BuyStr2  = if IsNaN((close2 - low2) / (high2 - low2) * 100)
               then BuyStr2[1]
               else (close2 - low2) / (high2 - low2) * 100;
def SellStr2 = if IsNaN((high2 - close2) / (high2 - low2) * 100)
               then SellStr2[1]
               else (high2 - close2) / (high2 - low2) * 100;

plot BuyVol = if ShowBuySellStrengthOnVolumeBars then (BuyStr / 100) * v else NA;
def SellVol = (SellStr / 100) * v;
def BuyVol2 = (BuyStr2 / 100) * volume2;
def SellVol2 = (SellStr2 / 100) * volume2;
AddCloud(if ShowBuySellStrength2ndAgg then BuyVol2 else NA, 0, VolColor.Color("Bullish"), VolColor.Color("Bullish"), yes);
AddCloud(if ShowBuySellStrength2ndAgg then v2 else NA, BuyVol2, VolColor.Color("Bearish"), VolColor.Color("Bearish"), yes);

BuyVol.SetDefaultColor(VolColor.Color("Bullish"));
BuyVol.SetPaintingStrategy(PaintingStrategy.SQUARED_HISTOGRAM);

plot Vol          = v;
plot VolumeBottom = if !ShowVolumeAsCandlesticks or ShowBuySellStrengthOnVolumeBars then NA else VolumeBottomShadowValue;
plot VolumeBody   = if !ShowVolumeAsCandlesticks or ShowBuySellStrengthOnVolumeBars then NA else BodyRangeVolValue;

VolumeBottom.HideTitle();
VolumeBody.HideTitle();

plot VolAvg = MovingAverage(VolAverageType, v, AvgVolLength);

#2Sigma and 3Sigma Vol Filter
def Num_Dev1          = 2.0;
def Num_Dev2          = 3.0;
def averageType       = AverageType.SIMPLE;
def sDev = StDev(data = Vol, length = AvgVolLength);

plot VolSigma2 = VolAvg + Num_Dev1 * sDev;
plot VolSigma3 = VolAvg + Num_Dev2 * sDev;


def RelDayVol     = DayVol / AvgDayVol[1];
def RelPrevDayVol = DayVol / volume("period" = DayVolAgg)[1];
#Daily aggregation volume labels
AddLabel(if GetAggregationPeriod() >= AggregationPeriod.DAY then 0 else if ShowDayVolLabel then 1 else 0, "DayVol: " + DayVol + " / " + Round(RelDayVol, 2) + "x Avg(" + AvgDayVolLength + ") / " + Round(RelPrevDayVol, 2) + "x Prev", if DayVol > AvgDayVol then VolColor.Color("VolAvg") else VolColor.Color("Below Average"));

def RelVol = Vol / VolAvg[1];
def RelPrevVol = v / v[1];

#Triangle Vol Signal
plot VolSignal = if Vol > VolSigma3 then v else if Vol > VolSigma2 then v else if Vol > VolAvg then volume else if RelPrevVol >= RelativetoPrevVolTolerance then v else NA;

#current aggregation's volume labels
AddLabel(ShowBarVolLabel, "Vol: " + v + " / " + Round(RelVol, 2) + "x Avg(" + AvgVolLength + ") / " + Round(RelPrevVol, 2) + "x Prev",  if Vol > VolSigma3 then VolColor.Color("VolSigma3") else if Vol > VolSigma2 then VolColor.Color("VolSigma2") else if Vol > VolAvg then VolColor.Color("VolAvg") else VolColor.Color("Below Average"));

#ETH Total Vol Label
def ETH_VOL = if !conf and conf[1] then v else if !conf then CompoundValue(1, ETH_VOL[1] + v, v) else ETH_VOL[1];

AddLabel(if !ShowEthTotalVol then 0 else if GetAggregationPeriod() >= AggregationPeriod.DAY then 0 else 1, "ETH TVOL: " + ETH_VOL, VolColor.Color("ETH TVOL"));

#$TICK Vertical Lines
def tickc = close("$TICK");
def tickh = high("$TICK");
def tickl = low("$TICK");

AddVerticalLine(if ShowVertLines and (tickh > TickLevel) or ShowVertLines and (tickl < -TickLevel) then 1 else 0, if (tickh > TickLevel) then tickh else if (tickl < -TickLevel) then tickl else Double.NaN, VolColor.Color("TICK Vert"));

#$TICK Label
AddLabel(if ShowTickLabel then 1 else 0, "$TICK: " + tickc, if tickc > 0 then Color.GREEN else Color.RED);

#current candle Buy/Sell strength labels
AddLabel(if ShowBuySellStrength then 1 else 0, " ", Color.BLACK);
AddLabel(if ShowBuySellStrength then 1 else 0, "1", Color.GRAY);
AddLabel(if ShowBuySellStrength then 1 else 0, "Sell " + Round(SellStr, 2) + "%", if SellStr > BuyStr then Color.RED else Color.DARK_RED);
AddLabel(if ShowBuySellStrength then 1 else 0, "Buy " + Round(BuyStr, 2) + "%", if BuyStr > SellStr then Color.GREEN else Color.DARK_GREEN);

#2nd Aggregation Buy/Sell strength labels
#AddLabel(if ShowBuySellStrength then 1 else 0, "Check BuySellAgg2 > Current Agg", Color.YELLOW);
AddLabel(if !ShowBuySellStrength then 0 else 1, " ", Color.BLACK);
AddLabel(if !ShowBuySellStrength then 0 else 1, "2", Color.GRAY);
AddLabel(if !ShowBuySellStrength then 0 else 1, "Sell " + Round(SellStr2, 2) + "%", if SellStr2 > BuyStr2 then Color.RED else Color.DARK_RED);
AddLabel(if !ShowBuySellStrength then 0 else 1, "Buy " + Round(BuyStr2, 2) + "%", if BuyStr2 > SellStr2 then Color.GREEN else Color.DARK_GREEN);

VolumeBottom.SetPaintingStrategy(PaintingStrategy.SQUARED_HISTOGRAM);
VolumeBottom.AssignValueColor(Color.BLACK);
VolumeBody.SetPaintingStrategy(PaintingStrategy.SQUARED_HISTOGRAM);

VolumeBody.AssignValueColor(if PaintAboveAvgVolBars and Vol > VolSigma3 then VolColor.Color("VolSigma3") else if PaintAboveAvgVolBars and Vol > VolSigma2 then VolColor.Color("VolSigma2") else if PaintAboveAvgVolBars and Vol > VolAvg then VolColor.Color("VolAvg") else if PaintAccordingToRelPrevVol and RelPrevVol >= RelativetoPrevVolTolerance then VolColor.Color("Relative to Prev") else if  PaintBelowAvgVol and Vol < VolAvg then VolColor.Color("Below Average") else if c > o then VolColor.Color("Bullish") else VolColor.Color("Bearish"));
#VolumeTop.SetPaintingStrategy(PaintingStrategy.SQUARED_HISTOGRAM);
#VolumeTop.AssignValueColor(if close > open then Color.Black else Color.Black);

VolAvg.SetDefaultColor(VolColor.Color("VolAvg"));
VolSigma2.SetDefaultColor(VolColor.Color("VolSigma2"));
VolSigma3.SetDefaultColor(VolColor.Color("VolSigma3"));

Vol.SetPaintingStrategy(if !ShowVolumeAsCandlesticks or ShowBuySellStrengthOnVolumeBars then PaintingStrategy.SQUARED_HISTOGRAM else PaintingStrategy.HISTOGRAM);

Vol.SetLineWeight(1);
Vol.AssignValueColor(if ShowBuySellStrengthOnVolumeBars then VolColor.Color("Bearish") else if PaintAboveAvgVolBars and v > VolSigma3 then VolColor.Color("VolSigma3") else if PaintAboveAvgVolBars and v > VolSigma2 then VolColor.Color("VolSigma2") else if PaintAboveAvgVolBars and v > VolAvg then VolColor.Color("VolAvg") else if PaintAccordingToRelPrevVol and RelPrevVol >= RelativetoPrevVolTolerance then VolColor.Color("Relative to Prev") else if PaintBelowAvgVol and v < VolAvg then VolColor.Color("Below Average") else if c > o then VolColor.Color("Bullish") else VolColor.Color("Bearish"));

AssignPriceColor(if PaintPriceAsVol and PaintAboveAvgVolBars and v > VolSigma3 then VolColor.Color("VolSigma3") else if PaintPriceAsVol and PaintAboveAvgVolBars and v > VolSigma2 then VolColor.Color("VolSigma2") else if PaintPriceAsVol and PaintAboveAvgVolBars and v > VolAvg then VolColor.Color("VolAvg") else if PaintPriceAsVol and PaintAccordingToRelPrevVol and RelPrevVol >= RelativetoPrevVolTolerance then VolColor.Color("Relative to Prev") else if PaintPriceAsVol and PaintBelowAvgVol and v < VolAvg then VolColor.Color("Below Average") else Color.CURRENT);

VolSignal.AssignValueColor(if Vol > VolSigma3 then VolColor.Color("VolSigma3") else if Vol > VolSigma2 then VolColor.Color("VolSigma2") else if Vol > VolAvg then VolColor.Color("VolAvg") else if RelPrevVol >= RelativetoPrevVolTolerance then VolColor.Color("Relative to Prev") else VolColor.Color("Below Average"));
VolSignal.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
VolAvg.SetLineWeight(2);
VolSignal.SetLineWeight(1);



########################################
#Buy/Sell Bubbles

input show_buy_sell_bubbles = no;
input bubblemover           = 0;
def b                       = bubblemover;
def b1                      = b + 1;

def periods     = bar % bars == 0;
def periodCount = CompoundValue(1, if periods then periodCount[1] + 1 else periodCount[1], 0);
def thisperiod  = (HighestAll(periodCount) - periodCount) ;

AddChartBubble(show_buy_sell_bubbles and thisperiod[b1] != thisperiod[b], VolAvg[b], Round(SellStr2[b1]) + "%", if Round(SellStr2[b1]) > Round(BuyStr2[b1]) then Color.RED else Color.GRAY);
AddChartBubble(show_buy_sell_bubbles and thisperiod[b1] != thisperiod[b] , VolAvg[b], Round(BuyStr2[b1]) + "%", if Round(SellStr2[b1]) > Round(BuyStr2[b1]) then Color.GRAY else Color.GREEN);

input show_buy_sell_bubbles_last = yes;
AddChartBubble(show_buy_sell_bubbles_last and IsNaN(close[-1]) and !IsNaN(close) and BarNumber() == bar and thisperiod == thisperiod[1], VolAvg, Round(SellStr2) + "%", if Round(SellStr2) > Round(BuyStr2) then Color.RED else Color.GRAY);
AddChartBubble(show_buy_sell_bubbles_last and IsNaN(close[-1]) and !IsNaN(close) and BarNumber() == bar , VolAvg, Round(BuyStr2) + "%" , if Round(SellStr2) > Round(BuyStr2) then Color.GRAY else Color.GREEN);
#######################################
 
When I adjust the script to show the buy sell strength on the volume bars does anyone know how exactly it’s painting them. Is one bar the total volume and the other is painting over it ?
 
@itsjt562 Not necessarily. It depends on your input settings. But if you have show buysell strength set to yes then the code states the volume bar color is bearish.
if ShowBuySellStrengthOnVolumeBars then VolColor.Color("Bearish")
Here is the complete code for painting the volume bar:
Ruby:
Vol.AssignValueColor(
if ShowBuySellStrengthOnVolumeBars then VolColor.Color("Bearish") else
if PaintAboveAvgVolBars and volume > VolSigma3 then VolColor.Color("VolSigma3") else 
if PaintAboveAvgVolBars and volume > VolSigma2 then VolColor.Color("VolSigma2") else 
if PaintAboveAvgVolBars and volume > VolAvg then VolColor.Color("VolAvg") else 
if PaintAccordingToRelPrevVol and RelPrevVol >= RelativetoPrevVolTolerance then VolColor.Color("Relative to Prev") else 
if PaintBelowAvgVol and volume < VolAvg then VolColor.Color("Below Average") else 
if close > open then VolColor.Color("Bullish") else VolColor.Color("Bearish"));
 
Last edited:
@itsjt562 That is the way I read the code. Do you see something different?
No was just trying to get some clarification to exactly what it’s doing and so far based off what I’ve seen and traded off that seems very accurate. If the buyers are there it will paint the amount of green to represent them and if they aren’t really present the majority of the candle will stay red. It’s very useful I find to see when they manipulate large caps near support. They will quickly break it but if you watch the volume and it’s painting majority buyers chances are it will run.
 
Does anyone have or can help me figure out how to create a watchlist and label for volume percentage like IBD has. Basically showing a percentage of average daily volume that a stock is on pace for based on the volume already traded at that time.
 
a friend shared this. i tested it, it's pretty good and i think you'll like it also, but it only works on time bars so not exactly useful for other 2/3 of traders out there.

anyone able to enable this on tick and range bars would be greatly appreciated.

also, if candlesticks in chart could mirror the % buy/sell volume in indicator below, wouldn't that be huge?

thank you so much for helping with this

#[email protected]
#v5.15.2020
plot Data = close;
declare on_volume;
input ShowVolumeAsCandlesticks = no;
input ShowBuySellStrengthOnVolumeBars = no;
input ShowBuySellStrength2ndAgg = no;
input AvgDayVolLength = 5;
input AvgVolLength = 20;
input ShowDayVolLabel = yes;
input ShowBarVolLabel = yes;
input ShowEthTotalVol = no;
input ShowBuySellStrength = yes;
input BuySellStrAgg2 = AggregationPeriod.THIRTY_MIN;
def BuySellStrAggregation2 = if GetAggregationPeriod() < BuySellStrAgg2 then BuySellStrAgg2 else GetAggregationPeriod();
AddLabel(if GetAggregationPeriod() < BuySellStrAgg2 then 0 else 1, "Adjust BuySellStrAgg2 in Study Settings", Color.YELLOW);
input VolAverageType = AverageType.SIMPLE;
#if ShowBuySellStrengthOnVolumeBars is toggled on then the following volume bar paint options will not show, only the VolSignal Triangle set at the top of the bars will be painting according to volume average levels.
input PaintAboveAvgVolBars = yes;
input PaintAccordingToRelPrevVol = yes;
input RelativetoPrevVolTolerance = 1.25; #if volume is 1.25x greater than previous bar it will paint even if it is still below the average/sigma2/sigma3
input PaintBelowAvgVol = yes;
input PaintPriceAsVol = no;
input ShowVerticalTickLines = yes;
def ShowVertLines = if ShowVerticalTickLines and GetAggregationPeriod() < AggregationPeriod.DAY then 1 else 0;
input TickLevel = 1000;
input ShowTickLabel = yes;


def NA = Double.NaN;
def PriceRange = high - low;
def TopShadowRange = if open >= close then high - open else high - close;
def BottomShadowRange = if open <= close then open - low else close - low;
def BodyRange = PriceRange - (TopShadowRange + BottomShadowRange);
def VolumeTopShadowValue = (1 - (TopShadowRange / PriceRange)) * volume;
def VolumeBottomShadowValue = ((BottomShadowRange / PriceRange) * volume);
def BodyRangeVolValue = ((BodyRange + BottomShadowRange) / PriceRange) * volume;
#def DayVolAgg = if GetAggregationPeriod() < AggregationPeriod.DAY then AggregationPeriod.DAY else if GetAggregationPeriod() >= AggregationPeriod.DAY then AggregationPeriod.WEEK else GetAggregationPeriod();
def DayVolAgg = if GetAggregationPeriod() < AggregationPeriod.DAY then AggregationPeriod.DAY else GetAggregationPeriod();
def DayVol = volume("period" = DayVolAgg);
def AvgDayVol = Average(DayVol, AvgDayVolLength);
def Start = 0930;
def End = 1600;
def conf = SecondsFromTime(Start) >= 0 and SecondsFromTime(End) <= 0;

plot VolColor = NA;
VolColor.DefineColor("Bullish", Color.GREEN);
VolColor.DefineColor("Bearish", Color.RED);
VolColor.DefineColor("VolAvg", CreateColor(0, 100, 200));
VolColor.DefineColor("VolSigma2", Color.DARK_ORANGE);
VolColor.DefineColor("VolSigma3", Color.MAGENTA);
VolColor.DefineColor("Relative to Prev", Color.YELLOW);
VolColor.DefineColor("Below Average", Color.GRAY);
VolColor.DefineColor("ETH TVOL", Color.GRAY);
#Current Candle Buy and Sell Strength
def BuyStr = ((close - low) / PriceRange) * 100;
def SellStr = ((high - close) / PriceRange) * 100;

def BuyStr2 = ((close("period" = BuySellStrAggregation2) - low("period" = BuySellStrAggregation2)) / (high("period" = BuySellStrAggregation2) - low("period" = BuySellStrAggregation2))) * 100;
def SellStr2 = ((high("period" = BuySellStrAggregation2) - close("period" = BuySellStrAggregation2)) / (high("period" = BuySellStrAggregation2) - low("period" = BuySellStrAggregation2))) * 100;

plot BuyVol = if ShowBuySellStrengthOnVolumeBars then (BuyStr/100)*volume else NA;
def SellVol = (SellStr/100)*volume;
def BuyVol2 = (BuyStr2/100)*volume("period" = BuySellStrAggregation2);
def SellVol2 = (SellStr2/100)*volume("period" = BuySellStrAggregation2);
AddCloud(if ShowBuySellStrength2ndAgg then BuyVol2 else NA, 0, VolColor.Color("Bullish"), VolColor.Color("Bullish"), yes);
AddCloud(if ShowBuySellStrength2ndAgg then volume("period" = BuySellStrAggregation2) else NA, BuyVol2, VolColor.Color("Bearish"), VolColor.Color("Bearish"), yes);

BuyVol.SetDefaultColor(VolColor.Color("Bullish"));
BuyVol.SetPaintingStrategy(PaintingStrategy.SQUARED_HISTOGRAM);
#BuyVol2.SetDefaultColor(Color.GREEN);
#BuyVol2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
#SellVol2.SetDefaultColor(Color.GREEN);
#SellVol2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

plot Vol = volume;
plot VolumeBottom = if !ShowVolumeAsCandlesticks or ShowBuySellStrengthOnVolumeBars then NA else VolumeBottomShadowValue;
plot VolumeBody = if !ShowVolumeAsCandlesticks or ShowBuySellStrengthOnVolumeBars then NA else BodyRangeVolValue;

VolumeBottom.HideTitle();
VolumeBody.HideTitle();

plot VolAvg = MovingAverage(VolAverageType, volume, AvgVolLength);

#2Sigma and 3Sigma Vol Filter
def Num_Dev1 = 2.0;
def Num_Dev2 = 3.0;
def averageType = AverageType.SIMPLE;
def sDev = StDev(data = Vol, length = AvgVolLength);

plot VolSigma2 = VolAvg + Num_Dev1 * sDev;
plot VolSigma3 = VolAvg + Num_Dev2 * sDev;


def RelDayVol = DayVol / AvgDayVol;
def RelPrevDayVol = DayVol / volume("period" = DayVolAgg)[1];
#Daily aggregation volume labels
AddLabel(if GetAggregationPeriod() >= AggregationPeriod.DAY then 0 else if ShowDayVolLabel then 1 else 0, "DayVol: " + DayVol + " / " + Round(RelDayVol, 2) + "x Avg(" + AvgDayVolLength + ") / " + Round(RelPrevDayVol, 2) + "x Prev", if DayVol > AvgDayVol then VolColor.Color("VolAvg") else VolColor.Color("Below Average"));

def RelVol = Vol / VolAvg;
def RelPrevVol = volume / volume[1];

#Triangle Vol Signal
plot VolSignal = if Vol > VolSigma3 then volume else if Vol > VolSigma2 then volume else if Vol > VolAvg then volume else if RelPrevVol >= RelativetoPrevVolTolerance then volume else NA;

#current aggregation's volume labels
AddLabel(ShowBarVolLabel, "Vol: " + volume + " / " + Round(RelVol, 2) + "x Avg(" + AvgVolLength + ") / " + Round(RelPrevVol, 2) + "x Prev", if Vol > VolSigma3 then VolColor.Color("VolSigma3") else if Vol > VolSigma2 then VolColor.Color("VolSigma2") else if Vol > VolAvg then VolColor.Color("VolAvg") else VolColor.Color("Below Average"));

#ETH Total Vol Label
def ETH_VOL = if !conf and conf[1] then volume else if !conf then CompoundValue(1, ETH_VOL[1] + volume, volume) else ETH_VOL[1];

AddLabel(if !ShowEthTotalVol then 0 else if GetAggregationPeriod() >= AggregationPeriod.DAY then 0 else 1, "ETH TVOL: " + ETH_VOL, VolColor.Color("ETH TVOL"));

#$TICK Vertical Lines
def tickc = close("$TICK");
def tickh = high("$TICK");
def tickl = low("$TICK");

AddVerticalLine(if ShowVertLines and (tickh > TickLevel) or ShowVertLines and (tickl < -TickLevel) then 1 else 0, if (tickh > TickLevel) then tickh else if (tickl < -TickLevel) then tickl else Double.NaN, Color.WHITE);

#$TICK Label
AddLabel(if ShowTickLabel then 1 else 0,"$TICK: " + tickc, if tickc > 0 then Color.BLACK else Color.BLACK);

#$TICK Label
AddLabel(if ShowTickLabel then 1 else 0,"$TICK: " + tickc, if tickc > 0 then Color.BLACK else Color.BLACK);

#$TICK Label
AddLabel(if ShowTickLabel then 1 else 0,"$TICK: " + tickc, if tickc > 0 then Color.BLACK else Color.BLACK);

#current candle Buy/Sell strength labels
AddLabel(if ShowBuySellStrength then 1 else 0, " ", Color.GREEN);
AddLabel(if ShowBuySellStrength then 1 else 0, "1", Color.RED);
AddLabel(if ShowBuySellStrength then 1 else 0, "Sell " + Round(SellStr, 2) + "%", if SellStr > BuyStr then Color.RED else Color.BLACK);
AddLabel(if ShowBuySellStrength then 1 else 0, "Buy " + Round(BuyStr, 2) + "%", if BuyStr > SellStr then Color.GREEN else Color.BLACK);

VolumeBottom.SetPaintingStrategy(PaintingStrategy.SQUARED_HISTOGRAM);
VolumeBottom.AssignValueColor(Color.BLACK);
VolumeBody.SetPaintingStrategy(PaintingStrategy.SQUARED_HISTOGRAM);

VolumeBody.AssignValueColor(if PaintAboveAvgVolBars and Vol > VolSigma3 then VolColor.Color("VolSigma3") else if PaintAboveAvgVolBars and Vol > VolSigma2 then VolColor.Color("VolSigma2") else if PaintAboveAvgVolBars and Vol > VolAvg then VolColor.Color("VolAvg") else if PaintAccordingToRelPrevVol and RelPrevVol >= RelativetoPrevVolTolerance then VolColor.Color("Relative to Prev") else if PaintBelowAvgVol and Vol < VolAvg then VolColor.Color("Below Average") else if close > open then VolColor.Color("Bullish") else VolColor.Color("Bearish"));
#VolumeTop.SetPaintingStrategy(PaintingStrategy.SQUARED_HISTOGRAM);
#VolumeTop.AssignValueColor(if close > open then Color.Black else Color.Black);

VolAvg.SetDefaultColor(VolColor.Color("VolAvg"));
VolSigma2.SetDefaultColor(VolColor.Color("VolSigma2"));


Vol.SetPaintingStrategy(if !ShowVolumeAsCandlesticks or ShowBuySellStrengthOnVolumeBars then PaintingStrategy.SQUARED_HISTOGRAM else PaintingStrategy.HISTOGRAM);

Vol.SetLineWeight(1);
Vol.AssignValueColor(if ShowBuySellStrengthOnVolumeBars then VolColor.Color("Bearish") else if PaintAboveAvgVolBars and volume > VolSigma3 then VolColor.Color("VolSigma3") else if PaintAboveAvgVolBars and volume > VolSigma2 then VolColor.Color("VolSigma2") else if PaintAboveAvgVolBars and volume > VolAvg then VolColor.Color("VolAvg") else if PaintAccordingToRelPrevVol and RelPrevVol >= RelativetoPrevVolTolerance then VolColor.Color("Relative to Prev") else if PaintBelowAvgVol and volume < VolAvg then VolColor.Color("Below Average") else if close > open then VolColor.Color("Bullish") else VolColor.Color("Bearish"));

AssignPriceColor(if PaintPriceAsVol and PaintAboveAvgVolBars and volume > VolSigma3 then VolColor.Color("VolSigma3") else if PaintPriceAsVol and PaintAboveAvgVolBars and volume > VolSigma2 then VolColor.Color("VolSigma2") else if PaintPriceAsVol and PaintAboveAvgVolBars and volume > VolAvg then VolColor.Color("VolAvg") else if PaintPriceAsVol and PaintAccordingToRelPrevVol and RelPrevVol >= RelativetoPrevVolTolerance then VolColor.Color("Relative to Prev") else if PaintPriceAsVol and PaintBelowAvgVol and volume < VolAvg then VolColor.Color("Below Average") else Color.CURRENT);

VolSignal.AssignValueColor(if Vol > VolSigma3 then VolColor.Color("VolSigma3") else if Vol > VolSigma2 then VolColor.Color("VolSigma2") else if Vol > VolAvg then VolColor.Color("VolAvg") else if RelPrevVol >= RelativetoPrevVolTolerance then VolColor.Color("Relative to Prev") else VolColor.Color("Below Average"));
VolSignal.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
VolAvg.SetLineWeight(2);
VolSignal.SetLineWeight(1);
 
Absolutely. This shows the relative buy/sell volume for each bar. nice for divergence on individual bars as well (rather than waiting for lagging indicator).

well, i'm trying to copy/paste, but it's not letting me. windows computer. how do you paste? this chat/app is asking for a link, but i don't have a link for my own clipboard.

thank you very much
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
275 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

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.

How do I get started?

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.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top