Buy / Sell Volume RoC For ThinkOrSwim

airgb

New member
Hmmm... What exactly is the profile view.

I honestly didn't pay much attention to it yesterday but I'll look into it

Selling/buying section of code
Code:
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);
Good morning, the profile view is like a profile photo which the reference here is the visual portrait (or print) of the volume bars on the indicator as they move with price action and time.

Yeah I seen that in the code but where does the code data comes from. If it's cold price action then it would have to take a higher high (or lower low) price to give a direction bar (IE red bar for down and green bar for up), right? I guess my confusion is from having used my other volume indicator that horserider posted here a while back (https://usethinkscript.com/threads/volume-buy-sell-indicator-with-hot-percent-for-thinkorswim.389/). I am pretty sure when I started using that indicator I read somewhere that the data for the bars was being generated from Time and Sales data, but I cannot find that comment anywhere now. Either way it's no big deal, I was just wondering how it works. So again I appreciate what you have done with this indicator, it is very good thing and I am using it every day for trading.
 
Last edited by a moderator:
Good morning, the profile view is like a profile photo which the reference here is the visual portrait (or print) of the volume bars on the indicator as they move with price action and time.

Yeah I seen that in the code but where does the code data comes from. If it's cold price action then it would have to take a higher high (or lower low) price to give a direction bar (IE red bar for down and green bar for up), right? I guess my confusion is from having used my other volume indicator that horserider posted here a while back (https://usethinkscript.com/threads/volume-buy-sell-indicator-with-hot-percent-for-thinkorswim.389/). I am pretty sure when I started using that indicator I read somewhere that the data for the bars was being generated from Time and Sales data, but I cannot find that comment anywhere now. Either way it's no big deal, I was just wondering how it works. So again I appreciate what you have done with this indicator, it is very good thing and I am using it every day for trading.

Gotcha, I'll re-read your post when I have more time. Glad you find it useful
 

henry1224

Active member
VIP
Here is the code for all of the time frames
Code:
#Red_Green_Multi_Bar Buy_Sell Stats_v2 *LOWER MTF*
#Parts derived from Horseriders "Volume Buy Sell Indicator with Hot Percent for ThinkorSwim"
#declare zerobase;
#===08-06-2021 Updated to make it easier to switch inputs.====== Added "Hot Volume" to Multibar
#========08-07-2021===Removed Rate of change part of study. can still be accessed from link in post #1 if you wish to use it.         https://usethinkscript.com/threads/buy-sell-volume-roc.7386/
#ammended the Agg Periods to be able to use all of the possible time frames  by Henry Z Kaczmarczyk

input Time1 = {“1 min”,”2 min”,”3 min”,”4 min”,"5 min", "10 min", "15 min",”20 min”,”30 min”, "Hour", “2 Hour”,"4 Hour", "Daily", “2 Day”,”3 Day”,”4 Day”,default "Weekly", "Monthly"};
input Time2 = {“1 min”,”2 min”,”3 min”,”4 min”,"5 min", "10 min", "15 min",”20 min”,”30 min”, "Hour", “2 Hour”,"4 Hour", "Daily", “2 Day”,”3 Day”,”4 Day”,default "Weekly", "Monthly"};
input Time3 = {“1 min”,”2 min”,”3 min”,”4 min”,"5 min", "10 min", "15 min",”20 min”,”30 min”, "Hour", “2 Hour”,"4 Hour", "Daily", “2 Day”,”3 Day”,”4 Day”,default "Weekly", "Monthly"};
#============TIME=========================

def Agg1;

switch (Time1) {
case "1 min":
    Agg1 = AggregationPeriod.MIN;
case "2 min":
    Agg1 = AggregationPeriod.Two_MIN;
case "3 min":
    Agg1 = AggregationPeriod.Three_MIN;
case "4 min":
    Agg1 = AggregationPeriod.Four_MIN;
case "5 min":
    Agg1 = AggregationPeriod.FIVE_MIN;
case "10 min":
    Agg1 = AggregationPeriod.TEN_MIN;
case "15 min":
    Agg1 = AggregationPeriod.FIFTEEN_MIN;
case "20 min":
    Agg1 = AggregationPeriod.Twenty_MIN;
case "30 min":
    Agg1 = AggregationPeriod.Thirty_MIN;
case "Hour":
    Agg1 = AggregationPeriod.HOUR;
case "2 Hour":
    Agg1 = AggregationPeriod.Two_HOURS;
case "4 Hour":
    Agg1 = AggregationPeriod.FOUR_HOURS;
case "Daily":
    Agg1 = AggregationPeriod.DAY;
case "2 Day":
    Agg1 = AggregationPeriod.Two_DAYS;
case "3 Day":
    Agg1 = AggregationPeriod.Three_DAYS;
case "4 Day":
    Agg1 = AggregationPeriod.Four_DAYs;
case "Weekly":
    Agg1 = AggregationPeriod.WEEK;
case "Monthly":
    Agg1 = AggregationPeriod.MONTH;
}

def Agg2;

