Advanced Volume Indicator for ThinkorSwim

Status
Not open for further replies.

Welkin

Active member
The author of the study isn't available on the forum to provide answers to questions. So this thread has been locked.
Other members are offering their contributions on the Questions Forum in the thread --> https://usethinkscript.com/threads/coding-help-for-welkins-advanced-volume-indicator.7295/


Updates & Features:

  • Showing Volume Bars as Candlesticks is now optional and can be toggled on/off in the study settings
  • Added Labels to show Day and Current Volume/ Avg Relative Volume / and Vol Relative to Previous
When the chart time frame > daily time frame the daily volume label will be hidden.
The Blue is volume average with a default length of 20.
The Orange line is a 2-sigma (2 deviations from the average) volume filter.
The Magenta line is a 3-sigma volume filter .
When volume is greater than the average a blue triangle will be plotted above the volume candlestick. When above the 2-sigma line it will be orange, and when above the 3-sigma it will be magenta.
When current volume exceeds the averages the label will change from gray to blue/orange/magenta depending on which is crossed.
If the daily vol exceeds the daily vol average the label will change from gray to blue.
  • Added Buy/Sell Str for current aggregation and a 2nd aggregation
    Note that this does not provide the true buy and sell volume, as this data is not available through TOS for individual stocks, although there are market internals that show up and down volume available for the different exchanges. Alternatively up and down tick data can be utilized to try and estimate buy and sell volume, but you do not know how many contracts/shares there are in a given tick. This method is just a workaround by finding the percent difference of the close price relative to a candles range (high - low) and multiplying it by volume.
    BuyStr = (close - low) / (high - low)
    SellStr = (high - close) / (high - low)
    This is also kind of similar to how a part of ADL or CMF is calculated, which uses (close - low) - (high - close) / (high - low)
  • Added option to paint volume bars reflecting Buy/Sell strength
  • Added option to show 2nd aggregation Buy/Sell strength clouds in the background
  • Added options to repaint volume bars if they exceed the averages.
  • Added option to color volume bars gray(or whatever color you want) if they are below average.
  • Added a tolerance level that can be set ( currently 1.25) that if the current bar is 1.25x greater volume relative to the previous volume bar it will be painted (currently yellow by default) even if it is not above the volume average, sigma2, or sigma3.
  • Added Label for Extended Trading Hours total volume (ETH TVOL), not showing by default, change ShowEthTotalVol to yes for it to be visible. If the chart aggregation is >= daily then it will not show.
  • Added $TICK Label
  • Added $TICK vertical lines which are plotted when $TICK > 1000 or < -1000 (this level can also be adjusted in the study settings if you want to plot at a level other than +/-1000)
  • Added an option to paint price bars according to how you've customized the volume settings
7MAuDt6.png

v2EhEOF.png

o9FnMH8.png


thinkScript Code

Code:
#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 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);
VolColor.DefineColor("TICK Vert", 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[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 = 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, 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 GetAggregationPeriod() >= BuySellStrAggregation2 and ShowBuySellStrength then 1 else 0,"Check BuySellAgg2 > Current Agg", Color.YELLOW);
AddLabel(if GetAggregationPeriod() >= BuySellStrAggregation2 or !ShowBuySellStrength then 0 else 1, " ", Color.BLACK);
AddLabel(if GetAggregationPeriod() >= BuySellStrAggregation2 or !ShowBuySellStrength then 0 else 1, "2", Color.GRAY);
AddLabel(if GetAggregationPeriod() >= BuySellStrAggregation2 or !ShowBuySellStrength then 0 else 1, "Sell " + Round(SellStr2, 2) + "%", if SellStr2 > BuyStr2 then Color.RED else Color.DARK_RED);
AddLabel(if GetAggregationPeriod() >= BuySellStrAggregation2 or !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 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"));
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 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);

Shareable Link: https://tos.mx/jIx0x2n

With Show Volume As Candlesticks Toggled On:
L14n3BR.png

With Show Volume As Candlesticks Toggled Off:
jYcdRKH.png

With Show Buy/Sell Strength On Volume Bars and Buy/SellStrength 2nd Aggregation In Background toggled On:
rZorcuw.png

With All Volume Bar Paint Options Disabled:
sGtrIp2.png

With Price Paint Bars On:
ke8nYtl.png

Dwbz5ZC.png


Upper Study for VSA

I created this indicator to accompany the main volume indicator for those who use VSA (Volume Spread Analysis), what this does is draws a line across at high and low of bars with high interest volume.

kRurQCg.png


https://tos.mx/ak3uWTh
Code:
#Companion indicator to the Advanced Volume Study for Volume Spread Analysis
#[email protected]
declare upper;
input PaintPriceAsVol = no;
input AvgDayVolLength = 5;
input AvgVolLength = 20;
input ShowDayVolLabel = yes;
input ShowBarVolLabel = yes;
input ShowEthTotalVolLabel = no;
input ShowTickLabel = yes;
input VolAverageType = AverageType.SIMPLE;
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 ShowVerticalTickLines = yes;
def ShowVertLines = if ShowVerticalTickLines and GetAggregationPeriod() < AggregationPeriod.DAY then 1 else 0;
input TickLevel = 1000;



def NA = Double.NaN;

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);
def Vol = volume;

