vZone (Volumes Based Support/Resistance) For ThinkOrSwim

I don't see any time restrictions on the code, @cos251 posted. It's just the description and comment area of the code that need fixing.
It doesn't show thee zones on timeframes > 15minutes. I get a message that vZone is only for 5/10/15 minute timeframe. I went through the video and tried to understand how I could have traded MSFT on 11/12, I could not understand where I would have entered and where I should have exited. It doesn't show entry point & exit points. How do you guys trade based on this indicator?
 
Interesting indicator, nice touch with the EMA clouds. I use a specific volume indicator modified from the TD Ameritrade Vol Profile which I call POC Zone. It pares down the code to what I need with easy visuals.
Below is an image of todays 1 minute chart for Microsoft with the POC Zones set to 15 bars (15 minutes) on the chart and an explanation of how they help confirm a directional trade (along with a number of others).

The image is self explanatory. I can post the indicator if anyone is interested.

8t0TWXP.jpg
@rlohmeyer How would you determine your exit strategy? Is it possible to have textual price values on top of the prior day high/low & current day high/low. Its some time easy to see the price instead of a line. This is an absolute awesome set up. Have improved my trading a lot.
 
It doesn't show thee zones on timeframes > 15minutes. I get a message that vZone is only for 5/10/15 minute timeframe. I went through the video and tried to understand how I could have traded MSFT on 11/12, I could not understand where I would have entered and where I should have exited. It doesn't show entry point & exit points. How do you guys trade based on this indicator?
The Code posted in comment 1 meant to work below 15m only, the video uses only 5m, we coded up to 15m, in case somebody wants to use in slightly higher frame.

As for how to use the indicator, by itself will not give you an entry/exit signal it only shows what is the support/resistance for each zone. the idea is as long as it holds the next zone support you play up to the previous zone, this is the part that is explained in the video.

As for the EMA cloud that is added an extra, that is not part of the video, just to find some entry/exits. There are plenty of videos that are available on EMA clouds and how to use them.

-S
 
Yet another Support/Resistance Indicator for DayTrading, but with a twist, We use high/low of High Volume Bar, in three different Zones of the Day.
With out further delay, Uploading the code here, will come back and edit this line with more appropriate description.

huge thanks to @cos251 for helping me with Coding this, Reviewing and Testing it.

Link to Video: https://www.screencast.com/users/Ma...10/media/f1702bb2-2090-463a-8ad2-59639c1166cd

vZone Extend On/Off
Shared Study Link: http://tos.mx/yA5VXad Click here for --> Easiest way to load shared links
Ruby:
## vZoneSTUDY.ts
## This Indicator is based on the Following concept and, I suggest watch the video before you start to use this.
##
## https://www.screencast.com/users/MarketGauge/folders/DATE1010/media/f1702bb2-2090-463a-8ad2-59639c1166cd
## This is to Plot Support/Resistance based on High Volume Candle in three different time zones for the day.
##
## Removing the header Credit credits and description is not permitted, any modification needs to be shared.
## A big thanks to @COS251 for helping me with Coding this, Reviewing and Testing it.
##
## V 1.1 : Just added the ability to disable the vZones, automatically, extending from previous in to current session.
##  Note : It is available as an option, should somebody prefer the extension. Set "Extend" to your needs accordingly.
## V 1.0 : Split Day in to three Zones and Find the highest Volume Candle for each zone and plot Support/Resistance.
##        :     Zone 1 : 09:30 - 11:00
##        :     Zone 2 : 11:00 - 14:00
##        :     Zone 3 : 14:00 - 16:00
##        :     vZones are Plotted on 15m and lower charts.
##        :  Plots EMA Cloud to assist with identifying reversals, Keeping EMA Clouds for all Timeframes


declare upper;
declare once_per_bar;

def Future = if GetSymbolPart(1) == "/YM:XCBT" or GetSymbolPart(1) == "/ES:XCME" or GetSymbolPart(1) == "/NQ:XCME" or GetSymbolPart(1) == "/RTY:XCME" or GetSymbolPart(1) == "/EMD:XCME" or GetSymbolPart(1) == "/NKD:XCME" or GetSymbolPart(1) == “/DX:XICE" or GetSymbolPart(1) == "/6E:XCME" or  GetSymbolPart(1) == "/6A:XCME" or GetSymbolPart(1) == "/ZB:XCBT" or GetSymbolPart(1) == "/ZN:XCBT" or GetSymbolPart(1) == "/CL:XNYM" or GetSymbolPart(1) == "/NG:XNYM" or GetSymbolPart(1) == "/GC:XCEC" or GetSymbolPart(1) == "/SI:XCEC" or  GetSymbolPart(1) == "/HG:XCEC” or GetSymbolPart(1) == "/6B:XCME" or GetSymbolPart(1) == "/ZC:XCBT" or GetSymbolPart(1) == "/ZS:XCBT" or GetSymbolPart(1) == "/CC:XICE" or GetSymbolPart(1) == "/KC:XICE" or GetSymbolPart(1) == ”/CT:XICE" or GetSymbolPart(1) == "/ZW:XCBT" or GetSymbolPart(1) == "/SB:XICE" or GetSymbolPart(1) == "/LE:XCME" or GetSymbolPart(1) == "/HO:XNYM" or GetSymbolPart(1) == "/HE:XCME" or GetSymbolPart(1) == "/OJ:XICE" then yes else no;

AddLabel(if Future then yes else no, "Future", Color.YELLOW);

input   showEMACloud = Yes;
input  audibleAlerts = Yes;
input Extend = {default "No", "Yes"};

def Today = GetYYYYMMDD();
def StartTime = 0930;
def   Update1 = 1100;
def   Update2 = 1400;
def   EndTime = 1600;

def Zone1 = SecondsFromTime(StartTime) >= 0 and SecondsTillTime(Update1) >= 0;
def Zone2 =   SecondsFromTime(Update1) >= 0 and SecondsTillTime(Update2) >= 0;
def Zone3 =   SecondsFromTime(Update2) >= 0 and SecondsTillTime(EndTime) >= 0;

DefineGlobalColor("Zone1", CreateColor(204, 255, 225));
DefineGlobalColor("Zone2", CreateColor(252, 220, 101));
DefineGlobalColor("Zone3", CreateColor(204, 204, 198));
DefineGlobalColor( "EMA1+", CreateColor(201, 255, 234));
DefineGlobalColor( "EMA1-", CreateColor(255, 105, 105));
DefineGlobalColor( "EMA2+", CreateColor(125, 176, 130));
DefineGlobalColor( "EMA2-", CreateColor(194, 152, 227));
DefineGlobalColor( "EMA3+", CreateColor(161, 217, 247));
DefineGlobalColor( "EMA3-", CreateColor(255, 255, 112));

def  ema1low = 5;
def ema1high = 13;
def  ema2low = 34;
def ema2high = 51;
def  ema3low = 72;
def ema3high = 89;

def  ema5 = if showEMACloud then ExpAverage(close,  ema1low) else Double.NaN;
def ema13 = if showEMACloud then ExpAverage(close, ema1high) else Double.NaN;
def ema34 = if showEMACloud then ExpAverage(close,  ema2low) else Double.NaN;
def ema51 = if showEMACloud then ExpAverage(close, ema2high) else Double.NaN;
def ema72 = if showEMACloud then ExpAverage(close,  ema3low) else Double.NaN;
def ema89 = if showEMACloud then ExpAverage(close, ema3high) else Double.NaN;

AddCloud( ema5, ema13, GlobalColor("EMA1+"), GlobalColor("EMA1-"));
AddCloud(ema34, ema51, GlobalColor("EMA2+"), GlobalColor("EMA2-"));
AddCloud(ema72, ema89, GlobalColor("EMA3+"), GlobalColor("EMA3-"));

def CrossAbove = if showEMACloud and ema5 > ema13 and ema5[1] <= ema13[1] then 1 else 0;
def CrossBelow = if showEMACloud and ema5 < ema13 and ema5[1] >= ema13[1] then 1 else 0;

Alert(showEMACloud and audibleAlerts and CrossAbove, "Buy", Alert.BAR, Sound.Ding);
Alert(showEMACloud and audibleAlerts and CrossBelow, "Sell", Alert.BAR, Sound.Ring);