switch (Time2) {
case "1 min":
    Agg2 = AggregationPeriod.MIN;
case "2 min":
    Agg2 = AggregationPeriod.Two_MIN;
case "3 min":
    Agg2 = AggregationPeriod.Three_MIN;
case "4 min":
    Agg2 = AggregationPeriod.Four_MIN;
case "5 min":
    Agg2 = AggregationPeriod.FIVE_MIN;
case "10 min":
    Agg2 = AggregationPeriod.TEN_MIN;
case "15 min":
    Agg2 = AggregationPeriod.FIFTEEN_MIN;
case "20 min":
    Agg2 = AggregationPeriod.Twenty_MIN;
case "30 min":
    Agg2 = AggregationPeriod.Thirty_MIN;
case "Hour":
    Agg2 = AggregationPeriod.HOUR;
case "2 Hour":
    Agg2 = AggregationPeriod.Two_HOURS;
case "4 Hour":
    Agg2 = AggregationPeriod.FOUR_HOURS;
case "Daily":
    Agg2 = AggregationPeriod.DAY;
case "2 Day":
    Agg2 = AggregationPeriod.Two_DAYS;
case "3 Day":
    Agg2 = AggregationPeriod.Three_DAYS;
case "4 Day":
    Agg2 = AggregationPeriod.Four_DAYs;
case "Weekly":
    Agg2 = AggregationPeriod.WEEK;
case "Monthly":
    Agg2 = AggregationPeriod.MONTH;
}

def Agg3;

switch (Time3) {
case "1 min":
    Agg3 = AggregationPeriod.MIN;
case "2 min":
    Agg3 = AggregationPeriod.Two_MIN;
case "3 min":
    Agg3 = AggregationPeriod.Three_MIN;
case "4 min":
    Agg3 = AggregationPeriod.Four_MIN;
case "5 min":
    Agg3 = AggregationPeriod.FIVE_MIN;
case "10 min":
    Agg3 = AggregationPeriod.TEN_MIN;
case "15 min":
    Agg3= AggregationPeriod.FIFTEEN_MIN;
case "20 min":
    Agg3 = AggregationPeriod.Twenty_MIN;
case "30 min":
    Agg3 = AggregationPeriod.Thirty_MIN;
case "Hour":
    Agg3 = AggregationPeriod.HOUR;
case "2 Hour":
    Agg3 = AggregationPeriod.Two_HOURS;
case "4 Hour":
    Agg3 = AggregationPeriod.FOUR_HOURS;
case "Daily":
    Agg3 = AggregationPeriod.DAY;
case "2 Day":
    Agg3 = AggregationPeriod.Two_DAYS;
case "3 Day":
    Agg3 = AggregationPeriod.Three_DAYS;
case "4 Day":
    Agg3 = AggregationPeriod.Four_DAYs;
case "Weekly":
    Agg3 = AggregationPeriod.WEEK;
case "Monthly":
    Agg3 = AggregationPeriod.MONTH;
}
#==============END TIME==================


declare lower;

#Inputs



input ShowFiveBar = yes;
input ShowTenBar = yes;

#=======Agg1===========
def O1 = open(period = agg1);
def H1 = high(period = agg1);
def C1 = close(period = agg1);
def L1 = low(period = agg1);
def V1 = volume(period = agg1);
def buying1 = V1 * (C1 - L1) / (H1 - L1);
def selling1 = V1 * (H1 - C1) / (H1 - L1);

def buy1agg1 = buying1 + buying1[1];
def buy2agg1  = buying1 + buying1[1] + buying1[2];
def buy3agg1  = buying1 + buying1[1] + buying1[2] + buying1[3];
def buy4agg1  = buying1 + buying1[1] + buying1[2] + buying1[3] + buying1[4];
def buy5agg1  = buying1 + buying1[1] + buying1[2] + buying1[3] + buying1[4] + buying1[5];
def buy6agg1  = buying1 + buying1[1] + buying1[2] + buying1[3] + buying1[4] + buying1[5] + buying1[6];
def buy7agg1  = buying1 + buying1[1] + buying1[2] + buying1[3] + buying1[4] + buying1[5] + buying1[6] + buying1[7];
def buy8agg1  = buying1 + buying1[1] + buying1[2] + buying1[3] + buying1[4] + buying1[5] + buying1[6] + buying1[7] + buying1[8];
def buy9agg1  = buying1 + buying1[1] + buying1[2] + buying1[3] + buying1[4] + buying1[5] + buying1[6] + buying1[7] + buying1[8] + buying1[9];
def buy10agg1  = buying1 + buying1[1] + buying1[2] + buying1[3] + buying1[4] + buying1[5] + buying1[6] + buying1[7] + buying1[8] + buying1[9] + buying1[10];

def curbuyVolume5agg1  = (buy1agg1 + buy2agg1 + buy3agg1 + buy4agg1 + buy5agg1) / 5;
def curbuyvol10agg1  = (buy1agg1 + buy2agg1 + buy3agg1 + buy4agg1 + buy5agg1 + buy6agg1 + buy7agg1 + buy8agg1 + buy9agg1 + buy10agg1) / 10;


def sell1agg1  = Selling1 + Selling1[1];
def sell2agg1  = Selling1 + Selling1[1] + Selling1[2];
def sell3agg1  = Selling1 + Selling1[1] + Selling1[2] + Selling1[3];
def sell4agg1  = Selling1 + Selling1[1] + Selling1[2] + Selling1[3] + Selling1[4];
def sell5agg1  = Selling1 + Selling1[1] + Selling1[2] + Selling1[3] + Selling1[4] + Selling1[5];
def sell6agg1  = Selling1 + Selling1[1] + Selling1[2] + Selling1[3] + Selling1[4] + Selling1[5] + selling1[6];
def sell7agg1  = Selling1 + Selling1[1] + Selling1[2] + Selling1[3] + Selling1[4] + Selling1[5] + selling1[6] +selling1[7];
def sell8agg1  = Selling1 + Selling1[1] + Selling1[2] + Selling1[3] + Selling1[4] + Selling1[5]+ selling1[6] +selling1[7] + selling1[8];
def sell9agg1  = Selling1 + Selling1[1] + Selling1[2] + Selling1[3] + Selling1[4] + Selling1[5]+ selling1[6] + selling1[7] + selling1[8] + Selling1[9];
def sell10agg1  = Selling1 + Selling1[1] + Selling1[2] + Selling1[3] + Selling1[4] + Selling1[5] + Selling1[6] + selling1[7] + selling1[8] + selling1[9] + selling1[10];

