ChristianS
Member
you could have found the script ?I am looking for a script that show volume on the buy and sell side as well as percentages. Can anyone point me in the right direction?
you could have found the script ?I am looking for a script that show volume on the buy and sell side as well as percentages. Can anyone point me in the right direction?
Join useThinkScript to post your question to a community of 21,000+ developers and traders.
declare lower;
input period = AggregationPeriod.DAY;
input lengthB = 9;
input lengthS = 9;
input averageType = AverageType.EXPONENTIAL;
# Buying Volume
def O1 = open(period = period);
def H1 = high(period = period);
def C1 = close(period = period);
def L1 = low(period = period);
def V1 = volume(period = period);
def BV = V1 * ((C1 - L1) / (H1 - L1));
def Buy = MovingAverage (averageType, BV,lengthB);
plot BuyVol = ExpAverage (Buy, LengthB);
# Selling Volume
def O = open(period = period);
def H = high(period = period);
def C = close(period = period);
def L = low(period = period);
def V = volume(period = period);
def SV = -V * ((H - C) / (H - L));
def Sell = MovingAverage (averageType, -SV, lengthS);
plot SellVol = ExpAverage (Sell, LengthS);
# Signal
input showBreakoutSignals = no;
plot UpSignal = BuyVol+1 crosses above SellVol;
plot DownSignal = BuyVol-1 crosses below SellVol;
UpSignal.SetHiding(!showBreakoutSignals);
DownSignal.SetHiding(!showBreakoutSignals);
UpSignal.SetDefaultColor(Color.UPTICK);
UpSignal.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
DownSignal.SetDefaultColor(Color.DOWNTICK);
DownSignal.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
@ugaotraderChris' Enhanced Volume I know light green is DevIncrease and light red is DevDecrease but what exactly does that mean as far as the indicator goes.
#Volume (By RIPSTER)
input Show30DayAvg = yes;
input ShowTodayVolume = yes;
input ShowPercentOf30DayAvg = yes;
input UnusualVolumePercent = 110;
input Show30BarAvg = yes;
input ShowCurrentBar = yes;
input ShowPercentOf30BarAvg = yes;
input ShowSellVolumePercent = yes;
def O = open;
def H = high;
def C = close;
def L = low;
def V = volume;
def buying = V*(C-L)/(H-L);
def selling = V*(H-C)/(H-L);
# Selling Volume
def SellVol = selling;
# Total Volume
def BuyVol = volume;
#Volume Data
def volLast30DayAvg = (volume(period = "DAY")[1] + volume(period = "DAY")[2] + volume(period = "DAY")[3] + volume(period = "DAY")[4] + volume(period = "DAY")[5] + volume(period = "DAY")[6] + volume(period = "DAY")[7] + volume(period = "DAY")[8] + volume(period = "DAY")[9] + volume(period = "DAY")[10] + volume(period = "DAY")[11] + volume(period = "DAY")[12] + volume(period = "DAY")[13] + volume(period = "DAY")[14] + volume(period = "DAY")[15] + volume(period = "DAY")[16] + volume(period = "DAY")[17] + volume(period = "DAY")[18] + volume(period = "DAY")[19] + volume(period = "DAY")[20] + volume(period = "DAY")[21] + volume(period = "DAY")[22] + volume(period = "DAY")[23] + volume(period = "DAY")[24] + volume(period = "DAY")[25] + volume(period = "DAY")[26] + volume(period = "DAY")[27] + volume(period = "DAY")[28] + volume(period = "DAY")[29] + volume(period = "DAY")[30]) / 30;
def today = volume(period = "DAY");
def percentOf30Day = Round((today / volLast30DayAvg) * 100, 0);
def avg30Bars = (volume[1] + volume[2] + volume[3] + volume[4] + volume[5] + volume[6] + volume[7] + volume[8] + volume[9] + volume[10] + volume[11] + volume[12] + volume[13] + volume[14] + volume[15] + volume[16] + volume[17] + volume[18] + volume[19] + volume[20] + volume[21] + volume[22] + volume[23] + volume[24] + volume[25] + volume[26] + volume[27] + volume[28] + volume[29] + volume[30]) / 30;
def curVolume = volume;
def percentOf30Bar = Round((curVolume / avg30Bars) * 100, 0);
def SellVolPercent = Round((Selling / Volume) * 100, 0);
# Labels
AddLabel(Show30DayAvg, "Avg 30 Days: " + Round(volLast30DayAvg, 0), Color.LIGHT_GRAY);
AddLabel(ShowTodayVolume, "Today: " + today, (if percentOf30Day >= UnusualVolumePercent then Color.GREEN else if percentOf30Day >= 100 then Color.ORANGE else Color.LIGHT_GRAY));
AddLabel(ShowPercentOf30DayAvg, percentOf30Day + "%", (if percentOf30Day >= UnusualVolumePercent then Color.GREEN else if percentOf30Day >= 100 then Color.ORANGE else Color.WHITE) );
AddLabel(Show30BarAvg, "Avg 30 Bars: " + Round(avg30Bars, 0), Color.LIGHT_GRAY);
AddLabel(ShowCurrentBar, "Cur Bar: " + curVolume, (if percentOf30Bar >= UnusualVolumePercent then Color.GREEN else if PercentOf30Bar >= 100 then Color.ORANGE else Color.LIGHT_GRAY));
AddLabel(ShowPercentOf30BarAvg, PercentOf30Bar + "%", (if PercentOf30Bar >= UnusualVolumePercent then Color.GREEN else if PercentOf30Bar >= 100 then Color.ORANGE else Color.WHITE) );
AddLabel(ShowSellVolumePercent, "Cur Bar Sell %: " + SellVolPercent, (if SellVolPercent > 51 then Color.pink else if SellVolPercent < 49 then Color.GREEN else Color.ORANGE));
I fixed it nevermind.. the premarket volume wasn't added in properly for the buy and sell vol. I posted it below in case anyone's interested. Please let me know if there's a problem with it, I'm not very experienced and I'd love to improve it.Does someone know if the code below is correct? I took a label code for RVol that was posted on here and I was playing with it to see if I could utilize it with avg b/s vol. I think it's wrong though, the result looks nothing like my other buy sell volume data and the numbers seem too high on the buy and sell volume. Any input would be wonderful
Ruby:def isRollover = GetYYYYMMDD() != GetYYYYMMDD()[1]; def beforeStart = GetTime() < RegularTradingStart(GetYYYYMMDD()); def vol = if isRollover and beforeStart then volume else if beforeStart then vol[1] + volume else Double.NaN; def PMV = if IsNaN(vol) then PMV[1] else vol; def AV = AggregationPeriod.DAY; def O = open(period = AV); def H = high(period = AV); def C = close(period = AV); def L = low(period = AV); def V = volume(period = AV); def Buying = V * (C - L) / (H - L); def Selling = V * (H - C) / (H - L); # Selling Volume def SV = Selling; # Buying Volume def BV = Buying; input vlength = 60; def x = Average(volume(period = AV)[1], vlength); def y1 = Round((PMV / x), 2); def Lg = Lg(y1); def p = if Lg >= 1 then 0 else if Lg >= 0 then 1 else 2; def y2 = Round(y1, p); def rVol = y2; input blength = 60; def x_b = Average(Buying[1], blength); def y1_b = Round((PMV / x_b), 2); def Lg_b = Lg(y1_b); def p_b = if Lg_b >= 1 then 0 else if Lg_b >= 0 then 1 else 2; def y2_b = Round(y1_b, p_b); def rVolBuying = y2_b; input slength = 60; def x_s = Average(Selling[1], slength); def y1_s = Round((PMV / x_s), 2); def Lg_s = Lg(y1_s); def p_s = if Lg_s >= 1 then 0 else if Lg_s >= 0 then 1 else 2; def y2_s = Round(y1_s, p_s); def RvolSelling = y2_s; rVol.SetPaintingStrategy(PaintingStrategy.LINE); AddLabel(yes, "R-Vol: " + rVol, if rVol > 3 then Color.Cyan else if rVol > 2 then Color.Blue else if rVol > 1.2 then Color.Orange else if (rVol <1.2 and rVol >.8) then color.Dark_orange else color.gray); AddLabel(yes, "R-Vol (Buying): " + rVolBuying, if rVolBuying > 3 then Color.Green else if rVolBuying > 2 then Color.Dark_Green else if rVolBuying > 1.2 then Color.light_green else if rVolBuying <1.2 and rVolBuying >.8 then color.orange else color.red); AddLabel(yes, "R-Vol (Selling): " + rVolSelling, if rVolSelling > 3 then Color.Red else if rVolSelling > 2 then Color.Dark_Red else if rVolSelling > 1.2 then Color.light_Red else if rVolSelling <1.2 and rVolSelling >.8 then color.orange else color.Green);
def isRollover = GetYYYYMMDD() != GetYYYYMMDD()[1];
def beforeStart = GetTime() < RegularTradingStart(GetYYYYMMDD());
def vol = if isRollover and beforeStart then volume else if beforeStart then vol[1] + volume else Double.NaN;
def PMV = if IsNaN(vol) then PMV[1] else vol;
def AV = AggregationPeriod.DAY;
def O = open(period = AV);
def H = high(period = AV);
def C = close(period = AV);
def L = low(period = AV);
def V = volume(period = AV);
def Buying = V * (C - L) / (H - L);
def Selling = V * (H - C) / (H - L);
def pmB = PMV * (C - L) / (H - L);
def pmS = PMV * (H - C) / (H - L);
# Selling Volume
def SV = Selling;
# Buying Volume
defBV = Buying;
input vlength = 22;
def x = Average(volume(period = AV)[1], vlength);
def y1 = Round((PMV / x), 2);
def Lg = Lg(y1);
def p = if Lg >= 1 then 0 else if Lg >= 0 then 1 else 2;
def y2 = Round(y1, p);
def rVol = y2;
input blength = 22;
def x_b = Average(Buying[1], blength);
def y1_b = Round((pmB / x_b), 2);
def Lg_b = Lg(y1_b);
def p_b = if Lg_b >= 1 then 0 else if Lg_b >= 0 then 1 else 2;
def y2_b = Round(y1_b, p_b);
def rVolBuying = y2_b;
input slength = 22;
def x_s = Average(Selling[1], slength);
def y1_s = Round((pmS / x_s), 2);
def Lg_s = Lg(y1_s);
def p_s = if Lg_s >= 1 then 0 else if Lg_s >= 0 then 1 else 2;
def y2_s = Round(y1_s, p_s);
def RvolSelling = y2_s;
AddLabel(yes, "R-Vol: " + rVol, if rVol > 3 then Color.Cyan else if rVol > 2 then Color.Blue else if rVol > 1.2 then Color.Orange else if (rVol <1.2 and rVol >.8) then color.Dark_orange else color.gray);
AddLabel(yes, "R-Vol (Buying): " + rVolBuying, if rVolBuying > 3 then Color.Green else if rVolBuying > 2 then Color.Dark_Green else if rVolBuying > 1.2 then Color.light_green else if rVolBuying <1.2 and rVolBuying >.8 then color.orange else color.red);
AddLabel(yes, "R-Vol (Selling): " + rVolSelling, if rVolSelling > 3 then Color.Red else if rVolSelling > 2 then Color.Dark_Red else if rVolSelling > 1.2 then Color.light_Red else if rVolSelling <1.2 and rVolSelling >.8 then color.orange else color.Green);
input length = 5;
def o = open;
def h = high;
def l = low;
def c = close;
def v = volume;
def bvolsum = Sum(((c - l) / (h - l)) * v, length);
def svolsum = Sum(((h - c) / (h - l)) * v, length);
See 1st post in this thread. Comment out what you don't need.So i have this code for buy & sell volume and need to create a label for the upper chart that displays which vol type is currently showing and label should be painted green for bvol and red for svol. Appreciate if anyone can help me with this.
Code:input length = 5; def o = open; def h = high; def l = low; def c = close; def v = volume; def bvolsum = Sum(((c - l) / (h - l)) * v, length); def svolsum = Sum(((h - c) / (h - l)) * v, length);
Thanks for posting, any way to change the audio alert? I looked over the code and did not see it listed so I am guessing it's TOS default?Chris's Enhanced Volume For ThinkOrSwim
Buy / Sell Volume Pressure w/ volumes and percentages
View attachment 913
Ruby:#Chris' Enhanced Volume V.2 /w Uptick/Downtick declare on_volume; ############### #DPL CRITERIA # ############### input Audible_Alert = yes; def Deviation_Length = 60; def Deviate = 2; def volumestdev = RelativeVolumeStDev(length = Deviation_Length); def abovedev = volumestdev >= Deviate; def belowdev = volumestdev <= Deviate; ############ # DPL BARS # ############ def increase = volume > volume[1]; def devincrease = increase and abovedev; def decrease = volume < volume[1]; def devdecrease = decrease and abovedev; ############################## # UPTICK / DOWNTICK CRITERIA # ############################## def O = open; def H = high; def C = close; def L = low; def V = volume; def Buying = V * (C - L) / (H - L); def Selling = V * (H - C) / (H - L); ################## # Selling Volume # ################## plot SV = Selling; SV.DefineColor("Decrease", Color.rED); SV.DefineColor("DevDecrease", Color.pink); SV.AssignValueColor(if devdecrease then SV.Color("DevDecrease") else SV.Color("Decrease")); SV.SetPaintingStrategy(PaintingStrategy.HISTOGRAM); SV.HideTitle(); SV.HideBubble(); SV.SetLineWeight(5); ################# # Buying Volume # ################# DefineGlobalColor("LabelGreen", CreateColor(0, 165, 0)) ; plot BV = Buying; BV.DefineColor("Increase", GlobalColor("LabelGreen")); BV.DefineColor("DevIncrease", Color.light_GREEN); BV.AssignValueColor(if devincrease then BV.Color("DevIncrease") else BV.Color("Increase")); BV.SetPaintingStrategy(PaintingStrategy.HISTOGRAM); BV.HideTitle(); BV.HideBubble(); BV.SetLineWeight(5); ################# # Adding Volume Labels # ################# input Show_Labels = yes; AddLabel(Show_Labels, "Buy Vol = " + Round(Buying, 0), if Buying > Selling then GlobalColor("LabelGreen") else color.red); AddLabel(Show_Labels, "Buy %: " + Round((Buying/(Buying+Selling))*100,2), If (Buying/(Buying+Selling))*100 > 60 then GlobalColor("LabelGreen") else color.red); AddLabel(Show_Labels, "Sell Vol = " + Round(Selling, 0), if Selling > Buying then GlobalColor("LabelGreen") else color.red); AddLabel(Show_Labels, "Sell %: " + Round((Selling/(Selling+Buying))*100,2), If (Selling/(Selling+Buying))*100 > 60 then GlobalColor("LabelGreen") else color.RED);
Buy / Sell Volume Pressure w/ volumes and percentages -- Upper Study Labels Only
Ruby:#Chris' Enhanced Volume V.2 /w Uptick/Downtick LABELS ONLY declare upper; ############### #DPL CRITERIA # ############### def Deviation_Length = 60; def Deviate = 2; def volumestdev = RelativeVolumeStDev(length = Deviation_Length); def abovedev = volumestdev >= Deviate; def belowdev = volumestdev <= Deviate; ############ # DPL BARS # ############ def increase = volume > volume[1]; def devincrease = increase and abovedev; def decrease = volume < volume[1]; def devdecrease = decrease and abovedev; ############################## # UPTICK / DOWNTICK CRITERIA # ############################## def O = open; def H = high; def C = close; def L = low; def V = volume; def Buying = V * (C - L) / (H - L); def Selling = V * (H - C) / (H - L); ################## # Selling Volume # ################## def SV = Selling; def BV = Buying; ################# # Adding Volume Labels # ################# DefineGlobalColor("LabelGreen", CreateColor(0, 165, 0)) ; input Show_Labels = yes; AddLabel(Show_Labels, "Buy Vol = " + Round(Buying, 0), if Buying > Selling then GlobalColor("LabelGreen") else color.red); AddLabel(Show_Labels, "Buy %: " + Round((Buying/(Buying+Selling))*100,2), If (Buying/(Buying+Selling))*100 > 60 then GlobalColor("LabelGreen") else color.red); AddLabel(Show_Labels, "Sell Vol = " + Round(Selling, 0), if Selling > Buying then GlobalColor("LabelGreen") else color.red); AddLabel(Show_Labels, "Sell %: " + Round((Selling/(Selling+Buying))*100,2), If (Selling/(Selling+Buying))*100 > 60 then GlobalColor("LabelGreen") else color.RED);
There is no alerts in the scripts that you referenced so there is nothing to 'change'.Thanks for posting, any way to change the audio alert? I looked over the code and did not see it listed so I am guessing it's TOS default?
Is there any way to take out those icons for Earnings and Dividend info between the Symbol and the rest of watchlist? I'd like to put that space to better use.Here's a Watchlist Column Mod I just made.
Code:# Original author: Unknown # Watchlist Label # Mod by Ramon DV aka Pelonsax declare lower; def O = open; def H = high; def C = close; def L = low; def Price = H + L + C / 3; def V = volume; def buying = V * (C - L) / (H - L); def selling = V * (H - C) / (H - L); def SellVolPercent = Round((Selling / Volume) * 100, 0); def BuyVolPercent = 100 - SellVolPercent; assignBackgroundColor(if buying >= selling then color.GREEN else if buying <= selling then color.RED else color.white); AddLabel(buying <= selling, "Sell %: "+SellVolPercent, color.black); AddLabel(buying >= selling, "Buy %: "+BuyVolPercent, color.black);
Start a new thread and receive assistance from our community.
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.
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.