################################################################
##########         Booleans Set for Plot Use           #########
################################################################
def afterStart;
def beforeEnd;
def openPrice;
if GetAggregationPeriod() <= AggregationPeriod.FIFTEEN_MIN {
    afterStart = GetTime() > RegularTradingStart(GetYYYYMMDD());
    beforeEnd = GetTime() < RegularTradingEnd(GetYYYYMMDD());
    openPrice = DailyOpen();
} else {
    afterStart = Double.NaN;
    beforeEnd = Double.NaN;
    openPrice = Double.NaN;
}

plot DailyO = if openPrice then openPrice else Double.NaN;

script Zone {
    def H ;
    def L ;
    def V ;

    input CountIn = 0930;
    input CountOut = 1100;
    def TF = SecondsFromTime(CountIn) >= 0 and SecondsTillTime(CountOut) >= 0;

    if TF and !TF[1] {
        H = high;
        L = low;
        V = volume;
    } else if TF and volume > V[1] {
        H = high;
        L = low;
        V = volume;
    } else {
        H = H[1];
        L = L[1];
        V = V[1];
    }
    plot VZH = H;
    plot VZL = L;
    VZH.Hide();
    VZL.Hide();
}

def Z1H;
def Z1L;
def Z2H;
def Z2L;
def Z3H;
def Z3L;

switch (Extend){

Case "Yes":
 Z1H = Zone(CountIn = StartTime, CountOut = Update1).VZH;
 Z2H = Zone(CountIn =   Update1, CountOut = Update2).VZH;
 Z3H = Zone(CountIn =   Update2, CountOut = EndTime).VZH;

 Z1L = Zone(CountIn = StartTime, CountOut = Update1).VZL;
 Z2L = Zone(CountIn =   Update1, CountOut = Update2).VZL;
 Z3L = Zone(CountIn =   Update2, CountOut = EndTime).VZL;

Case "No":
 Z1H = if today != today[1] then Double.NaN else Zone(CountIn = StartTime, CountOut = Update1).VZH;
 Z2H = if today and  !Zone2 then Double.NaN else Zone(CountIn =   Update1, CountOut = Update2).VZH;
 Z3H = if today and  !Zone3 then Double.NaN else Zone(CountIn =   Update2, CountOut = EndTime).VZH;

 Z1L = if today != today[1] then Double.NaN else Zone(CountIn = StartTime, CountOut = Update1).VZL;
 Z2L = if today and  !Zone2 then Double.NaN else Zone(CountIn =   Update1, CountOut = Update2).VZL;
 Z3L = if today and  !Zone3 then Double.NaN else Zone(CountIn =   Update2, CountOut = EndTime).VZL;
}

def BelowVZ = if close < Z1L or close < Z2L or close < Z3L then 1 else 0;
def AboveVZ = if close > Z1H or close > Z2H or close > Z3H then 1 else 0;

AddLabel(if (GetAggregationPeriod() > AggregationPeriod.FIFTEEN_MIN) then yes else no, "vBox Zones on 5/10/15M Charts Only", Color.RED);

AddCloud(if afterStart and beforeEnd then Z1H else Double.NaN, if afterStart and beforeEnd then Z1L else Double.NaN, GlobalColor("Zone1"), GlobalColor("Zone1"));
AddCloud(if    Update1 and beforeEnd then Z2H else Double.NaN, if    Update1 and beforeEnd then Z2L else Double.NaN, GlobalColor("Zone2"), GlobalColor("Zone2"));
AddCloud(if    Update2 and beforeEnd then Z3H else Double.NaN, if    Update2 and beforeEnd then Z3L else Double.NaN, GlobalColor("Zone3"), GlobalColor("Zone3"));

Alert(audibleAlerts and AboveVZ, "Above High VolumeBar Caution Long", Alert.BAR, Sound.Ding);
Alert(audibleAlerts and BelowVZ, "Below High VolumeBar Look for Reversal", Alert.BAR, Sound.Ring);
@SuryaKiranC Good work, can I adjust for Globex?
 
Beautiful!

Nice work @SuryaKiranC - such a clean indicator!

Very powerful indicator! MSFT Levels today. From breakout to resistance.

HdQY7Ff.jpg



***** Alternate version of vZone w/ no time restrictions. Just looking for highest volume bar and tracking previous 2 highest bars.

xBXMMrJ.jpg

Ruby:
## vZoneNoTime.ts
## This Indicator is based on the Following concept and, I suggest watch the video before you start to use this.
##
## https://www.screencast.com/users/MarketGauge/folders/DATE1010/media/f1702bb2-2090-463a-8ad2-59639c1166cd
## This is to Plot Support/Resistance based on High Volume Candle in three different time zones for the day.
##
## Removing the header Credit credits and description is not permitted, any modification needs to be shared.
## A big thanks to @COS251 for helping me with Coding this, Reviewing and Testing it.
##
## V 1.3 : Added 2 additional zones per request from @Ahmar824
##
## V 1.2 : Removed time restriction - alternate version (@cos251)
##
## V 1.1 : Just added the ability to disable the vZones, automatically, extending from previous in to current session.
##  Note : It is available as an option, should somebody prefer the extension. Set "Extend" to your needs accordingly.
## V 1.0 : Split Day in to three Zones and Find the highest Volume Candle for each zone and plot Support/Resistance.
##        :     Zone 1 : 09:30 - 11:00
##        :     Zone 2 : 11:00 - 14:00
##        :     Zone 3 : 14:00 - 16:00
##        :     vZones are Plotted on 15m and lower charts.
##        :  Plots EMA Cloud to assist with identifying reversals, Keeping EMA Clouds for all Timeframes




def volumeHigh;
def volumeLow;
def volVAR;
def ph;
def pl;
def ph2;
def pl2;
def ph3;
def pl3;
def ph4;
def pl4;
if volume > volVAR[1] {
    volumeHigh = high;
    volumeLow = low;
    volVAR = volume;
    ph = volumeHigh[1];
    pl = volumeLow[1];
    ph2 = ph[1];
    pl2 = pl[1];
    ph3 = ph2[1];
    pl3 = pl2[1];
    ph4 = ph3[1];
    pl4 = pl3[1];
} else {
    volumeHigh = volumeHigh[1];
    volumeLow = volumeLow[1];
    volVAR = volVAR[1];
    ph = ph[1];
    pl = pl[1];
    ph2 = ph2[1];
    pl2 = pl2[1];
    ph3 = ph3[1];
    pl3 = pl3[1];
    ph4 = ph4[1];
    pl4 = pl4[1];
}

# --- Zone 1
plot h = volumeHigh;
plot l = volumeLow;
AddCloud(h,  l, Color.GRAY,Color.GRAY);

# --- Zone 2
plot previoush = ph;
plot previousl = pl;
AddCloud(previoush,previousl,Color.PINK);

# --- Zone 3
plot previoush2 = ph2;
plot previousl2 = pl2;
AddCloud(previoush2,previousl2,Color.MAGENTA);

# --- Zone 4
plot previoush3 = ph3;
plot previousl3 = pl3;
AddCloud(previoush3,previousl3,Color.BLUE);

# --- Zone 5
plot previoush4 = ph4;
plot previousl4 = pl4;
AddCloud(previoush4,previousl4,Color.LIME);

# --- Labels
AddLabel(yes,"Zone 1",Color.GRAY);
AddLabel(yes,"Zone 2",Color.PINK);
AddLabel(yes,"Zone 3",Color.MAGENTA);
AddLabel(yes,"Zone 4",Color.BLUE);
AddLabel(yes,"Zone 5",Color.LIME);



One more image: Same SPY from above but 5m

ikLUy4R.jpg
what times are zone 4 and zone 5 in the code? @cos251

# --- Zone 4
plot previoush3 = ph3;
plot previousl3 = pl3;
AddCloud(previoush3,previousl3,Color.BLUE);

# --- Zone 5
plot previoush4 = ph4;
plot previousl4 = pl4;
AddCloud(previoush4,previousl4,Color.LIME);
 
what times are zone 4 and zone 5 in the code? @cos251

# --- Zone 4
plot previoush3 = ph3;
plot previousl3 = pl3;
AddCloud(previoush3,previousl3,Color.BLUE);

# --- Zone 5
plot previoush4 = ph4;
plot previousl4 = pl4;
AddCloud(previoush4,previousl4,Color.LIME);
the version @cos251 created is not time based, same concept as the time based, but based on the entire data, presented on your chart.
 
I've been wondering if it's at all possible for a port to mobile thinkorswim? Love this indicator by the way
 