def cursellVolume5agg1  = (sell1agg1 + sell2agg1 + sell3agg1 + sell4agg1 + sell5agg1) / 5;
def cursellvol10agg1  = (sell1agg1 + sell2agg1 + sell3agg1 + sell4agg1 + sell5agg1 + sell6agg1 + sell7agg1 + sell8agg1 + sell9agg1 + sell10agg1) / 10;

def Sellbuydiff5agg1  = (curbuyVolume5agg1 - cursellVolume5agg1);
def Sellbuydiff10agg1  = (curbuyvol10agg1 - cursellvol10agg1);

#============AGG1 plots===============

plot V5agg1 = if  !ShowFiveBar  then Double.NaN else .08;
V5agg1.SetPaintingStrategy(PaintingStrategy.LINE);
#V2.SetDefaultColor(Color.DARK_GREEN);
V5agg1.HideTitle();
V5agg1.HideBubble();
V5agg1.SetLineWeight(3);
V5agg1.assignValueColor(if curbuyVolume5agg1 > cursellVolume5agg1 then createColor(9,206,138) else if curbuyVolume5agg1 < cursellVolume5agg1  then createColor(206,9,26) else color.DARK_GRAY );

plot V10agg1 = if !showTenBar then Double.NaN else .08;
V10agg1.SetPaintingStrategy(PaintingStrategy.POINTS);
#V2.SetDefaultColor(Color.DARK_GREEN);
V10agg1.HideTitle();
V10agg1.HideBubble();
V10agg1.SetLineWeight(5);
V10agg1.assignValueColor(if curbuyVol10agg1 > cursellVol10agg1 then createColor(38,129,88) else if curbuyVol10agg1 < cursellVol10agg1  then createColor(138,5,16) else color.DARK_GRAY );



#======AGG2======================================================

def O2 = open(period = agg2);
def H2 = high(period = agg2);
def C2 = close(period = agg2);
def L2 = low(period = agg2);
def V2 = volume(period = agg2);
def buying2 = V2 * (C2 - L2) / (H2 - L2);
def selling2 = V2 * (H2 - C2) / (H2 - L2);

# Total Volume


def curVolume2 = volume(period = agg2);

def SellVolPercent2 = Round((selling2 / volume(period = agg2)) * 100, 0);

#Buy/sell difference================================
def buy1agg2 = buying2 + buying2[1];
def buy2agg2 = buying2 + buying2[1] + buying2[2];
def buy3agg2 = buying2 + buying2[1] + buying2[2] + buying2[3];
def buy4agg2 = buying2 + buying2[1] + buying2[2] + buying2[3] + buying2[4];
def buy5agg2 = buying2 + buying2[1] + buying2[2] + buying2[3] + buying2[4] + buying2[5];
def buy6agg2 = buying2 + buying2[1] + buying2[2] + buying2[3] + buying2[4] + buying2[5] + buying2[6];
def buy7agg2 = buying2 + buying2[1] + buying2[2] + buying2[3] + buying2[4] + buying2[5] + buying2[6] + buying2[7];
def buy8agg2 = buying2 + buying2[1] + buying2[2] + buying2[3] + buying2[4] + buying2[5] + buying2[6] + buying2[7] + buying2[8];
def buy9agg2 = buying2 + buying2[1] + buying2[2] + buying2[3] + buying2[4] + buying2[5] + buying2[6] + buying2[7] + buying2[8] + buying2[9];
def buy10agg2 = buying2 + buying2[1] + buying2[2] + buying2[3] + buying2[4] + buying2[5] + buying2[6] + buying2[7] + buying2[8] + buying2[9] + buying2[10];

def curbuyVolume5agg2 = (buy1agg2 + buy2agg2 + buy3agg2 + buy4agg2 + buy5agg2) / 5;
def curbuyvol10agg2 = (buy1agg2 + buy2agg2 + buy3agg2 + buy4agg2 + buy5agg2 + buy6agg2 + buy7agg2 + buy8agg2 + buy9agg2 + buy10agg2) / 10;


def sell1agg2 = Selling2 + Selling2[1];
def sell2agg2 = Selling2 + Selling2[1] + Selling2[2];
def sell3agg2 = Selling2 + Selling2[1] + Selling2[2] + Selling2[3];
def sell4agg2 = Selling2 + Selling2[1] + Selling2[2] + Selling2[3] + Selling2[4];
def sell5agg2 = Selling2 + Selling2[1] + Selling2[2] + Selling2[3] + Selling2[4] + Selling2[5];
def sell6agg2 = Selling2 + Selling2[1] + Selling2[2] + Selling2[3] + Selling2[4] + Selling2[5] + selling2[6];
def sell7agg2 = Selling2 + Selling2[1] + Selling2[2] + Selling2[3] + Selling2[4] + Selling2[5] + selling2[6] +selling2[7];
def sell8agg2 = Selling2 + Selling2[1] + Selling2[2] + Selling2[3] + Selling2[4] + Selling2[5]+ selling2[6] +selling2[7] + selling2[8];
def sell9agg2 = Selling2 + Selling2[1] + Selling2[2] + Selling2[3] + Selling2[4] + Selling2[5]+ selling2[6] +selling2[7] + selling2[8] + selling2[9];
def sell10agg2 = Selling2 + Selling2[1] + Selling2[2] + Selling2[3] + Selling2[4] + Selling2[5]+ selling2[6] +selling2[7] + selling2[8] + selling2[9] + selling2[10];