def 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);

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

#####
#VSA start test
#####
def VSig3H = if volume > VolSigma3 then high else VSig3H[1];
def VSig2H = if volume > VolSigma2 and volume < VolSigma3 then high else VSig2H[1];
def VSigAH = if volume > VolAvg and volume < VolSigma2 then high else VSigAH[1];
def VSig3L = if volume > VolSigma3 then low else VSig3L[1];
def VSig2L = if volume > VolSigma2 and volume < VolSigma3 then low else VSig2L[1];
def VSigAL = if volume > VolAvg and volume < VolSigma2 then low else VSigAL[1];

plot VSig3Hc = Vsig3H;
plot VSig2Hc = Vsig2H;
plot VSigAHc = VSigAH;
plot VSig3Lc = Vsig3L;
plot VSig2Lc = Vsig2L;
plot VSigALc = VSigAL;


VSig3Hc.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
VSig2Hc.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
VSigAHc.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
VSig3Lc.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
VSig2Lc.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
VSigALc.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
VSig3Hc.SetDefaultColor(Color.MAGENTA);
VSig2Hc.SetDefaultColor(Color.DARK_ORANGE);
VSigAHc.SetDefaultColor(CreateColor(0,125,225));
VSig3Lc.SetDefaultColor(Color.MAGENTA);
VSig2Lc.SetDefaultColor(Color.DARK_ORANGE);
VSigALc.SetDefaultColor(CreateColor(0,125,225));


#####
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 = volume / volume[1];

#Triangle Vol Signal
def 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 !ShowEthTotalVolLabel 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);


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);

Watchlist Columns

PlCQiam.png

Code:
#[email protected]
#Advanced Volume Watchlist Column
#Add-on to https://tos.mx/jIx0x2n
#Relative to Avg Vol / Relative to Previous Volume bar

input VolAverageType = AverageType.SIMPLE;
input AvgVolLength = 20;
input RelativetoPrevVolTolerance = 1.25;

def Vol = volume;
def Num_Dev1 = 2.0;
def Num_Dev2 = 3.0;
def averageType = AverageType.SIMPLE;
def sDev = StDev(data = Vol, length = AvgVolLength);
def VolAvg = MovingAverage(VolAverageType, volume, AvgVolLength);
def VolSigma2 = VolAvg + Num_Dev1 * sDev;
def VolSigma3 = VolAvg + Num_Dev2 * sDev;
def RelVol = Vol / VolAvg[1];
def RelPrevVol = volume / volume[1];
AssignBackgroundColor(if Vol > VolSigma3 then Color.MAGENTA else if Vol > VolSigma2 then Color.DARK_ORANGE else if Vol > VolAvg then CreateColor(0, 100, 200) else if RelPrevVol >= RelativetoPrevVolTolerance then Color.YELLOW else Color.GRAY);

AddLabel(1, Round(RelVol, 2) + "x / " + Round(RelPrevVol, 2) +"x", Color.BLACK);
fvTij7O.png

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);
 