Last edited:
Yet another Support/Resistance Indicator for DayTrading, but with a twist, We use high/low of High Volume Bar, in three different Zones of the Day.
With out further delay, Uploading the code here, will come back and edit this line with more appropriate description.

huge thanks to @cos251 for helping me with Coding this, Reviewing and Testing it.

Link to Video: https://www.screencast.com/users/Ma...10/media/f1702bb2-2090-463a-8ad2-59639c1166cd

vZone Extend On/Off
Shared Study Link: https://tos.mx/ke0f6ny Click here for --> Easiest way to load shared links
Ruby:
## vZoneSTUDY.ts
## This Indicator is based on the Following concept and, I suggest watch the video before you start to use this.
##
## https://www.screencast.com/users/MarketGauge/folders/DATE1010/media/f1702bb2-2090-463a-8ad2-59639c1166cd
## This is to Plot Support/Resistance based on High Volume Candle in three different time zones for the day.
##
## Removing the header Credit credits and description is not permitted, any modification needs to be shared.
## A big thanks to @COS251 for helping me with Coding this, Reviewing and Testing it.
##
## V 1.2 : No changes to the logic But just hints and header updates, also added a tiny URL for the video.
## V 1.1 : Just added the ability to disable the vZones, automatically, extending from previous in to current session.
##  Note : It is available as an option, should somebody prefer the extension. Set "Extend" to your needs accordingly.
## V 1.0 : Split Day in to three Zones and Find the highest Volume Candle for each zone and plot Support/Resistance.
##       :     Zone 1 : 09:30 - 11:00
##       :     Zone 2 : 11:00 - 14:00
##       :     Zone 3 : 14:00 - 16:00
##       :     vZones are Plotted on 15m and lower charts.
##       :  Plots EMA Cloud to assist with identifying reversals, Keeping EMA Clouds for all Timeframes
#hint: <b>vZoneStudy for Upper Chart.</b> \n <li> Suggestion, See the following Video</li> https://tinyurl.com/yzaxrf7e <li>Volume Based Support/Resistance for Intraday.</li>
#hint showEMACloud: <b>Helps find Reversal </b> <li>Select "No" if it is too loud on your charts.</li>
#hint audibleAlerts: <b>TOS Sounds for Condition </b> <li>Select "No" if it is too loud for you.</li>
#hint Extend: <b>Extend vZone Clouds from past session</b> <li>Select "No" if it is too loud for you.</li>
declare once_per_bar;

def Future = if GetSymbolPart(1) == "/YM:XCBT"  or # Reserved for any further work, not used at the moment other than display the label.
                GetSymbolPart(1) == "/ES:XCME"  or
                GetSymbolPart(1) == "/NQ:XCME"  or
                GetSymbolPart(1) == "/RTY:XCME" or
                GetSymbolPart(1) == "/EMD:XCME" or
                GetSymbolPart(1) == "/NKD:XCME" or
                GetSymbolPart(1) == “/DX:XICE"  or
                GetSymbolPart(1) == "/6E:XCME"  or
                GetSymbolPart(1) == "/6A:XCME"  or
                GetSymbolPart(1) == "/ZB:XCBT"  or
                GetSymbolPart(1) == "/ZN:XCBT"  or
                GetSymbolPart(1) == "/CL:XNYM"  or
                GetSymbolPart(1) == "/NG:XNYM"  or
                GetSymbolPart(1) == "/GC:XCEC"  or
                GetSymbolPart(1) == "/SI:XCEC"  or
                GetSymbolPart(1) == "/HG:XCEC”  or
                GetSymbolPart(1) == "/6B:XCME"  or
                GetSymbolPart(1) == "/ZC:XCBT"  or
                GetSymbolPart(1) == "/ZS:XCBT"  or
                GetSymbolPart(1) == "/CC:XICE"  or
                GetSymbolPart(1) == "/KC:XICE"  or
                GetSymbolPart(1) == ”/CT:XICE"  or
                GetSymbolPart(1) == "/ZW:XCBT"  or
                GetSymbolPart(1) == "/SB:XICE"  or
                GetSymbolPart(1) == "/LE:XCME"  or
                GetSymbolPart(1) == "/HO:XNYM"  or
                GetSymbolPart(1) == "/HE:XCME"  or
                GetSymbolPart(1) == "/OJ:XICE"  then yes else no;

AddLabel(if Future then yes else no, "Future", Color.YELLOW);

input   showEMACloud = Yes;
input  audibleAlerts = Yes;
input Extend = {default "No", "Yes"};

def Today = GetYYYYMMDD();
def StartTime = 0930;
def   Update1 = 1100;
def   Update2 = 1400;
def   EndTime = 1600;

def Zone1 = SecondsFromTime(StartTime) >= 0 and SecondsTillTime(Update1) >= 0;
def Zone2 =   SecondsFromTime(Update1) >= 0 and SecondsTillTime(Update2) >= 0;
def Zone3 =   SecondsFromTime(Update2) >= 0 and SecondsTillTime(EndTime) >= 0;

DefineGlobalColor("Zone1", CreateColor(204, 255, 225));
DefineGlobalColor("Zone2", CreateColor(252, 220, 101));
DefineGlobalColor("Zone3", CreateColor(204, 204, 198));
DefineGlobalColor( "EMA1+", CreateColor(201, 255, 234));
DefineGlobalColor( "EMA1-", CreateColor(255, 105, 105));
DefineGlobalColor( "EMA2+", CreateColor(125, 176, 130));
DefineGlobalColor( "EMA2-", CreateColor(194, 152, 227));
DefineGlobalColor( "EMA3+", CreateColor(161, 217, 247));
DefineGlobalColor( "EMA3-", CreateColor(255, 255, 112));

def  ema1low = 5;
def ema1high = 13;
def  ema2low = 34;
def ema2high = 51;
def  ema3low = 72;
def ema3high = 89;

def  ema5 = if showEMACloud then ExpAverage(close,  ema1low) else Double.NaN;
def ema13 = if showEMACloud then ExpAverage(close, ema1high) else Double.NaN;
def ema34 = if showEMACloud then ExpAverage(close,  ema2low) else Double.NaN;
def ema51 = if showEMACloud then ExpAverage(close, ema2high) else Double.NaN;
def ema72 = if showEMACloud then ExpAverage(close,  ema3low) else Double.NaN;
def ema89 = if showEMACloud then ExpAverage(close, ema3high) else Double.NaN;

AddCloud( ema5, ema13, GlobalColor("EMA1+"), GlobalColor("EMA1-"));
AddCloud(ema34, ema51, GlobalColor("EMA2+"), GlobalColor("EMA2-"));
AddCloud(ema72, ema89, GlobalColor("EMA3+"), GlobalColor("EMA3-"));

def CrossAbove = if showEMACloud and ema5 > ema89 and ema5[1] <= ema89[1] then 1 else 0;
def CrossBelow = if showEMACloud and ema5 < ema13 and ema5[1] >= ema13[1] then 1 else 0;

Alert(showEMACloud and audibleAlerts and CrossAbove, "Buy", Alert.BAR, Sound.Ding);
Alert(showEMACloud and audibleAlerts and CrossBelow, "Sell", Alert.BAR, Sound.Ring);

################################################################
##########         Booleans Set for Plot Use           #########
################################################################
def afterStart;
def beforeEnd;
def openPrice;
if GetAggregationPeriod() <= AggregationPeriod.THIRTY_MIN {
    afterStart = GetTime() > RegularTradingStart(GetYYYYMMDD());
    beforeEnd = GetTime() < RegularTradingEnd(GetYYYYMMDD());
    openPrice = DailyOpen();
} else {
    afterStart = Double.NaN;
    beforeEnd = Double.NaN;
    openPrice = Double.NaN;
}

script Zone {
    def H ;
    def L ;
    def V ;

    input CountIn = 0930;
    input CountOut = 1100;
    def TF = SecondsFromTime(CountIn) >= 0 and SecondsTillTime(CountOut) >= 0;

    if TF and !TF[1] {
        H = high;
        L = low;
        V = volume;
    } else if TF and volume > V[1] {
        H = high;
        L = low;
        V = volume;
    } else {
        H = H[1];
        L = L[1];
        V = V[1];
    }
  plot VZH = H;
  plot VZL = L;
  VZH.Hide();
  VZL.Hide();
}

def Z1H;
def Z1L;
def Z2H;
def Z2L;
def Z3H;
def Z3L;