def cursellVolume5agg2 = (sell1agg2 + sell2agg2 + sell3agg2 + sell4agg2 + sell5agg2) / 5;
def cursellvol10agg2 = (sell1agg2 + sell2agg2 + sell3agg2 + sell4agg2 + sell5agg2 + sell6agg2 + sell7agg2 + sell8agg2 + sell9agg2 + sell10agg2) / 10;

def Sellbuydiff5agg2 = (curbuyVolume5agg2 - cursellVolume5agg2);
def Sellbuydiff10agg2 = (curbuyvol10agg2 - cursellvol10agg2);

#======AGG2 Plots========

plot V5agg2 = if !ShowFiveBar then Double.NaN else .06;
V5agg2.SetPaintingStrategy(PaintingStrategy.LINE);
#V2.SetDefaultColor(Color.DARK_GREEN);
V5agg2.HideTitle();
V5agg2.HideBubble();
V5agg2.SetLineWeight(3);
V5agg2.assignValueColor(if curbuyVolume5agg2 > cursellVolume5agg2 then createColor(9,206,138) else if curbuyVolume5agg2 < cursellVolume5agg2  then createColor(206,9,26) else color.DARK_GRAY );

plot V10agg2 = if !showTenBar then Double.NaN else .06;
V10agg2.SetPaintingStrategy(PaintingStrategy.POINTS);
#V2.SetDefaultColor(Color.DARK_GREEN);
V10agg2.HideTitle();
V10agg2.HideBubble();
V10agg2.SetLineWeight(5);
V10agg2.assignValueColor(if curbuyVol10agg2 > cursellVol10agg2 then createColor(38,129,88) else if curbuyVol10agg2 < cursellVol10agg2  then createColor(138,5,16) else color.DARK_GRAY );



#=========AGG3================================================================

def O = open(period = agg3);
def H = high(period = agg3);
def C = close(period = agg3);
def L = low(period = agg3);
def V = volume(period = agg3);
def buying = V * (C - L) / (H - L);
def selling = V * (H - C) / (H - L);

def buy1 = buying + buying[1];
def buy2 = buying + buying[1] + buying[2];
def buy3 = buying + buying[1] + buying[2] + buying[3];
def buy4 = buying + buying[1] + buying[2] + buying[3] + buying[4];
def buy5 = buying + buying[1] + buying[2] + buying[3] + buying[4] + buying[5];
def buy6 = buying + buying[1] + buying[2] + buying[3] + buying[4] + buying[5] + buying[6];
def buy7 = buying + buying[1] + buying[2] + buying[3] + buying[4] + buying[5] + buying[6] + buying[7];
def buy8 = buying + buying[1] + buying[2] + buying[3] + buying[4] + buying[5] + buying[6] + buying[7] + buying[8];
def buy9 = buying + buying[1] + buying[2] + buying[3] + buying[4] + buying[5] + buying[6] + buying[7] + buying[8] + buying[9];
def buy10 = buying + buying[1] + buying[2] + buying[3] + buying[4] + buying[5] + buying[6] + buying[7] + buying[8] + buying[9] + buying[10];

def curbuyVolume5 = (buy1 + buy2 + buy3 + buy4 + buy5) / 5;
def curbuyvol10 = (buy1 + buy2 + buy3 + buy4 + buy5 + buy6 + buy7 + buy8 + buy9 + buy10) / 10;


def sell1 = Selling + Selling[1];
def sell2 = Selling + Selling[1] + Selling[2];
def sell3 = Selling + Selling[1] + Selling[2] + Selling[3];
def sell4 = Selling + Selling[1] + Selling[2] + Selling[3] + Selling[4];
def sell5 = Selling + Selling[1] + Selling[2] + Selling[3] + Selling[4] + Selling[5];
def sell6 = Selling + Selling[1] + Selling[2] + Selling[3] + Selling[4] + Selling[5] + selling[6];
def sell7 = Selling + Selling[1] + Selling[2] + Selling[3] + Selling[4] + Selling[5] + selling[6] +selling[7];
def sell8 = Selling + Selling[1] + Selling[2] + Selling[3] + Selling[4] + Selling[5]+ selling[6] +selling[7] + selling[8];
def sell9 = Selling + Selling[1] + Selling[2] + Selling[3] + Selling[4] + Selling[5]+ selling[6] +selling[7] + selling[8] + selling[9];
def sell10 = Selling + Selling[1] + Selling[2] + Selling[3] + Selling[4] + Selling[5]+ selling[6] +selling[7] + selling[8] + selling[9] + selling[10];

def cursellVolume5 = (sell1 + sell2 + sell3 + sell4 + sell5) / 5;
def cursellvol10 = (sell1 + sell2 + sell3 + sell4 + sell5 + sell6 + sell7 + sell8 + sell9 + sell10) / 10;

def Sellbuydiff5 = (curbuyVolume5 - cursellVolume5);
def Sellbuydiff10 = (curbuyvol10 - cursellvol10);

#====AGG3 Plots============