Last edited by a moderator:
I created this indicator to accompany the main volume indicator for those who use VSA (Volume Spread Analysis), what this does is draws a line across at high and low of bars with high interest volume.

kRurQCg.png

https://tos.mx/ak3uWTh
Code:
#Companion indicator to the Advanced Volume Study for Volume Spread Analysis
#[email protected]
declare upper;
input PaintPriceAsVol = no;
input AvgDayVolLength = 5;
input AvgVolLength = 20;
input ShowDayVolLabel = yes;
input ShowBarVolLabel = yes;
input ShowEthTotalVolLabel = no;
input ShowTickLabel = yes;
input VolAverageType = AverageType.SIMPLE;
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 ShowVerticalTickLines = yes;
def ShowVertLines = if ShowVerticalTickLines and GetAggregationPeriod() < AggregationPeriod.DAY then 1 else 0;
input TickLevel = 1000;



def NA = Double.NaN;

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);
def Vol = volume;

def 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);

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

#####
#VSA start test
#####
def VSig3H = if volume > VolSigma3 then high else VSig3H[1];
def VSig2H = if volume > VolSigma2 and volume < VolSigma3 then high else VSig2H[1]; 
def VSigAH = if volume > VolAvg and volume < VolSigma2 then high else VSigAH[1];
def VSig3L = if volume > VolSigma3 then low else VSig3L[1];
def VSig2L = if volume > VolSigma2 and volume < VolSigma3 then low else VSig2L[1]; 
def VSigAL = if volume > VolAvg and volume < VolSigma2 then low else VSigAL[1];

plot VSig3Hc = Vsig3H;
plot VSig2Hc = Vsig2H;
plot VSigAHc = VSigAH;
plot VSig3Lc = Vsig3L;
plot VSig2Lc = Vsig2L;
plot VSigALc = VSigAL;


VSig3Hc.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
VSig2Hc.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
VSigAHc.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
VSig3Lc.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
VSig2Lc.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
VSigALc.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
VSig3Hc.SetDefaultColor(Color.MAGENTA);
VSig2Hc.SetDefaultColor(Color.DARK_ORANGE);
VSigAHc.SetDefaultColor(CreateColor(0,125,225));
VSig3Lc.SetDefaultColor(Color.MAGENTA);
VSig2Lc.SetDefaultColor(Color.DARK_ORANGE);
VSigALc.SetDefaultColor(CreateColor(0,125,225));


#####
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 = volume / volume[1];

#Triangle Vol Signal
def 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 !ShowEthTotalVolLabel 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);


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);
 
Last edited:
@Ishaam I feel like an oscillator might better suit your needs, this is based on the same volume buy and sell strength calculations, but a difference is taken and plotted as a moving average. Let me know if this works better for you, otherwise I'll make some changes to the other study.

MTF Volume Strength Oscillator
https://tos.mx/UVAhSKz
5613sFW.png

Is there a link for that 'WelkinVolumeCandlesticks' study from the quoted post?

I feel as though I cannot locate it...

Thanks!
 
Is there a link for that 'WelkinVolumeCandlesticks' study from the quoted post?

I feel as though I cannot locate it...

Thanks!
that was the name of the indicator in its first stages, and its initial feature highlight. But because I've added so many features to it I requested BenTen to change the thread title to advanced volume indicator, since its grown far beyond what it was in its initial stages. Showing volume as candlesticks is now the first toggle in the study settings:
9hvdCFX.png
 
I love this indicator! I have a question for it, as well as custom volume indicators as a whole- Should we disable the "show volume subgraph" setting?
 
I love this indicator! I have a question for it, as well as custom volume indicators as a whole- Should we disable the "show volume subgraph" setting?
not necessary, although if you find that your volume color presets are interfering with your volume analysis, I recommend changing that to black or whatever color to better match your ToS theme background so that it doesn't bleed through the squared histogram bars, as the indicator overlays on top.
HJn3auz.png