switch (Extend){

Case "Yes":
 Z1H = Zone(CountIn = StartTime, CountOut = Update1).VZH;
 Z2H = Zone(CountIn =   Update1, CountOut = Update2).VZH;
 Z3H = Zone(CountIn =   Update2, CountOut = EndTime).VZH;

 Z1L = Zone(CountIn = StartTime, CountOut = Update1).VZL;
 Z2L = Zone(CountIn =   Update1, CountOut = Update2).VZL;
 Z3L = Zone(CountIn =   Update2, CountOut = EndTime).VZL;

Case "No":
 Z1H = if today != today[1] then Double.NaN else Zone(CountIn = StartTime, CountOut = Update1).VZH;
 Z2H = if today and  !Zone2 then Double.NaN else Zone(CountIn =   Update1, CountOut = Update2).VZH;
 Z3H = if today and  !Zone3 then Double.NaN else Zone(CountIn =   Update2, CountOut = EndTime).VZH;

 Z1L = if today != today[1] then Double.NaN else Zone(CountIn = StartTime, CountOut = Update1).VZL;
 Z2L = if today and  !Zone2 then Double.NaN else Zone(CountIn =   Update1, CountOut = Update2).VZL;
 Z3L = if today and  !Zone3 then Double.NaN else Zone(CountIn =   Update2, CountOut = EndTime).VZL;
}

def BelowVZ = if Zone1 and close < Z1L or Zone2 and close < Z2L or Zone3 and close < Z3L then 1 else 0;
def AboveVZ = if Zone1 and close > Z1H or Zone2 and close > Z2H or Zone3 and close > Z3H then 1 else 0;

AddLabel(if (GetAggregationPeriod() > AggregationPeriod.FIFTEEN_MIN) then yes else no, "vBox Zones on 5/10/15M Charts Only  ", Color.RED);

AddCloud(if afterStart and beforeEnd then Z1H else Double.NaN, if afterStart and beforeEnd then Z1L else Double.NaN, GlobalColor("Zone1"), GlobalColor("Zone1"));
AddCloud(if    Update1 and beforeEnd then Z2H else Double.NaN, if    Update1 and beforeEnd then Z2L else Double.NaN, GlobalColor("Zone2"), GlobalColor("Zone2"));
AddCloud(if    Update2 and beforeEnd then Z3H else Double.NaN, if    Update2 and beforeEnd then Z3L else Double.NaN, GlobalColor("Zone3"), GlobalColor("Zone3"));

Alert(audibleAlerts and AboveVZ, "Above High VolumeBar Caution Long", Alert.BAR, Sound.Ding);
Alert(audibleAlerts and BelowVZ, "Below High VolumeBar Look for Reversal", Alert.BAR, Sound.Ring);


vZone_Labels

Shared Study Link: https://tos.mx/kribwZB Click here for --> Easiest way to load shared links

Ruby:
##vZone_Labels
##This is Companian Indicator for vZone, which is based on the Following concept and, I suggest watch the video before you start to use this.
##
## https://www.screencast.com/users/MarketGauge/folders/DATE1010/media/f1702bb2-2090-463a-8ad2-59639c1166cd
## This is to Plot Support/Resistance based on High Volume Candle in three different time zones for the day.
##
## Removing the header Credit credits and description is not permitted, any modification needs to be shared.
## A big thanks to @COS251 for helping me with Coding this, Reviewing and Testing it.
##
# Version 1.0.2
#
# Created on 01/08/21
# Created by: SuryaKiranC ## Included rVolume label and Changed length as input.

#hint: <b>vZone_Labels Lower Study</b> \n Setup inputs as per your preferences \n <li>Replacement for Standard TOS Volume Bars, Disable VolumeSubgraph.</li>
#hint Length: <b>No of Bars for Average Calculation.</b> <li>Adjust as per your preference.</li>
#hint Barlength: <b>Near term No of Bars for Average Calculations.</b> <li>Adjust as per your preference.</li>
#hint ShowVolAvg: <b>Plot Vol Average across Volume Bars.</b> <li>Set "No" if this is not needed for you.</li>
#hint ShowPreMktVol: <b>Enable/Disable PreMkt Volume.</b> <li>Set "No" if this is not needed for you.</li>
#hint ShowZoneVol: <b>Enable/Disable Per Zone Volume.</b> <li>Set "No" if this is not needed for you.</li>
#hint ShowPostMktVol: <b>Enable/Disable PostMkt Volume.</b> <li>Set "No" if this is not needed for you.</li>

#hint ShowDayAvg: <b>Enable/Disable Average Volume of Days set in the Length above.</b> <li>Set "No" if this is not needed for you.</li>
#hint ShowTodayVolume: <b>Enable/Disable Today's Volume</b> <li>Set "No" if this is not needed for you.</li>
#hint ShowRvol: <b>Enable/Disable Relative Volume to Length Days</b> <li>Set "No" if this is not needed for you.</li>
#hint UnusualVolumePercent: <b>Define your own UnusualVolume, Typical Liquid Stock 110% and above.</b> <li>Set "No" if this is not needed for you.</li>
#hint ShowBarAvg: <b>Enable/Disable Average Bar volume, On Daily This is same as ShowDayAvg.</b> <li>Set "No" if this is not needed for you.</li>
#hint ShowCurrentBar: <b>Enable/Disable Current Bar Volume.</b> <li>Set "No" if this is not needed for you.</li>
#hint ShowPercentOfBarAvg: <b>Enable/Disable % if Volume, Compared to Days/Bar of Length </b> <li>Set "No" if this is not needed for you.</li>
#hint ShowBarsSell:  <b>Enable/Disable Sell Volume for length </b> <li>Set "No" if this is not needed for you.</li>
#hint Show6BarSell:  <b>Enable/Disable Sell Volume for Last 6 Bar </b> <li>Set "No" if this is not needed for you.</li>
#hint ShowSellVolume:<b>Enable/Disable Current Volume Sell Compared to length Bars </b> <li>Set "No" if this is not needed for you.</li>

#declare lower; # If you disable Volume subgraph and using as lower study uncomment this and comment the next one.
declare on_volume; #If you need to use only labels as a top study comment "Selling Volume" & "Buying Volume", along with this line with a "#" in-front of the line

DefineGlobalColor("Zone1", CreateColor(204, 255, 225));
DefineGlobalColor("Zone2", CreateColor(252, 220, 101));
DefineGlobalColor("Zone3", CreateColor(204, 204, 198));

input Length = 21;
input Barlength = 6;
input ShowVolAvg = Yes;

input  ShowPreMktVol = Yes;
input    ShowZoneVol = Yes;
input ShowPostMktVol = Yes;

def Zone1 = gettime() >= RegularTradingStart(GetYYYYMMDD()) and gettime() <= RegularTradingStart(GetYYYYMMDD()) + 90*60*1000;
def Zone2 = gettime()  > RegularTradingStart(GetYYYYMMDD()) + 90*60*1000 and gettime() <= RegularTradingEnd(GetYYYYMMDD())-120*60*1000;
def Zone3 = gettime()  > RegularTradingEnd(GetYYYYMMDD()) - 120*60*1000 and gettime() <= RegularTradingEnd(GetYYYYMMDD());

def startTime = 0930;
def   update1 = 1100;
def   update2 = 1400;
def   endTime = 1600;
def isNewDay = GetDay() == GetLastDay();
def yyyymmdd = GetYYYYMMDD();
def period = yyyymmdd;
def isPeriodRolled = CompoundValue(1, period != period[1], 1);
def sumVol = if isPeriodRolled then volume else CompoundValue(1, sumVol[1] + volume, volume);

######################### Current BAR ########################
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);

######################## 6BAR ################################
def HH6 = Average(high[1], Barlength);
def HC6 = Average(close[1], Barlength);
def HL6 = Average(low[1], Barlength);
def HV6 = Average(volume[1], Barlength);
def  Buy6 = HV6 * (HC6 - HL6) / (HH6 - HL6);
def Sell6 = HV6 * (HH6 - HC6) / (HH6 - HL6);

###################### 30BAR #################################
def HH30 = Average(high[1], Length);
def HC30 = Average(close[1], Length);
def HL30 = Average(low[1], Length);
def HV30 = Average(volume[1], Length);
def Buy30 = HV30 * (HC30 - HL30) / (HH30 - HL30);
def Sell30 = HV30 * (HH30 - HC30) / (HH30 - HL30);