plot V5agg3 = if !ShowFiveBar then Double.NaN else .04;
V5agg3.SetPaintingStrategy(PaintingStrategy.LINE);
#V2.SetDefaultColor(Color.DARK_GREEN);
V5agg3.HideTitle();
V5agg3.HideBubble();
V5agg3.SetLineWeight(3);
V5agg3.assignValueColor(if curbuyVolume5 > cursellVolume5 then createColor(9,206,138) else if curbuyVolume5 < cursellVolume5  then createColor(206,9,26) else color.DARK_GRAY );

plot V10agg3 = if !showTenBar then Double.NaN else .04;
V10agg3.SetPaintingStrategy(PaintingStrategy.POINTS);
#V2.SetDefaultColor(Color.DARK_GREEN);
V10agg3.HideTitle();
V10agg3.HideBubble();
V10agg3.SetLineWeight(5);
V10agg3.assignValueColor(if curbuyVol10 > cursellVol10 then createColor(38,129,88) else if curbuyVol10 < cursellVol10  then createColor(138,5,16) else color.DARK_GRAY );

def PlaceH = .1;
plot PH1 = PlaceH;
ph1.setpaintingStrategy(paintingStrategy.LINE);
ph1.setlineWeight(5);
ph1.setdefaultColor(color.DARK_GRAY);


def PlaceH2 = .02;
plot PH2 = PlaceH2;
ph2.setpaintingStrategy(paintingStrategy.LINE);
ph2.setlineWeight(5);
ph2.setdefaultColor(color.DARK_GRAY);

addcloud(placeH2, 0, color.BLACK);
addcloud(.12, placeH, color.BLACK);
 
Just wondering, is it meant to be used on the daily as well?

Reason I am asking on the VolumeAvg the daily is green, but with this indicator its red?

See screenshot:
Yes, it can be used on all timeframes.

Keep in mind it is red but you'll also notice the bars are decreasing in size. Which for the time being would tell me sell volume is actually decreasing.

That's one way you might view it

Another thing to consider is if the sell volume is red, it could be a pullback into a bullish trend.

Likewise if the indicator is green, it could be a pullback into a bearish trend.

Like I said if you use it alongside other information I think it will serve you well

Good luck

btw, what ticker is that?
 
Last edited:

airgb

New member
Gotcha, I'll re-read your post when I have more time. Glad you find it useful
Hello again R&G, just thought I would update you on how successful I have been using your indicator. I use it on both tick and minute time frames and for scalping it has become my primary indicator. I never could get the Prior bar label you coded for me to work, but I have learned I really don't need it anyways. However, I would like to ask you if it would be possible to code a horizonal line that follows the most current volume bar (much like a horizonal price line I have on my chart that follows price (either bid or ask) real time)? The price line indicator I use also has a price bubble that follows the horizonal line while they follow price. That bubble also changes color to reflect whether price is rising or falling at that moment. So that got me wondering if that would be possible with volume bars on your indicator?
 
Hello again R&G, just thought I would update you on how successful I have been using your indicator. I use it on both tick and minute time frames and for scalping it has become my primary indicator. I never could get the Prior bar label you coded for me to work, but I have learned I really don't need it anyways. However, I would like to ask you if it would be possible to code a horizonal line that follows the most current volume bar (much like a horizonal price line I have on my chart that follows price (either bid or ask) real time)? The price line indicator I use also has a price bubble that follows the horizonal line while they follow price. That bubble also changes color to reflect whether price is rising or falling at that moment. So that got me wondering if that would be possible with volume bars on your indicator?

That's great it's working good for you :)

Sorry haven't gotten back sooner, I think this is what you wanted, though you mentioned it's no longer necessary. Nevertheless, here it is

Code:
AddLabel(ShowSellVolumePercentLabel, " Past Sell %: " + SellVolPercent[1],
(if SellVolPercent[1] > 70
then CreateColor(117, 42, 44) else if SellVolPercent[1] < 30
then Color.DARK_GREEN else Color.DARK_GRAY));

I was able to add a horizontal line to the current volume bar, that moved up and down with the movement but I didn't like it and I doubt it was what you would've wanted plus it didn't add anything that you can't already see.
As far as changing colors, at this time, I know just enough about coding to be dangerous...One of these days, I need to sit down and just read the entire Thinkscript guide.

Maybe someone else might be able to assist?

Anyhow, good luck with it
 

airgb

New member
That's great it's working good for you :)

Sorry haven't gotten back sooner, I think this is what you wanted, though you mentioned it's no longer necessary. Nevertheless, here it is

Code:
AddLabel(ShowSellVolumePercentLabel, " Past Sell %: " + SellVolPercent[1],
(if SellVolPercent[1] > 70
then CreateColor(117, 42, 44) else if SellVolPercent[1] < 30
then Color.DARK_GREEN else Color.DARK_GRAY));

I was able to add a horizontal line to the current volume bar, that moved up and down with the movement but I didn't like it and I doubt it was what you would've wanted plus it didn't add anything that you can't already see.
As far as changing colors, at this time, I know just enough about coding to be dangerous...One of these days, I need to sit down and just read the entire Thinkscript guide.

Maybe someone else might be able to assist?

Anyhow, good luck with it
That's okay, no big deal but I will try your updated version. As for the line I would be glad to give it a test run if you want to post the code? I was thinking after I posted last night that even putting a bubble that shows the count of the current volume bar would work. No color change would be needed, just put a negative mark next to the number when the volume has turned down. What I am really asking is for something that tells the volume of the current volume bar (either a line or just a number). That I believe would enhance this indicator greatly. Still like I said you really have a winner here already so keep up the good work.
 