The first line in the script
Code:
declare on_volume;
can be changed to
Code:
declare lower;
if you wish to remove volume subgraph and have it automatically set as a lower study when added to charts, rather than having to manually drag it down to lower studies.
 
not necessary, although if you find that your volume color presets are interfering with your volume analysis, I recommend changing that to black or whatever color to better match your ToS theme background so that it doesn't bleed through the squared histogram bars, as the indicator overlays on top.
HJn3auz.png


The first line in the script
Code:
declare on_volume;
can be changed to
Code:
declare lower;
if you wish to remove volume subgraph and have it automatically set as a lower study when added to charts, rather than having to manually drag it down to lower studies.

I appreciate the input. Your method seems to work with this script. I know it may not be appropriate to ask here, but for the "better volume V3 addon" I'm seeing this strange thing happening to my volume graph


Any input?
 
@Welkin - thanks - this is a really good indicator. Is it possible to enable it on a watchlist as well? It will be easy to see the big movers and their volume info without opening each chart separately. Thanks a lot
 
@Necr0sis it looks to me like the oscillating red/green line (plot named VxNet) at the bottom is going into the negative causing the study to be automatically resized to fit the volume pane, rather than remaining at zerobase. this would be one of those volume indicators that you'd have set as lower study and disable the volume subgraph on because of that aspect, that is if you consider the dark volume bars the indicator is floating above an eyesore.
 
@Necr0sis it looks to me like the oscillating red/green line (plot named VxNet) at the bottom is going into the negative causing the study to be automatically resized to fit the volume pane, rather than remaining at zerobase. this would be one of those volume indicators that you'd have set as lower study and disable the volume subgraph on because of that aspect, that is if you consider the dark volume bars the indicator is floating above an eyesore.

Awesome Awesome. Again, thanks for answering a question about an unrelated indicator. Your advanced volume doesn't seem to have the same issue though, great indicator!
 
I've got some more questions on this indicator:

Is there any downside to setting my time frame much lower than the second aggregation. For instance, I have my aggregation as 1D, so when I use the 1D time frame I get the message to "Check aggregation". Let's say I increase it to a week, will that cause the lower time frames (from 1D and lower) to be innacurate?

Next, I'm kind of new to trading, and I was wondering what the buy/sell strength is?

Finally, I noticed on the iphone app there is a pink line sitting ontop of the bars.

Y41jVDo.jpg


I find that to be very useful, and was wondering how to enable that on the desktop version of the indicator?

Thank you!
 
I've got some more questions on this indicator:

Is there any downside to setting my time frame much lower than the second aggregation. For instance, I have my aggregation as 1D, so when I use the 1D time frame I get the message to "Check aggregation". Let's say I increase it to a week, will that cause the lower time frames (from 1D and lower) to be innacurate?

Next, I'm kind of new to trading, and I was wondering what the buy/sell strength is?

Finally, I noticed on the iphone app there is a pink line sitting ontop of the bars.

Y41jVDo.jpg


I find that to be very useful, and was wondering how to enable that on the desktop version of the indicator?

Thank you!
Sorry, I didn't script this with mobile in mind. And honestly, I've never tried to view it in mobile, lol. Pretty sure most of its features won't work on mobile.
I can see that the volume bars aren't even being repainted to indicate if above or below average volume bars. The pink line that you are referencing is actually the volsignal plot, on the desktop it shows up as a triangle plotted above each volume bar depending on whether its above average or above a sigma filter. if you wish for it to be a line instead you can change it in the study settings under the VolSignal tab.
Setting your chart's aggregation to a lower aggregation than the buy sell str agg2 will not affect or cause any inaccuracies in the volume data displayed.
The buy/sell strength is explained in the main post with all of the other listed features. the aggregation set in the indicator for buy sell str agg2 are for the labels, and the buy sell str background clouds if toggled on. clouds and labels don't show up on mobile.

I did create a 'Lite' version of the Advanced Volume script which has the buy/sell str features removed, because it was causing issues when viewing custom time frames that aren't commonly used (such as 195 min chart aggregation for example).
if anyone wishes to use it instead it can be found here: https://tos.mx/1c4C3S6
 