###################### 6Bar Volume % #########################
def H6Vol = Round(Buy6, 0) + Round(Sell6, 0) ;
def H6buyPercent  = ( Round(Buy6, 0)  / H6Vol ) * 100;
def H6sellPercent = ( Round(Sell6, 0) / H6Vol ) * 100;

###################### 30Bar Volume %   ######################
def H30Vol = Round(Buy30, 0) + Round(Sell30, 0) ;
def H30buyPercent  = (Round(Buy30, 0)  / H30Vol) * 100;
def H30sellPercent = (Round(Sell30, 0) / H30Vol) * 100;

####################### Volume Stats #########################
def volDayAvg = Average(volume (Period = "DAY")[1],Length);
def DayVol = volume(period = "DAY");
def rVol = Round((DayVol / volDayAvg), 2);
def avgBars = Average(volume[1],Length);
def curVolume = volume;
def percentOfBars = Round((curVolume / avgBars) * 100, 0);
def SellVolPercent = Round((Selling / Volume) * 100, 0);

######################### Labels ##############################
input ShowDayAvg = yes;
input ShowTodayVolume = yes;
input ShowRvol = yes;
input UnusualVolumePercent = 110;
input ShowBarAvg = yes;
input ShowCurrentBar = yes;
input ShowPercentOfBarAvg = yes;

AddLabel(ShowDayAvg, Length+"D: " + Round(volDayAvg * .000001, 1) + " M ", Color.LIGHT_GRAY);
AddLabel(ShowTodayVolume, "D: " + Round(DayVol * .000001, 1) + " M ", (if rVol >= UnusualVolumePercent then Color.GREEN else if rVol >= 100 then Color.ORANGE else Color.LIGHT_GRAY));
AddLabel(ShowRvol,"rVol: " + rVol,(if rVol >= UnusualVolumePercent then Color.GREEN else if rVol >= 100 then Color.ORANGE else Color.WHITE));
AddLabel(ShowBarAvg, "30Bar: " + Round(avgBars * .001, 1) + " K ", Color.LIGHT_GRAY);
AddLabel(ShowCurrentBar, "CurBar: " + Round(curVolume * .001, 2) + " K ", (if percentOfBars >= UnusualVolumePercent then Color.GREEN else if percentOfBars >= 100 then Color.ORANGE else Color.LIGHT_GRAY));
AddLabel(ShowPercentOfBarAvg, percentOfBars + "%", (if percentOfBars >= UnusualVolumePercent then Color.GREEN else if percentOfBars >= 100 then Color.ORANGE else Color.WHITE) );

############################################ 30 Bar Stats ############################################
input ShowBarsSell = yes;
AddLabel(ShowBarsSell, length + "BarSell: " + Round(H30sellPercent, 0) + "% ", (if H30sellPercent > 55 then Color.RED else if H30sellPercent < 45 then Color.GREEN else Color.ORANGE));
############################################ 6 Bar Stats #############################################
input Show6BarSell = yes;
AddLabel(Show6BarSell, Barlength +"BarSell: " + Round(H6sellPercent, 0) + "% ", (if H6sellPercent > 55 then Color.RED else if H6sellPercent < 45 then Color.GREEN else Color.ORANGE));
############################################ Current Bar Stats ########################################
input ShowSellVolume = yes;
AddLabel(ShowSellVolume, "CurSell: " + Round(SellVolPercent, 0) + "% ", (if SellVolPercent > 51 then Color.RED else if SellVolPercent < 49 then Color.GREEN else Color.ORANGE));

##################### Selling Volume #####################
plot SVol = Selling;
SVol.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
SVol.SetDefaultColor(Color.DARK_ORANGE);
SVol.HideTitle();
SVol.HideBubble();
SVol.SetLineWeight(3);

##################### Buying Volume ######################
plot BVol = Buying;
BVol.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
BVol.SetDefaultColor(Color.LIGHT_GREEN);
BVol.HideTitle();
BVol.HideBubble();
BVol.SetLineWeight(3);

##################### Plots and Style ###################
plot Vol = volume;
plot VolAvg = Average(volume[1], Length);
VolAvg.SetHiding(!ShowVolAvg);
Vol.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Vol.SetLineWeight(3);
Vol.DefineColor("Up", Color.UPTICK);
Vol.DefineColor("Down", Color.DOWNTICK);
Vol.AssignValueColor(if close > close[1] then Vol.color("Up") else if close < close[1] then Vol.color("Down") else GetColor(1));
VolAvg.SetDefaultColor(GetColor(8));

def PreMkt = RegularTradingStart (GetYYYYMMDD()) > GetTime();
def PreVol = if PreMkt and !PreMkt[1] then volume else if PreMkt then PreVol[1] + volume else PreVol[1];
AddLabel(if GetAggregationPeriod() > AggregationPeriod.THIRTY_MIN or !ShowPreMktVol then 0 else 1, "PreMktVol = " + Round(PreVol * .000001, 3) + "M ", Color.YELLOW);

def RTH1Zone = SecondsFromTime(startTime) >= 0 and SecondsTillTime(update1) > 0;
def RTH1ZoneVol = if RTH1Zone and !RTH1Zone[1] then volume else if RTH1Zone then RTH1ZoneVol[1] + volume else RTH1ZoneVol[1];
AddLabel(if GetAggregationPeriod() > AggregationPeriod.THIRTY_MIN or !ShowZoneVol then 0 else 1, "Zone1Vol = " + Round(RTH1ZoneVol * .000001, 3) + "M ", GlobalColor("Zone1"));

def RTH2Zone = SecondsFromTime(update1) >= 0 and SecondsTillTime(update2) > 0;
def RTH2ZoneVol = if RTH2Zone and !RTH2Zone[1] then volume else if RTH2Zone then RTH2ZoneVol[1] + volume else RTH2ZoneVol[1];
AddLabel(if GetAggregationPeriod() > AggregationPeriod.THIRTY_MIN or !ShowZoneVol then 0 else 1, "Zone2Vol = " + Round(RTH2ZoneVol * .000001, 3) + "M ", GlobalColor("Zone2"));

def RTH3Zone = SecondsFromTime(update2) >= 0 and SecondsTillTime(endTime) > 0;
def RTH3ZoneVol = if RTH3Zone and !RTH3Zone[1] then volume else if RTH3Zone then RTH3ZoneVol[1] + volume else RTH3ZoneVol[1];
AddLabel(if GetAggregationPeriod() > AggregationPeriod.THIRTY_MIN or !ShowZoneVol then 0 else 1, "Zone3Vol = " + Round(RTH3ZoneVol * .000001, 3) + "M ", GlobalColor("Zone3"));

AddVerticalLine(if isNewDay and RTH1Zone == 0 and RTH1Zone[1] == 1 then yes else no, "             Zone 1  Mark", color = GlobalColor("Zone1"));
AddVerticalLine(if isNewDay and RTH2Zone == 0 and RTH2Zone[1] == 1 then yes else no, "             Zone 2  Mark", color = GlobalColor("Zone2"));
AddVerticalLine(if isNewDay and RTH3Zone == 0 and RTH3Zone[1] == 1 then yes else no, "             Zone 3  Mark", color = GlobalColor("Zone3"));

def PostMkt = RegularTradingEnd (GetYYYYMMDD()) < GetTime();
def PostVol = if PostMkt and !PostMkt[1] then volume else if PostMkt then PostVol[1] + volume else PostVol[1];
AddLabel(if GetAggregationPeriod() > AggregationPeriod.THIRTY_MIN or !ShowPostMktVol then 0 else 1, "PostMktVol = " + Round(PostVol * .000001, 3) + "M ", Color.YELLOW);
#End Volume RTH First 60 Mins

** For those of you curious what it looks like here is the image. Also the extream bottom Volume Indicator is still work in progress, I am using Standard deviation, instead of AVG volumes, any suggestion would be welcome. Note: the Standard deviation Volumes Study is not posted yet.

IJ65CLE.png

Yet another Support/Resistance Indicator for DayTrading, but with a twist, We use high/low of High Volume Bar, in three different Zones of the Day.
With out further delay, Uploading the code here, will come back and edit this line with more appropriate description.

huge thanks to @cos251 for helping me with Coding this, Reviewing and Testing it.

Link to Video: https://www.screencast.com/users/Ma...10/media/f1702bb2-2090-463a-8ad2-59639c1166cd