That's okay, no big deal but I will try your updated version. As for the line I would be glad to give it a test run if you want to post the code? I was thinking after I posted last night that even putting a bubble that shows the count of the current volume bar would work. No color change would be needed, just put a negative mark next to the number when the volume has turned down. What I am really asking is for something that tells the volume of the current volume bar (either a line or just a number). That I believe would enhance this indicator greatly. Still like I said you really have a winner here already so keep up the good work.

Might be a good idea. I've been thinking of ways to improve upon it.

I'll look into it later this afternoon.

I'll see if I can get that code for you then.
Thanks
 

airgb

New member
Might be a good idea. I've been thinking of ways to improve upon it.

I'll look into it later this afternoon.

I'll see if I can get that code for you then.
Thanks
Thanks guy, BTW the Past Sell % label is working great. I use it with the Cur bar sell % to narrow down the timing on entries.
 
Hey @RedToGreen - Wonderful indicator! Possible to add Today vol, 30 day vol, and last bar vol labels?
Thanks

Today and last are active.

I haven't updated the full code but the portion for last day is up a few messages..

I'll have to check on the others, they may be in the code, which I had turned some of the labels off
 

mcdon030

Member
Seems Like a good entry might be an increase that follows balance. Maybe add an additional volume requirement, but looks better on a chart this way.

# mcdon
# addition 20211010
Input VPchLimit =.60;
def buprec =buying /(buying+ selling );
def beprec = selling /(buying+ selling );
def isPrimeV =if beprec >buprec then beprec else buprec;
def isPrimv2 =100*(isPrimeV-isPrimeV[1])/isPrimeV ;
def Balance= if(between(isPrimeV,.40,.60),1,0);
def entry;
if Balance[1] && IsPrimeV==beprec && isPrimeV>isPrimeV[1] && VPchLimit>=VPchLimit {
entry = -100; # bear
} else if Balance[1] && IsPrimeV==buprec && isPrimeV>isPrimeV[1] && VPchLimit>=VPchLimit {
entry = 100; # bull
} else{
entry=0;
}
 

airgb

New member
Seems Like a good entry might be an increase that follows balance. Maybe add an additional volume requirement, but looks better on a chart this way.

# mcdon
# addition 20211010
Input VPchLimit =.60;
def buprec =buying /(buying+ selling );
def beprec = selling /(buying+ selling );
def isPrimeV =if beprec >buprec then beprec else buprec;
def isPrimv2 =100*(isPrimeV-isPrimeV[1])/isPrimeV ;
def Balance= if(between(isPrimeV,.40,.60),1,0);
def entry;
if Balance[1] && IsPrimeV==beprec && isPrimeV>isPrimeV[1] && VPchLimit>=VPchLimit {
entry = -100; # bear
} else if Balance[1] && IsPrimeV==buprec && isPrimeV>isPrimeV[1] && VPchLimit>=VPchLimit {
entry = 100; # bull
} else{
entry=0;
}
Not sure what this is, can you give more detail please? I added below the #Volume Data block and didn't see any change in the chart?
 

mcdon030

Member
Not sure what this is, can you give more detail please? I added below the #Volume Data block and didn't see any change in the chart?
As of right now, you can only see who is in control at that point in time. Wouldn't it be better to get a jump before the move or know where balance zones occurred previously ? Balance zones typically are more beneficial this way as you getting setup prior to directional bias, reversion to mean, etc. The picture below is an upper chart based on the thought. Obviously, a lot of big moves after or reverting back to balance has occurred. I used the same indicator with balance occurring in sequences of 2 or more.



2021-10-10-TOS-CHARTS.png


Here is a picture using supertrend with this balance zone. Not a bad Combined Signal Analysis.

2021-10-10-TOS-CHARTS.png
 
Last edited:

SuryaKiranC

Well-known member
@RedToGreen

if you are interested, here is a code block I have written for SuperTrend_MTF, where the higher frames are auto selected based on chart timeframe, you could customize it based on your own needs. I have it for 5 higher frames and based on chart frame each of the 5 higher frames is auto set to a higher frame.

This is to avoid setting up ever time you switch chart frame.

Edit: Sorry, misquoted, 1 current frame and 4 higher frames.

Ruby:
def _aP1 = GetAggregationPeriod();
def _aP2 = (
if _aP1 == AggregationPeriod.MIN then AggregationPeriod.THREE_MIN else
if _aP1 == AggregationPeriod.TWO_MIN then AggregationPeriod.FOUR_MIN else
if _aP1 == AggregationPeriod.THREE_MIN then AggregationPeriod.FIVE_MIN else
if _aP1 == AggregationPeriod.FOUR_MIN then AggregationPeriod.TEN_MIN else
if _aP1 == AggregationPeriod.FIVE_MIN then AggregationPeriod.TEN_MIN else
if _aP1 == AggregationPeriod.TEN_MIN then AggregationPeriod.FIFTEEN_MIN else
if _aP1 == AggregationPeriod.FIFTEEN_MIN then AggregationPeriod.TWENTY_MIN else
if _aP1 == AggregationPeriod.TWENTY_MIN then AggregationPeriod.THIRTY_MIN else
if _aP1 == AggregationPeriod.THIRTY_MIN then AggregationPeriod.HOUR else
if _aP1 == AggregationPeriod.HOUR then AggregationPeriod.TWO_HOURS else
if _aP1 == AggregationPeriod.TWO_HOURS then AggregationPeriod.FOUR_HOURS else AggregationPeriod.DAY);