I created this indicator to accompany the main volume indicator for those who use VSA (Volume Spread Analysis), what this does is draws a line across at high and low of bars with high interest volume.

kRurQCg.png

https://tos.mx/ak3uWTh
Code:
#Companion indicator to the Advanced Volume Study for Volume Spread Analysis
#[email protected]
declare upper;
input PaintPriceAsVol = no;
input AvgDayVolLength = 5;
input AvgVolLength = 20;
input ShowDayVolLabel = yes;
input ShowBarVolLabel = yes;
input ShowEthTotalVolLabel = no;
input ShowTickLabel = yes;
input VolAverageType = AverageType.SIMPLE;
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 ShowVerticalTickLines = yes;
def ShowVertLines = if ShowVerticalTickLines and GetAggregationPeriod() < AggregationPeriod.DAY then 1 else 0;
input TickLevel = 1000;



def NA = Double.NaN;

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);
def Vol = volume;

def 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);

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

#####
#VSA start test
#####
def VSig3H = if volume > VolSigma3 then high else VSig3H[1];
def VSig2H = if volume > VolSigma2 and volume < VolSigma3 then high else VSig2H[1];
def VSigAH = if volume > VolAvg and volume < VolSigma2 then high else VSigAH[1];
def VSig3L = if volume > VolSigma3 then low else VSig3L[1];
def VSig2L = if volume > VolSigma2 and volume < VolSigma3 then low else VSig2L[1];
def VSigAL = if volume > VolAvg and volume < VolSigma2 then low else VSigAL[1];

plot VSig3Hc = Vsig3H;
plot VSig2Hc = Vsig2H;
plot VSigAHc = VSigAH;
plot VSig3Lc = Vsig3L;
plot VSig2Lc = Vsig2L;
plot VSigALc = VSigAL;


VSig3Hc.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
VSig2Hc.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
VSigAHc.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
VSig3Lc.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
VSig2Lc.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
VSigALc.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
VSig3Hc.SetDefaultColor(Color.MAGENTA);
VSig2Hc.SetDefaultColor(Color.DARK_ORANGE);
VSigAHc.SetDefaultColor(CreateColor(0,125,225));
VSig3Lc.SetDefaultColor(Color.MAGENTA);
VSig2Lc.SetDefaultColor(Color.DARK_ORANGE);
VSigALc.SetDefaultColor(CreateColor(0,125,225));


#####
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 = volume / volume[1];

#Triangle Vol Signal
def 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 !ShowEthTotalVolLabel 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);


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);


@Welkin Hi, thank you for this awesome indicator. I have downloaded the script and this is the image i am seeing, without the lower indicator, is that correct? I have two requests and like to seek your help, is there any way we can scan the orange or magenta candles ? 2. What will be the ideal way to trade with this indicator? Is it that a breakout above the Top of orange will imply greater momentum? I would like to know the concept behind so that it can be more effective utilised. Thank you
 

@Welkin Hi, thank you for this awesome indicator. I have downloaded the script and this is the image i am seeing, without the lower indicator, is that correct? I have two requests and like to seek your help, is there any way we can scan the orange or magenta candles ? 2. What will be the ideal way to trade with this indicator? Is it that a breakout above the Top of orange will imply greater momentum? I would like to know the concept behind so that it can be more effective utilised. Thank you
Yes, the VSA upper indicator is complimentary to the lower indicator, but it can be utilized on its own. though I'd like to recommend the following changes:
1. in the indicator settings toggle 'paint price as vol' to yes.
2. because you have both up and down bars set to fill in your chart appearance settings, I recommend unchecking one so that ones solid and one is hollow, this way you can better distinguish if a repainted bar is bullish or bearish because they will no longer be just green or red candles.

The orange or magenta candles would have a volume that exceeds the sigma2(orange) or sigma3(magenta) filter. you can set a scan for those candles as follows:
Create a scan and add a study filter
4exdVia.png


Edit the study filter here
pj7nnzk.png


Delete the existing condition under the condition wizard panel, then click Add Condition with the following condition settings
mzywL6K.png