vZone Extend On/Off
Shared Study Link: https://tos.mx/ke0f6ny Click here for --> Easiest way to load shared links
Ruby:
## vZoneSTUDY.ts
## This Indicator is based on the Following concept and, I suggest watch the video before you start to use this.
##
## https://www.screencast.com/users/MarketGauge/folders/DATE1010/media/f1702bb2-2090-463a-8ad2-59639c1166cd
## This is to Plot Support/Resistance based on High Volume Candle in three different time zones for the day.
##
## Removing the header Credit credits and description is not permitted, any modification needs to be shared.
## A big thanks to @COS251 for helping me with Coding this, Reviewing and Testing it.
##
## V 1.2 : No changes to the logic But just hints and header updates, also added a tiny URL for the video.
## V 1.1 : Just added the ability to disable the vZones, automatically, extending from previous in to current session.
##  Note : It is available as an option, should somebody prefer the extension. Set "Extend" to your needs accordingly.
## V 1.0 : Split Day in to three Zones and Find the highest Volume Candle for each zone and plot Support/Resistance.
##       :     Zone 1 : 09:30 - 11:00
##       :     Zone 2 : 11:00 - 14:00
##       :     Zone 3 : 14:00 - 16:00
##       :     vZones are Plotted on 15m and lower charts.
##       :  Plots EMA Cloud to assist with identifying reversals, Keeping EMA Clouds for all Timeframes
#hint: <b>vZoneStudy for Upper Chart.</b> \n <li> Suggestion, See the following Video</li> https://tinyurl.com/yzaxrf7e <li>Volume Based Support/Resistance for Intraday.</li>
#hint showEMACloud: <b>Helps find Reversal </b> <li>Select "No" if it is too loud on your charts.</li>
#hint audibleAlerts: <b>TOS Sounds for Condition </b> <li>Select "No" if it is too loud for you.</li>
#hint Extend: <b>Extend vZone Clouds from past session</b> <li>Select "No" if it is too loud for you.</li>
declare once_per_bar;

def Future = if GetSymbolPart(1) == "/YM:XCBT"  or # Reserved for any further work, not used at the moment other than display the label.
                GetSymbolPart(1) == "/ES:XCME"  or
                GetSymbolPart(1) == "/NQ:XCME"  or
                GetSymbolPart(1) == "/RTY:XCME" or
                GetSymbolPart(1) == "/EMD:XCME" or
                GetSymbolPart(1) == "/NKD:XCME" or
                GetSymbolPart(1) == “/DX:XICE"  or
                GetSymbolPart(1) == "/6E:XCME"  or
                GetSymbolPart(1) == "/6A:XCME"  or
                GetSymbolPart(1) == "/ZB:XCBT"  or
                GetSymbolPart(1) == "/ZN:XCBT"  or
                GetSymbolPart(1) == "/CL:XNYM"  or
                GetSymbolPart(1) == "/NG:XNYM"  or
                GetSymbolPart(1) == "/GC:XCEC"  or
                GetSymbolPart(1) == "/SI:XCEC"  or
                GetSymbolPart(1) == "/HG:XCEC”  or
                GetSymbolPart(1) == "/6B:XCME"  or
                GetSymbolPart(1) == "/ZC:XCBT"  or
                GetSymbolPart(1) == "/ZS:XCBT"  or
                GetSymbolPart(1) == "/CC:XICE"  or
                GetSymbolPart(1) == "/KC:XICE"  or
                GetSymbolPart(1) == ”/CT:XICE"  or
                GetSymbolPart(1) == "/ZW:XCBT"  or
                GetSymbolPart(1) == "/SB:XICE"  or
                GetSymbolPart(1) == "/LE:XCME"  or
                GetSymbolPart(1) == "/HO:XNYM"  or
                GetSymbolPart(1) == "/HE:XCME"  or
                GetSymbolPart(1) == "/OJ:XICE"  then yes else no;

AddLabel(if Future then yes else no, "Future", Color.YELLOW);

input   showEMACloud = Yes;
input  audibleAlerts = Yes;
input Extend = {default "No", "Yes"};

def Today = GetYYYYMMDD();
def StartTime = 0930;
def   Update1 = 1100;
def   Update2 = 1400;
def   EndTime = 1600;

def Zone1 = SecondsFromTime(StartTime) >= 0 and SecondsTillTime(Update1) >= 0;
def Zone2 =   SecondsFromTime(Update1) >= 0 and SecondsTillTime(Update2) >= 0;
def Zone3 =   SecondsFromTime(Update2) >= 0 and SecondsTillTime(EndTime) >= 0;

DefineGlobalColor("Zone1", CreateColor(204, 255, 225));
DefineGlobalColor("Zone2", CreateColor(252, 220, 101));
DefineGlobalColor("Zone3", CreateColor(204, 204, 198));
DefineGlobalColor( "EMA1+", CreateColor(201, 255, 234));
DefineGlobalColor( "EMA1-", CreateColor(255, 105, 105));
DefineGlobalColor( "EMA2+", CreateColor(125, 176, 130));
DefineGlobalColor( "EMA2-", CreateColor(194, 152, 227));
DefineGlobalColor( "EMA3+", CreateColor(161, 217, 247));
DefineGlobalColor( "EMA3-", CreateColor(255, 255, 112));

def  ema1low = 5;
def ema1high = 13;
def  ema2low = 34;
def ema2high = 51;
def  ema3low = 72;
def ema3high = 89;

def  ema5 = if showEMACloud then ExpAverage(close,  ema1low) else Double.NaN;
def ema13 = if showEMACloud then ExpAverage(close, ema1high) else Double.NaN;
def ema34 = if showEMACloud then ExpAverage(close,  ema2low) else Double.NaN;
def ema51 = if showEMACloud then ExpAverage(close, ema2high) else Double.NaN;
def ema72 = if showEMACloud then ExpAverage(close,  ema3low) else Double.NaN;
def ema89 = if showEMACloud then ExpAverage(close, ema3high) else Double.NaN;

AddCloud( ema5, ema13, GlobalColor("EMA1+"), GlobalColor("EMA1-"));
AddCloud(ema34, ema51, GlobalColor("EMA2+"), GlobalColor("EMA2-"));
AddCloud(ema72, ema89, GlobalColor("EMA3+"), GlobalColor("EMA3-"));

def CrossAbove = if showEMACloud and ema5 > ema89 and ema5[1] <= ema89[1] then 1 else 0;
def CrossBelow = if showEMACloud and ema5 < ema13 and ema5[1] >= ema13[1] then 1 else 0;

Alert(showEMACloud and audibleAlerts and CrossAbove, "Buy", Alert.BAR, Sound.Ding);
Alert(showEMACloud and audibleAlerts and CrossBelow, "Sell", Alert.BAR, Sound.Ring);

################################################################
##########         Booleans Set for Plot Use           #########
################################################################
def afterStart;
def beforeEnd;
def openPrice;
if GetAggregationPeriod() <= AggregationPeriod.THIRTY_MIN {
    afterStart = GetTime() > RegularTradingStart(GetYYYYMMDD());
    beforeEnd = GetTime() < RegularTradingEnd(GetYYYYMMDD());
    openPrice = DailyOpen();
} else {
    afterStart = Double.NaN;
    beforeEnd = Double.NaN;
    openPrice = Double.NaN;
}

script Zone {
    def H ;
    def L ;
    def V ;

    input CountIn = 0930;
    input CountOut = 1100;
    def TF = SecondsFromTime(CountIn) >= 0 and SecondsTillTime(CountOut) >= 0;

    if TF and !TF[1] {
        H = high;
        L = low;
        V = volume;
    } else if TF and volume > V[1] {
        H = high;
        L = low;
        V = volume;
    } else {
        H = H[1];
        L = L[1];
        V = V[1];
    }
  plot VZH = H;
  plot VZL = L;
  VZH.Hide();
  VZL.Hide();
}

def Z1H;
def Z1L;
def Z2H;
def Z2L;
def Z3H;
def Z3L;