def _aP3 = (
if _aP1 == AggregationPeriod.MIN then AggregationPeriod.FIVE_MIN else
if _aP1 == AggregationPeriod.TWO_MIN then AggregationPeriod.TEN_MIN else
if _aP1 == AggregationPeriod.THREE_MIN then AggregationPeriod.TEN_MIN else
if _aP1 == AggregationPeriod.FOUR_MIN then AggregationPeriod.FIFTEEN_MIN else
if _aP1 == AggregationPeriod.FIVE_MIN then AggregationPeriod.FIFTEEN_MIN else
if _aP1 == AggregationPeriod.TEN_MIN then AggregationPeriod.THIRTY_MIN else
if _aP1 == AggregationPeriod.FIFTEEN_MIN then AggregationPeriod.HOUR else
if _aP1 == AggregationPeriod.TWENTY_MIN then AggregationPeriod.HOUR else
if _aP1 == AggregationPeriod.THIRTY_MIN then AggregationPeriod.TWO_HOURS else
if _aP1 == AggregationPeriod.HOUR then AggregationPeriod.FOUR_HOURS else
if _aP1 == AggregationPeriod.TWO_HOURS then AggregationPeriod.DAY else AggregationPeriod.TWO_DAYS);

def _aP4 = (
if _aP1 == AggregationPeriod.MIN then AggregationPeriod.TEN_MIN else
if _aP1 == AggregationPeriod.TWO_MIN then AggregationPeriod.FIFTEEN_MIN else
if _aP1 == AggregationPeriod.THREE_MIN then AggregationPeriod.FIFTEEN_MIN else
if _aP1 == AggregationPeriod.FOUR_MIN then AggregationPeriod.TWENTY_MIN else
if _aP1 == AggregationPeriod.FIVE_MIN then AggregationPeriod.THIRTY_MIN else
if _aP1 == AggregationPeriod.TEN_MIN then AggregationPeriod.HOUR else
if _aP1 == AggregationPeriod.FIFTEEN_MIN then AggregationPeriod.TWO_HOURS else
if _aP1 == AggregationPeriod.TWENTY_MIN then AggregationPeriod.TWO_HOURS else
if _aP1 == AggregationPeriod.THIRTY_MIN then AggregationPeriod.FOUR_HOURS else
if _aP1 == AggregationPeriod.HOUR then AggregationPeriod.DAY else
if _aP1 == AggregationPeriod.TWO_HOURS then AggregationPeriod.TWO_DAYS else AggregationPeriod.THREE_DAYS);

def _aP5 = (
if _aP1 == AggregationPeriod.MIN then AggregationPeriod.FIFTEEN_MIN else
if _aP1 == AggregationPeriod.TWO_MIN then AggregationPeriod.TWENTY_MIN else
if _aP1 == AggregationPeriod.THREE_MIN then AggregationPeriod.THIRTY_MIN else
if _aP1 == AggregationPeriod.FOUR_MIN then AggregationPeriod.THIRTY_MIN else
if _aP1 == AggregationPeriod.FIVE_MIN then AggregationPeriod.HOUR else
if _aP1 == AggregationPeriod.TEN_MIN then AggregationPeriod.TWO_HOURS else
if _aP1 == AggregationPeriod.FIFTEEN_MIN then AggregationPeriod.FOUR_HOURS else
if _aP1 == AggregationPeriod.TWENTY_MIN then AggregationPeriod.FOUR_HOURS else
if _aP1 == AggregationPeriod.THIRTY_MIN then AggregationPeriod.DAY else
if _aP1 == AggregationPeriod.HOUR then AggregationPeriod.TWO_DAYS else
if _aP1 == AggregationPeriod.TWO_HOURS then AggregationPeriod.THREE_DAYS else AggregationPeriod.FOUR_DAYS);

def agg1 = _aP1;
def agg2 = _aP2;
def agg3 = _aP3;
def agg4 = _aP4;
def agg5 = _aP5;
 

airgb

New member
As of right now, you can only see who is in control at that point in time. Wouldn't it be better to get a jump before the move or know where balance zones occurred previously ? Balance zones typically are more beneficial this way as you getting setup prior to directional bias, reversion to mean, etc. The picture below is an upper chart based on the thought. Obviously, a lot of big moves after or reverting back to balance has occurred. I used the same indicator with balance occurring in sequences of 2 or more.



2021-10-10-TOS-CHARTS.png


Here is a picture using supertrend with this balance zone. Not a bad Combined Signal Analysis.

2021-10-10-TOS-CHARTS.png
This is what I get when I try to make an individual indicator so you are going to have to walk me through making this.

Expected double
No such variable: buying at 4:13
No such variable: buying at 4:22
No such variable: selling at 4:30
No such variable: selling at 5:14
No such variable: buying at 5:24
No such variable: selling at 5:32
No such variable: buying at 4:13
No such variable: buying at 4:22
No such variable: selling at 4:30
No such variable: selling at 5:14
No such variable: buying at 5:24
No such variable: selling at 5:3
 

mcdon030

Member
This is what I get when I try to make an individual indicator so you are going to have to walk me through making this.

Expected double
No such variable: buying at 4:13
No such variable: buying at 4:22
No such variable: selling at 4:30
No such variable: selling at 5:14
No such variable: buying at 5:24
No such variable: selling at 5:32
No such variable: buying at 4:13
No such variable: buying at 4:22
No such variable: selling at 4:30
No such variable: selling at 5:14
No such variable: buying at 5:24
No such variable: selling at 5:3
I should have said potential entry. I have some time tonight should you something specific in mind. There are so many ways to look at this, but if you want the top indicator in the picture, I don't mind sharing if you don't have anything specific in mind
 
@RedToGreen