Trading with VSA and volume in general is a big topic. I suggest searching and learning about Wyckoff Volume Spread Analysis and methodology as well as Dow Theory of Volume confirmation. This video should act as a good starting point:

There are tons of free resources online, just try looking around on youtube and google. Hope this helps.
 
Yes, the VSA upper indicator is complimentary to the lower indicator, but it can be utilized on its own. though I'd like to recommend the following changes:
1. in the indicator settings toggle 'paint price as vol' to yes.
2. because you have both up and down bars set to fill in your chart appearance settings, I recommend unchecking one so that ones solid and one is hollow, this way you can better distinguish if a repainted bar is bullish or bearish because they will no longer be just green or red candles.

The orange or magenta candles would have a volume that exceeds the sigma2(orange) or sigma3(magenta) filter. you can set a scan for those candles as follows:
Create a scan and add a study filter
4exdVia.png


Edit the study filter here
pj7nnzk.png


Delete the existing condition under the condition wizard panel, then click Add Condition with the following condition settings
mzywL6K.png


Trading with VSA and volume in general is a big topic. I suggest searching and learning about Wyckoff Volume Spread Analysis and methodology as well as Dow Theory of Volume confirmation. This video should act as a good starting point:

There are tons of free resources online, just try looking around on youtube and google. Hope this helps.
@Welkin Thank you so much for the detailed and prompt reply. Will definitely check them out.
 
@Welkin - thanks - this is a really good indicator. Is it possible to enable it on a watchlist as well? It will be easy to see the big movers and their volume info without opening each chart separately. Thanks a lot
I created a watchlist column to show relative to average vol as well as relative vol to previous bar, the background will also paint accordingly if volume is below/above averages on at the set aggregation.
PlCQiam.png


Code:
#[email protected]
#Advanced Volume Watchlist Column
#Add-on to https://tos.mx/jIx0x2n
#Relative to Avg Vol / Relative to Previous Volume bar

input VolAverageType = AverageType.SIMPLE;
input AvgVolLength = 20;
input RelativetoPrevVolTolerance = 1.25;

def Vol = volume;
def Num_Dev1 = 2.0;
def Num_Dev2 = 3.0;
def averageType = AverageType.SIMPLE;
def sDev = StDev(data = Vol, length = AvgVolLength);
def VolAvg = MovingAverage(VolAverageType, volume, AvgVolLength);
def VolSigma2 = VolAvg + Num_Dev1 * sDev;
def VolSigma3 = VolAvg + Num_Dev2 * sDev;
def RelVol = Vol / VolAvg[1];
def RelPrevVol = volume / volume[1];
AssignBackgroundColor(if Vol > VolSigma3 then Color.MAGENTA else if Vol > VolSigma2 then Color.DARK_ORANGE else if Vol > VolAvg then CreateColor(0, 100, 200) else if RelPrevVol >= RelativetoPrevVolTolerance then Color.YELLOW else Color.GRAY);

AddLabel(1, Round(RelVol, 2) + "x / " + Round(RelPrevVol, 2) +"x", Color.BLACK);

And here is a strength column
fvTij7O.png


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);
 
@Welkin I want to actually ask about the VSA addon again. I was wondering if it would be possible to make the VSA lines coming from the bars to have the shaded transparent background (Kind of like the Supply Demand zones on the AMM 2.0)
 
You know, I just had another good idea for this. The triangles indicating an increasing in volume is awesome, and it makes me wonder if you can create another similar addition that places a triangle (or any boolean) on a volume bar that meets the condition of a long top or bottom wick, and the volume is less than the previous two volumes (for testing supply and demand)

@Welkin Also, I was wondering if you could perhaps provide some sort of guide at interpreting the indicator and the VSA addon?
 
Last edited:
How to split After-hours and Pre-market volumes separately? The following gives both the volumes combined.. the logic is a bit cryptic.. Can someone help? Thanks!

def conf = SecondsFromTime(0930) >= 0 and SecondsFromTime(1600) <= 0;
def ExtVol = if !conf and conf[1] then volume else if !conf then CompoundValue(1, ExtVol[1] + volume, volume) else ExtVol[1];
 
Status
Not open for further replies.

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

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
477 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