switch (Extend){

Case "Yes":
 Z1H = Zone(CountIn = StartTime, CountOut = Update1).VZH;
 Z2H = Zone(CountIn =   Update1, CountOut = Update2).VZH;
 Z3H = Zone(CountIn =   Update2, CountOut = EndTime).VZH;

 Z1L = Zone(CountIn = StartTime, CountOut = Update1).VZL;
 Z2L = Zone(CountIn =   Update1, CountOut = Update2).VZL;
 Z3L = Zone(CountIn =   Update2, CountOut = EndTime).VZL;

Case "No":
 Z1H = if today != today[1] then Double.NaN else Zone(CountIn = StartTime, CountOut = Update1).VZH;
 Z2H = if today and  !Zone2 then Double.NaN else Zone(CountIn =   Update1, CountOut = Update2).VZH;
 Z3H = if today and  !Zone3 then Double.NaN else Zone(CountIn =   Update2, CountOut = EndTime).VZH;

 Z1L = if today != today[1] then Double.NaN else Zone(CountIn = StartTime, CountOut = Update1).VZL;
 Z2L = if today and  !Zone2 then Double.NaN else Zone(CountIn =   Update1, CountOut = Update2).VZL;
 Z3L = if today and  !Zone3 then Double.NaN else Zone(CountIn =   Update2, CountOut = EndTime).VZL;
}

def BelowVZ = if Zone1 and close < Z1L or Zone2 and close < Z2L or Zone3 and close < Z3L then 1 else 0;
def AboveVZ = if Zone1 and close > Z1H or Zone2 and close > Z2H or Zone3 and close > Z3H then 1 else 0;

AddLabel(if (GetAggregationPeriod() > AggregationPeriod.FIFTEEN_MIN) then yes else no, "vBox Zones on 5/10/15M Charts Only  ", Color.RED);

AddCloud(if afterStart and beforeEnd then Z1H else Double.NaN, if afterStart and beforeEnd then Z1L else Double.NaN, GlobalColor("Zone1"), GlobalColor("Zone1"));
AddCloud(if    Update1 and beforeEnd then Z2H else Double.NaN, if    Update1 and beforeEnd then Z2L else Double.NaN, GlobalColor("Zone2"), GlobalColor("Zone2"));
AddCloud(if    Update2 and beforeEnd then Z3H else Double.NaN, if    Update2 and beforeEnd then Z3L else Double.NaN, GlobalColor("Zone3"), GlobalColor("Zone3"));

Alert(audibleAlerts and AboveVZ, "Above High VolumeBar Caution Long", Alert.BAR, Sound.Ding);
Alert(audibleAlerts and BelowVZ, "Below High VolumeBar Look for Reversal", Alert.BAR, Sound.Ring);


vZone_Labels

Shared Study Link: https://tos.mx/kribwZB Click here for --> Easiest way to load shared links

Ruby:
##vZone_Labels
##This is Companian Indicator for vZone, which is based on the Following concept and, I suggest watch the video before you start to use this.
##
## https://www.screencast.com/users/MarketGauge/folders/DATE1010/media/f1702bb2-2090-463a-8ad2-59639c1166cd
## This is to Plot Support/Resistance based on High Volume Candle in three different time zones for the day.
##
## Removing the header Credit credits and description is not permitted, any modification needs to be shared.
## A big thanks to @COS251 for helping me with Coding this, Reviewing and Testing it.
##
# Version 1.0.2
#
# Created on 01/08/21
# Created by: SuryaKiranC ## Included rVolume label and Changed length as input.

#hint: <b>vZone_Labels Lower Study</b> \n Setup inputs as per your preferences \n <li>Replacement for Standard TOS Volume Bars, Disable VolumeSubgraph.</li>
#hint Length: <b>No of Bars for Average Calculation.</b> <li>Adjust as per your preference.</li>
#hint Barlength: <b>Near term No of Bars for Average Calculations.</b> <li>Adjust as per your preference.</li>
#hint ShowVolAvg: <b>Plot Vol Average across Volume Bars.</b> <li>Set "No" if this is not needed for you.</li>
#hint ShowPreMktVol: <b>Enable/Disable PreMkt Volume.</b> <li>Set "No" if this is not needed for you.</li>
#hint ShowZoneVol: <b>Enable/Disable Per Zone Volume.</b> <li>Set "No" if this is not needed for you.</li>
#hint ShowPostMktVol: <b>Enable/Disable PostMkt Volume.</b> <li>Set "No" if this is not needed for you.</li>

#hint ShowDayAvg: <b>Enable/Disable Average Volume of Days set in the Length above.</b> <li>Set "No" if this is not needed for you.</li>
#hint ShowTodayVolume: <b>Enable/Disable Today's Volume</b> <li>Set "No" if this is not needed for you.</li>
#hint ShowRvol: <b>Enable/Disable Relative Volume to Length Days</b> <li>Set "No" if this is not needed for you.</li>
#hint UnusualVolumePercent: <b>Define your own UnusualVolume, Typical Liquid Stock 110% and above.</b> <li>Set "No" if this is not needed for you.</li>
#hint ShowBarAvg: <b>Enable/Disable Average Bar volume, On Daily This is same as ShowDayAvg.</b> <li>Set "No" if this is not needed for you.</li>
#hint ShowCurrentBar: <b>Enable/Disable Current Bar Volume.</b> <li>Set "No" if this is not needed for you.</li>
#hint ShowPercentOfBarAvg: <b>Enable/Disable % if Volume, Compared to Days/Bar of Length </b> <li>Set "No" if this is not needed for you.</li>
#hint ShowBarsSell:  <b>Enable/Disable Sell Volume for length </b> <li>Set "No" if this is not needed for you.</li>
#hint Show6BarSell:  <b>Enable/Disable Sell Volume for Last 6 Bar </b> <li>Set "No" if this is not needed for you.</li>
#hint ShowSellVolume:<b>Enable/Disable Current Volume Sell Compared to length Bars </b> <li>Set "No" if this is not needed for you.</li>

#declare lower; # If you disable Volume subgraph and using as lower study uncomment this and comment the next one.
declare on_volume; #If you need to use only labels as a top study comment "Selling Volume" & "Buying Volume", along with this line with a "#" in-front of the line

DefineGlobalColor("Zone1", CreateColor(204, 255, 225));
DefineGlobalColor("Zone2", CreateColor(252, 220, 101));
DefineGlobalColor("Zone3", CreateColor(204, 204, 198));

input Length = 21;
input Barlength = 6;
input ShowVolAvg = Yes;

input  ShowPreMktVol = Yes;
input    ShowZoneVol = Yes;
input ShowPostMktVol = Yes;

def Zone1 = gettime() >= RegularTradingStart(GetYYYYMMDD()) and gettime() <= RegularTradingStart(GetYYYYMMDD()) + 90*60*1000;
def Zone2 = gettime()  > RegularTradingStart(GetYYYYMMDD()) + 90*60*1000 and gettime() <= RegularTradingEnd(GetYYYYMMDD())-120*60*1000;
def Zone3 = gettime()  > RegularTradingEnd(GetYYYYMMDD()) - 120*60*1000 and gettime() <= RegularTradingEnd(GetYYYYMMDD());

def startTime = 0930;
def   update1 = 1100;
def   update2 = 1400;
def   endTime = 1600;
def isNewDay = GetDay() == GetLastDay();
def yyyymmdd = GetYYYYMMDD();
def period = yyyymmdd;
def isPeriodRolled = CompoundValue(1, period != period[1], 1);
def sumVol = if isPeriodRolled then volume else CompoundValue(1, sumVol[1] + volume, volume);

######################### Current BAR ########################
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);

######################## 6BAR ################################
def HH6 = Average(high[1], Barlength);
def HC6 = Average(close[1], Barlength);
def HL6 = Average(low[1], Barlength);
def HV6 = Average(volume[1], Barlength);
def  Buy6 = HV6 * (HC6 - HL6) / (HH6 - HL6);
def Sell6 = HV6 * (HH6 - HC6) / (HH6 - HL6);

###################### 30BAR #################################
def HH30 = Average(high[1], Length);
def HC30 = Average(close[1], Length);
def HL30 = Average(low[1], Length);
def HV30 = Average(volume[1], Length);
def Buy30 = HV30 * (HC30 - HL30) / (HH30 - HL30);
def Sell30 = HV30 * (HH30 - HC30) / (HH30 - HL30);

###################### 6Bar Volume % #########################
def H6Vol = Round(Buy6, 0) + Round(Sell6, 0) ;
def H6buyPercent  = ( Round(Buy6, 0)  / H6Vol ) * 100;
def H6sellPercent = ( Round(Sell6, 0) / H6Vol ) * 100;