if you are interested, here is a code block I have written for SuperTrend_MTF, where the higher frames are auto selected based on chart timeframe, you could customize it based on your own needs. I have it for 5 higher frames and based on chart frame each of the 5 higher frames is auto set to a higher frame.

This is to avoid setting up ever time you switch chart frame.

Edit: Sorry, misquoted, 1 current frame and 4 higher frames.

Ruby:
def _aP1 = GetAggregationPeriod();
def _aP2 = (
if _aP1 == AggregationPeriod.MIN then AggregationPeriod.THREE_MIN else
if _aP1 == AggregationPeriod.TWO_MIN then AggregationPeriod.FOUR_MIN else
if _aP1 == AggregationPeriod.THREE_MIN then AggregationPeriod.FIVE_MIN else
if _aP1 == AggregationPeriod.FOUR_MIN then AggregationPeriod.TEN_MIN else
if _aP1 == AggregationPeriod.FIVE_MIN then AggregationPeriod.TEN_MIN else
if _aP1 == AggregationPeriod.TEN_MIN then AggregationPeriod.FIFTEEN_MIN else
if _aP1 == AggregationPeriod.FIFTEEN_MIN then AggregationPeriod.TWENTY_MIN else
if _aP1 == AggregationPeriod.TWENTY_MIN then AggregationPeriod.THIRTY_MIN else
if _aP1 == AggregationPeriod.THIRTY_MIN then AggregationPeriod.HOUR else
if _aP1 == AggregationPeriod.HOUR then AggregationPeriod.TWO_HOURS else
if _aP1 == AggregationPeriod.TWO_HOURS then AggregationPeriod.FOUR_HOURS else AggregationPeriod.DAY);

def _aP3 = (
if _aP1 == AggregationPeriod.MIN then AggregationPeriod.FIVE_MIN else
if _aP1 == AggregationPeriod.TWO_MIN then AggregationPeriod.TEN_MIN else
if _aP1 == AggregationPeriod.THREE_MIN then AggregationPeriod.TEN_MIN else
if _aP1 == AggregationPeriod.FOUR_MIN then AggregationPeriod.FIFTEEN_MIN else
if _aP1 == AggregationPeriod.FIVE_MIN then AggregationPeriod.FIFTEEN_MIN else
if _aP1 == AggregationPeriod.TEN_MIN then AggregationPeriod.THIRTY_MIN else
if _aP1 == AggregationPeriod.FIFTEEN_MIN then AggregationPeriod.HOUR else
if _aP1 == AggregationPeriod.TWENTY_MIN then AggregationPeriod.HOUR else
if _aP1 == AggregationPeriod.THIRTY_MIN then AggregationPeriod.TWO_HOURS else
if _aP1 == AggregationPeriod.HOUR then AggregationPeriod.FOUR_HOURS else
if _aP1 == AggregationPeriod.TWO_HOURS then AggregationPeriod.DAY else AggregationPeriod.TWO_DAYS);

def _aP4 = (
if _aP1 == AggregationPeriod.MIN then AggregationPeriod.TEN_MIN else
if _aP1 == AggregationPeriod.TWO_MIN then AggregationPeriod.FIFTEEN_MIN else
if _aP1 == AggregationPeriod.THREE_MIN then AggregationPeriod.FIFTEEN_MIN else
if _aP1 == AggregationPeriod.FOUR_MIN then AggregationPeriod.TWENTY_MIN else
if _aP1 == AggregationPeriod.FIVE_MIN then AggregationPeriod.THIRTY_MIN else
if _aP1 == AggregationPeriod.TEN_MIN then AggregationPeriod.HOUR else
if _aP1 == AggregationPeriod.FIFTEEN_MIN then AggregationPeriod.TWO_HOURS else
if _aP1 == AggregationPeriod.TWENTY_MIN then AggregationPeriod.TWO_HOURS else
if _aP1 == AggregationPeriod.THIRTY_MIN then AggregationPeriod.FOUR_HOURS else
if _aP1 == AggregationPeriod.HOUR then AggregationPeriod.DAY else
if _aP1 == AggregationPeriod.TWO_HOURS then AggregationPeriod.TWO_DAYS else AggregationPeriod.THREE_DAYS);

def _aP5 = (
if _aP1 == AggregationPeriod.MIN then AggregationPeriod.FIFTEEN_MIN else
if _aP1 == AggregationPeriod.TWO_MIN then AggregationPeriod.TWENTY_MIN else
if _aP1 == AggregationPeriod.THREE_MIN then AggregationPeriod.THIRTY_MIN else
if _aP1 == AggregationPeriod.FOUR_MIN then AggregationPeriod.THIRTY_MIN else
if _aP1 == AggregationPeriod.FIVE_MIN then AggregationPeriod.HOUR else
if _aP1 == AggregationPeriod.TEN_MIN then AggregationPeriod.TWO_HOURS else
if _aP1 == AggregationPeriod.FIFTEEN_MIN then AggregationPeriod.FOUR_HOURS else
if _aP1 == AggregationPeriod.TWENTY_MIN then AggregationPeriod.FOUR_HOURS else
if _aP1 == AggregationPeriod.THIRTY_MIN then AggregationPeriod.DAY else
if _aP1 == AggregationPeriod.HOUR then AggregationPeriod.TWO_DAYS else
if _aP1 == AggregationPeriod.TWO_HOURS then AggregationPeriod.THREE_DAYS else AggregationPeriod.FOUR_DAYS);

def agg1 = _aP1;
def agg2 = _aP2;
def agg3 = _aP3;
def agg4 = _aP4;
def agg5 = _aP5;

That's great, Thank you for sharing
 

Similar threads

Top