###################### 30Bar Volume %   ######################
def H30Vol = Round(Buy30, 0) + Round(Sell30, 0) ;
def H30buyPercent  = (Round(Buy30, 0)  / H30Vol) * 100;
def H30sellPercent = (Round(Sell30, 0) / H30Vol) * 100;

####################### Volume Stats #########################
def volDayAvg = Average(volume (Period = "DAY")[1],Length);
def DayVol = volume(period = "DAY");
def rVol = Round((DayVol / volDayAvg), 2);
def avgBars = Average(volume[1],Length);
def curVolume = volume;
def percentOfBars = Round((curVolume / avgBars) * 100, 0);
def SellVolPercent = Round((Selling / Volume) * 100, 0);

######################### Labels ##############################
input ShowDayAvg = yes;
input ShowTodayVolume = yes;
input ShowRvol = yes;
input UnusualVolumePercent = 110;
input ShowBarAvg = yes;
input ShowCurrentBar = yes;
input ShowPercentOfBarAvg = yes;

AddLabel(ShowDayAvg, Length+"D: " + Round(volDayAvg * .000001, 1) + " M ", Color.LIGHT_GRAY);
AddLabel(ShowTodayVolume, "D: " + Round(DayVol * .000001, 1) + " M ", (if rVol >= UnusualVolumePercent then Color.GREEN else if rVol >= 100 then Color.ORANGE else Color.LIGHT_GRAY));
AddLabel(ShowRvol,"rVol: " + rVol,(if rVol >= UnusualVolumePercent then Color.GREEN else if rVol >= 100 then Color.ORANGE else Color.WHITE));
AddLabel(ShowBarAvg, "30Bar: " + Round(avgBars * .001, 1) + " K ", Color.LIGHT_GRAY);
AddLabel(ShowCurrentBar, "CurBar: " + Round(curVolume * .001, 2) + " K ", (if percentOfBars >= UnusualVolumePercent then Color.GREEN else if percentOfBars >= 100 then Color.ORANGE else Color.LIGHT_GRAY));
AddLabel(ShowPercentOfBarAvg, percentOfBars + "%", (if percentOfBars >= UnusualVolumePercent then Color.GREEN else if percentOfBars >= 100 then Color.ORANGE else Color.WHITE) );

############################################ 30 Bar Stats ############################################
input ShowBarsSell = yes;
AddLabel(ShowBarsSell, length + "BarSell: " + Round(H30sellPercent, 0) + "% ", (if H30sellPercent > 55 then Color.RED else if H30sellPercent < 45 then Color.GREEN else Color.ORANGE));
############################################ 6 Bar Stats #############################################
input Show6BarSell = yes;
AddLabel(Show6BarSell, Barlength +"BarSell: " + Round(H6sellPercent, 0) + "% ", (if H6sellPercent > 55 then Color.RED else if H6sellPercent < 45 then Color.GREEN else Color.ORANGE));
############################################ Current Bar Stats ########################################
input ShowSellVolume = yes;
AddLabel(ShowSellVolume, "CurSell: " + Round(SellVolPercent, 0) + "% ", (if SellVolPercent > 51 then Color.RED else if SellVolPercent < 49 then Color.GREEN else Color.ORANGE));

##################### Selling Volume #####################
plot SVol = Selling;
SVol.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
SVol.SetDefaultColor(Color.DARK_ORANGE);
SVol.HideTitle();
SVol.HideBubble();
SVol.SetLineWeight(3);

##################### Buying Volume ######################
plot BVol = Buying;
BVol.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
BVol.SetDefaultColor(Color.LIGHT_GREEN);
BVol.HideTitle();
BVol.HideBubble();
BVol.SetLineWeight(3);

##################### Plots and Style ###################
plot Vol = volume;
plot VolAvg = Average(volume[1], Length);
VolAvg.SetHiding(!ShowVolAvg);
Vol.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Vol.SetLineWeight(3);
Vol.DefineColor("Up", Color.UPTICK);
Vol.DefineColor("Down", Color.DOWNTICK);
Vol.AssignValueColor(if close > close[1] then Vol.color("Up") else if close < close[1] then Vol.color("Down") else GetColor(1));
VolAvg.SetDefaultColor(GetColor(8));

def PreMkt = RegularTradingStart (GetYYYYMMDD()) > GetTime();
def PreVol = if PreMkt and !PreMkt[1] then volume else if PreMkt then PreVol[1] + volume else PreVol[1];
AddLabel(if GetAggregationPeriod() > AggregationPeriod.THIRTY_MIN or !ShowPreMktVol then 0 else 1, "PreMktVol = " + Round(PreVol * .000001, 3) + "M ", Color.YELLOW);

def RTH1Zone = SecondsFromTime(startTime) >= 0 and SecondsTillTime(update1) > 0;
def RTH1ZoneVol = if RTH1Zone and !RTH1Zone[1] then volume else if RTH1Zone then RTH1ZoneVol[1] + volume else RTH1ZoneVol[1];
AddLabel(if GetAggregationPeriod() > AggregationPeriod.THIRTY_MIN or !ShowZoneVol then 0 else 1, "Zone1Vol = " + Round(RTH1ZoneVol * .000001, 3) + "M ", GlobalColor("Zone1"));

def RTH2Zone = SecondsFromTime(update1) >= 0 and SecondsTillTime(update2) > 0;
def RTH2ZoneVol = if RTH2Zone and !RTH2Zone[1] then volume else if RTH2Zone then RTH2ZoneVol[1] + volume else RTH2ZoneVol[1];
AddLabel(if GetAggregationPeriod() > AggregationPeriod.THIRTY_MIN or !ShowZoneVol then 0 else 1, "Zone2Vol = " + Round(RTH2ZoneVol * .000001, 3) + "M ", GlobalColor("Zone2"));

def RTH3Zone = SecondsFromTime(update2) >= 0 and SecondsTillTime(endTime) > 0;
def RTH3ZoneVol = if RTH3Zone and !RTH3Zone[1] then volume else if RTH3Zone then RTH3ZoneVol[1] + volume else RTH3ZoneVol[1];
AddLabel(if GetAggregationPeriod() > AggregationPeriod.THIRTY_MIN or !ShowZoneVol then 0 else 1, "Zone3Vol = " + Round(RTH3ZoneVol * .000001, 3) + "M ", GlobalColor("Zone3"));

AddVerticalLine(if isNewDay and RTH1Zone == 0 and RTH1Zone[1] == 1 then yes else no, "             Zone 1  Mark", color = GlobalColor("Zone1"));
AddVerticalLine(if isNewDay and RTH2Zone == 0 and RTH2Zone[1] == 1 then yes else no, "             Zone 2  Mark", color = GlobalColor("Zone2"));
AddVerticalLine(if isNewDay and RTH3Zone == 0 and RTH3Zone[1] == 1 then yes else no, "             Zone 3  Mark", color = GlobalColor("Zone3"));

def PostMkt = RegularTradingEnd (GetYYYYMMDD()) < GetTime();
def PostVol = if PostMkt and !PostMkt[1] then volume else if PostMkt then PostVol[1] + volume else PostVol[1];
AddLabel(if GetAggregationPeriod() > AggregationPeriod.THIRTY_MIN or !ShowPostMktVol then 0 else 1, "PostMktVol = " + Round(PostVol * .000001, 3) + "M ", Color.YELLOW);
#End Volume RTH First 60 Mins

** For those of you curious what it looks like here is the image. Also the extream bottom Volume Indicator is still work in progress, I am using Standard deviation, instead of AVG volumes, any suggestion would be welcome. Note: the Standard deviation Volumes Study is not posted yet.

IJ65CLE.png
Sury, Thank you so much for the work you are doing and have done with this. I think this is one of the best indicators I have come across. Have you posted the bottom Indicator anywhere yet? Please let me know. Thank you!!! bobharding_1 @ yahoo.com
 
@3AMBH There are 2 versions of the bottom Indicators, (Volume Indicators), one that plots Buys/Sell volume and set Average line across them. Code for that is posted in the Comment 1 itself.

there is another version of the bottom Indicator, that I didn't post yet, I am plotting the Buy volume above 0 ('Zero') line and sell volume below. and using Standard deviation above/below the 0 line. I haven finished the theory on that yet and not posted the code for this.

-S
 
Yet another Support/Resistance Indicator for DayTrading, but with a twist, We use high/low of High Volume Bar, in three different Zones of the Day.
Hey SuryaKiranC, can you tell me how to take off the extend so it only shows for today's trading?
 
Last edited by a moderator:

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
469 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