NY, London, Asian Markets: ICT Time Labels For ThinkOrSwim

knapperhead

New member
Good afternoon,
I was wondering if one of you coding geniuses could help me make 3 labels, if it's even possible.
I would like labels that:
1) list the NY, London and Asia session times in CST. NY = 8:30-3:00, London = 3:00am-11:00am and Asia = 7:00 pm - 3:00 am
2) have the NY session lable turn green at designated times (8:50am- 9:10am, 9:50am - 10:10am and 10:50am - 11:10am) if that's not possible then just between 8:00am - 11:00am

Thank you, very much, for your time.
 

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

Here's a code that highlights the range for the Asian, London, NY AM, and NY PM sessions.

I need some assistance with extending each line until the end of the day.

Attached is the screenshot of what the code currently looks like. I really appreciate any help anyone can provide.
Ruby:
declare hide_on_daily;

input Show_Cloud = no;
input Show_Cloud2 = no;
input Show_Vertical_Line = no;

def Asian_DrawLine =
getLastDay() and
(
!secondsFromTime(1800) [1]
);

#AddVerticalLine (DrawLine, "", Color.Dark_black,Curve.Long_DASH);
AddVerticalLine (if Show_Vertical_Line then Asian_DrawLine else double.nan, "Asian", Color.black,Curve.Firm);


input ShowTodayOnly = yes;
def Today = if GetDay() == GetLastDay() then 0 else 1;
#def Today = if GetDay() == GetLastDay() then 1 else 0;
#def Show_last = if GetDay() >= GetLastDay() then 1 else 0;

###############################################
def midn = 0000;
def midnite = if (SecondsfromTime(midn) == 0) then 1 else 0;
###############################################


#############################################################################################################
#############################################################################################################

#Q1
def Asian_Q1_afterbegin = 1800;
#def Asian_Q1_afterend = 2359;
def Asian_Q1_aftermarket = SecondsFromTime(Asian_Q1_afterbegin[1]) >= 0 and (SecondsfromTime(midn) == 0) >= 0;
def Asian_Q1_bars = 2000;

#input Asian_Q1_pricePerRowHeightMode = { AUTOMATIC, default TICKSIZE, CUSTOM};
input Asian_Q1_pricePerRowHeightMode = { TICKSIZE, default AUTOMATIC, CUSTOM};

def Asian_Q1_customRowHeight = 1.0;
input Asian_Q1_timePerProfile = {default BAR};
def Asian_Q1_onExpansion = no;
def Asian_Q1_profiles = 1000;

def Asian_Q1_period;

switch (Asian_Q1_timePerProfile) {
case BAR:
Asian_Q1_period = BarNumber() - 1;
}


def Asian_Q1_count = CompoundValue(1, if Asian_Q1_aftermarket and Asian_Q1_period != Asian_Q1_period[1] then (Asian_Q1_count[1] + Asian_Q1_period - Asian_Q1_period[1]) % Asian_Q1_bars else Asian_Q1_count[1], 0);
def Asian_Q1_cond = Asian_Q1_count < Asian_Q1_count[1] + Asian_Q1_period - Asian_Q1_period[1];
def Asian_Q1_height;
switch (Asian_Q1_pricePerRowHeightMode) {
case AUTOMATIC:
Asian_Q1_height = PricePerRow.AUTOMATIC;
case TICKSIZE:
Asian_Q1_height = PricePerRow.TICKSIZE;
case CUSTOM:
Asian_Q1_height = Asian_Q1_customRowHeight;
}

profile Asian_Q1_vol = VolumeProfile("startNewProfile" = Asian_Q1_cond, "onExpansion" = no, "numberOfProfiles" = 1000, "pricePerRow" = Asian_Q1_height, "value area percent" = 0);

def Asian_Q1_con = CompoundValue(1, Asian_Q1_onExpansion, no);

def Asian_Q1_hProfile = if Asian_Q1_aftermarket and IsNaN(Asian_Q1_vol.GetHighest()) and Asian_Q1_con then Asian_Q1_hProfile[1] else Asian_Q1_vol.GetHighest();
def Asian_Q1_lProfile = if Asian_Q1_aftermarket and IsNaN(Asian_Q1_vol.GetLowest()) and Asian_Q1_con then Asian_Q1_lProfile[1] else Asian_Q1_vol.GetLowest();
def Asian_Q1_plotsDomain = IsNaN(close) == Asian_Q1_onExpansion;
def Asian_Q1_ProfileHigh = if Asian_Q1_aftermarket and Asian_Q1_plotsDomain then Asian_Q1_hProfile else Double.NaN;
def Asian_Q1_ProfileLow = if Asian_Q1_aftermarket and Asian_Q1_plotsDomain then Asian_Q1_lProfile else Double.NaN;

plot Asian_Q1_hrange = Asian_Q1_ProfileHigh;
plot Asian_Q1_lrange = Asian_Q1_ProfileLow;
Asian_Q1_hrange.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
Asian_Q1_lrange.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
Asian_Q1_hrange.SetDefaultColor(createcolor(204, 255, 204));
Asian_Q1_lrange.SetDefaultColor(createcolor(204, 255, 204));
Asian_Q1_hrange.SetLineWeight(1);
Asian_Q1_lrange.SetLineWeight(1);
#Asian_Q1_hrange.Hide();
#Asian_Q1_lrange.Hide();

def Asian_Q1_bubblemover = 0;
def Asian_Q1_b = Asian_Q1_bubblemover;
def Asian_Q1_b1 = Asian_Q1_b + 1;


input Asian_Q1_showbubbles = no;
AddChartBubble(Asian_Q1_showbubbles and (IsNaN(Asian_Q1_hrange[Asian_Q1_b1]) and Asian_Q1_hrange[Asian_Q1_b]) , Asian_Q1_hrange, AsText(Asian_Q1_hrange), Color.LIGHT_Red);

AddChartBubble(Asian_Q1_showbubbles and (IsNaN(Asian_Q1_hrange[Asian_Q1_b1]) and Asian_Q1_hrange[Asian_Q1_b]) , Asian_Q1_lrange, AsText(Asian_Q1_lrange), Color.LIGHT_Green, up = no);

input Asian_Q1_showverticalline = no;
AddVerticalLine(Asian_Q1_showverticalline and Asian_Q1_hrange != Asian_Q1_hrange[1], "", Color.BLUE, stroke = Curve.FIRM);

#Addcloud(hrange, lrange, createcolor(0, 51, 51), createcolor(0, 51, 51));
Addcloud(if Show_Cloud then Asian_Q1_hrange else double.nan, Asian_Q1_lrange, createcolor(204, 255, 204), createcolor(204, 255, 204));

Addcloud(if Show_Cloud2 then Asian_Q1_hrange else double.nan, Asian_Q1_lrange, color.black, color.black);

#Addcloud(Asian_Q1_hrange, Asian_Q1_lrange, color.black, color.black);


###############################################################
###############################################################
###############################################################
#LONDON

def London_Q2_afterbegin = midn;
def London_Q2_afterend = 0600;
def London_Q2_aftermarket = SecondsFromTime(London_Q2_afterbegin) >= 0 and SecondsTillTime(London_Q2_afterend) >= 0;
def London_Q2_bars = 2000;

#input London_Q2_pricePerRowHeightMode = { AUTOMATIC, default TICKSIZE, CUSTOM};
input London_Q2_pricePerRowHeightMode = { TICKSIZE, default AUTOMATIC, CUSTOM};

def London_Q2_customRowHeight = 1.0;
input London_Q2_timePerProfile = {default BAR};
def London_Q2_onExpansion = no;
def London_Q2_profiles = 1000;

def London_Q2_period;

switch (London_Q2_timePerProfile) {
case BAR:
London_Q2_period = BarNumber() - 1;
}


def London_Q2_count = CompoundValue(1, if London_Q2_aftermarket and London_Q2_period != London_Q2_period[1] then (London_Q2_count[1] + London_Q2_period - London_Q2_period[1]) % London_Q2_bars else London_Q2_count[1], 0);
def London_Q2_cond = London_Q2_count < London_Q2_count[1] + London_Q2_period - London_Q2_period[1];
def London_Q2_height;
switch (London_Q2_pricePerRowHeightMode) {
case AUTOMATIC:
London_Q2_height = PricePerRow.AUTOMATIC;
case TICKSIZE:
London_Q2_height = PricePerRow.TICKSIZE;
case CUSTOM:
London_Q2_height = London_Q2_customRowHeight;
}

profile London_Q2_vol = VolumeProfile("startNewProfile" = London_Q2_cond, "onExpansion" = no, "numberOfProfiles" = 1000, "pricePerRow" = London_Q2_height, "value area percent" = 0);

def London_Q2_con = CompoundValue(1, London_Q2_onExpansion, no);

def London_Q2_hProfile = if London_Q2_aftermarket and IsNaN(London_Q2_vol.GetHighest()) and London_Q2_con then London_Q2_hProfile[1] else London_Q2_vol.GetHighest();
def London_Q2_lProfile = if London_Q2_aftermarket and IsNaN(London_Q2_vol.GetLowest()) and London_Q2_con then London_Q2_lProfile[1] else London_Q2_vol.GetLowest();
def London_Q2_plotsDomain = IsNaN(close) == London_Q2_onExpansion;
def London_Q2_ProfileHigh = if London_Q2_aftermarket and London_Q2_plotsDomain then London_Q2_hProfile else Double.NaN;
def London_Q2_ProfileLow = if London_Q2_aftermarket and London_Q2_plotsDomain then London_Q2_lProfile else Double.NaN;

plot London_Q2_hrange = London_Q2_ProfileHigh;
plot London_Q2_lrange = London_Q2_ProfileLow;
London_Q2_hrange.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
London_Q2_lrange.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
London_Q2_hrange.SetDefaultColor(createcolor(153, 153 ,255));
London_Q2_lrange.SetDefaultColor(createcolor(153, 153 ,255));
London_Q2_hrange.SetLineWeight(1);
London_Q2_lrange.SetLineWeight(1);
#London_Q2_hrange.Hide();
#London_Q2_lrange.Hide();

def London_Q2_bubblemover = 0;
def London_Q2_b = London_Q2_bubblemover;
def London_Q2_b1 = London_Q2_b + 1;


input London_Q2_showbubbles = no;
AddChartBubble(London_Q2_showbubbles and (IsNaN(London_Q2_hrange[London_Q2_b1]) and London_Q2_hrange[London_Q2_b]) , London_Q2_hrange, AsText(London_Q2_hrange), Color.LIGHT_Red);

AddChartBubble(London_Q2_showbubbles and (IsNaN(London_Q2_hrange[London_Q2_b1]) and London_Q2_hrange[London_Q2_b]) , London_Q2_lrange, AsText(London_Q2_lrange), Color.LIGHT_Green, up = no);

input London_Q2_showverticalline = no;
AddVerticalLine(London_Q2_showverticalline and London_Q2_hrange != London_Q2_hrange[1], "", Color.BLUE, stroke = Curve.FIRM);

#Addcloud(hrange, lrange, createcolor(0, 51, 51), createcolor(0, 51, 51));
Addcloud(if Show_Cloud then London_Q2_hrange else double.nan, London_Q2_lrange, createcolor(153, 153 ,255), createcolor(153, 153 ,255));

Addcloud(if Show_Cloud2 then London_Q2_hrange else double.nan, London_Q2_lrange, color.black, color.black);


#Addcloud(London_Q2_hrange, London_Q2_lrange, color.black, color.black);

#############################################################################################################
#############################################################################################################

#############################################################################################################
#############################################################################################################
def NY_DrawLine =
getDay() == getLastDay() and
(
!secondsFromTime(0600)
);

#AddVerticalLine (DrawLine, "", Color.Dark_black,Curve.Long_DASH);
AddVerticalLine (if Show_Vertical_Line then NY_Drawline else double.nan, "NY AM", Color.black,Curve.Firm);

def Show_last = if GetDay() == GetLastDay() then 1 else 0;

#############################################################################################################
#############################################################################################################

#Q3
def NY_Q3_afterbegin = 0600;
def NY_Q3_afterend = 1200;
def NY_Q3_aftermarket = SecondsFromTime(NY_Q3_afterbegin) >= 0 and SecondsTillTime(NY_Q3_afterend) >= 0;
def NY_Q3_bars = 2000;

#input NY_Q3_pricePerRowHeightMode = { AUTOMATIC, default TICKSIZE, CUSTOM};
input NY_Q3_pricePerRowHeightMode = { TICKSIZE, default AUTOMATIC, CUSTOM};

def NY_Q3_customRowHeight = 1.0;
input NY_Q3_timePerProfile = {default BAR};
def NY_Q3_onExpansion = no;
def NY_Q3_profiles = 1000;

def NY_Q3_period;

switch (NY_Q3_timePerProfile) {
case BAR:
NY_Q3_period = BarNumber() - 1;
}


def NY_Q3_count = CompoundValue(1, if NY_Q3_aftermarket and NY_Q3_period != NY_Q3_period[1] then (NY_Q3_count[1] + NY_Q3_period - NY_Q3_period[1]) % NY_Q3_bars else NY_Q3_count[1], 0);
def NY_Q3_cond = NY_Q3_count < NY_Q3_count[1] + NY_Q3_period - NY_Q3_period[1];
def NY_Q3_height;
switch (NY_Q3_pricePerRowHeightMode) {
case AUTOMATIC:
NY_Q3_height = PricePerRow.AUTOMATIC;
case TICKSIZE:
NY_Q3_height = PricePerRow.TICKSIZE;
case CUSTOM:
NY_Q3_height = NY_Q3_customRowHeight;
}

profile NY_Q3_vol = VolumeProfile("startNewProfile" = NY_Q3_cond, "onExpansion" = no, "numberOfProfiles" = 1000, "pricePerRow" = NY_Q3_height, "value area percent" = 0);

def NY_Q3_con = CompoundValue(1, NY_Q3_onExpansion, no);

def NY_Q3_hProfile = if NY_Q3_aftermarket and IsNaN(NY_Q3_vol.GetHighest()) and NY_Q3_con then NY_Q3_hProfile[1] else NY_Q3_vol.GetHighest();
def NY_Q3_lProfile = if NY_Q3_aftermarket and IsNaN(NY_Q3_vol.GetLowest()) and NY_Q3_con then NY_Q3_lProfile[1] else NY_Q3_vol.GetLowest();
def NY_Q3_plotsDomain = IsNaN(close) == NY_Q3_onExpansion;
def NY_Q3_ProfileHigh = if NY_Q3_aftermarket and NY_Q3_plotsDomain then NY_Q3_hProfile else Double.NaN;
def NY_Q3_ProfileLow = if NY_Q3_aftermarket and NY_Q3_plotsDomain then NY_Q3_lProfile else Double.NaN;

plot NY_Q3_hrange = NY_Q3_ProfileHigh;
plot NY_Q3_lrange = NY_Q3_ProfileLow;
NY_Q3_hrange.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
NY_Q3_lrange.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
NY_Q3_hrange.SetDefaultColor(createcolor(0, 153, 255));
NY_Q3_lrange.SetDefaultColor(createcolor(0, 153, 255));
NY_Q3_hrange.SetLineWeight(1);
NY_Q3_lrange.SetLineWeight(1);
#NY_Q3_hrange.Hide();
#NY_Q3_lrange.Hide();

def NY_Q3_bubblemover = 0;
def NY_Q3_b = NY_Q3_bubblemover;
def NY_Q3_b1 = NY_Q3_b + 1;


input NY_Q3_showbubbles = no;
AddChartBubble(NY_Q3_showbubbles and (IsNaN(NY_Q3_hrange[NY_Q3_b1]) and NY_Q3_hrange[NY_Q3_b]) , NY_Q3_hrange, AsText(NY_Q3_hrange), Color.LIGHT_Red);

AddChartBubble(NY_Q3_showbubbles and (IsNaN(NY_Q3_hrange[NY_Q3_b1]) and NY_Q3_hrange[NY_Q3_b]) , NY_Q3_lrange, AsText(NY_Q3_lrange), Color.LIGHT_Green, up = no);

input NY_Q3_showverticalline = no;
AddVerticalLine(NY_Q3_showverticalline and NY_Q3_hrange != NY_Q3_hrange[1], "", Color.BLUE, stroke = Curve.FIRM);

#Addcloud(hrange, lrange, createcolor(0, 51, 51), createcolor(0, 51, 51));
Addcloud(if Show_Cloud then NY_Q3_hrange else double.nan, NY_Q3_lrange, createcolor(0, 153, 255), createcolor(0, 153, 255));

Addcloud(if Show_Cloud2 then NY_Q3_hrange else double.nan, NY_Q3_lrange, color.black, color.black);

#Addcloud(NY_Q3_hrange, NY_Q3_lrange, color.black, color.black);

#############################################################################################################
#############################################################################################################

def NY_PM_DrawLine =
getDay() == getLastDay() and
(
!secondsFromTime(1200)
);

#AddVerticalLine (DrawLine, "", Color.Dark_black,Curve.Long_DASH);
AddVerticalLine (if Show_Vertical_Line then NY_PM_DrawLine else double.nan, "NY PM", Color.black,Curve.Firm);



#############################################################################################################
#############################################################################################################

#Q4
def NY_PM_Q4_afterbegin = 1200;
def NY_PM_Q4_afterend = 1800;
def NY_PM_Q4_aftermarket = SecondsFromTime(NY_PM_Q4_afterbegin) >= 0 and SecondsTillTime(NY_PM_Q4_afterend) >= 0;
def NY_PM_Q4_bars = 2000;

#input NY_PM_Q4_pricePerRowHeightMode = { AUTOMATIC, default TICKSIZE, CUSTOM};
input NY_PM_Q4_pricePerRowHeightMode = { TICKSIZE, default AUTOMATIC, CUSTOM};

def NY_PM_Q4_customRowHeight = 1.0;
input NY_PM_Q4_timePerProfile = {default BAR};
def NY_PM_Q4_onExpansion = no;
def NY_PM_Q4_profiles = 1000;

def NY_PM_Q4_period;

switch (NY_PM_Q4_timePerProfile) {
case BAR:
NY_PM_Q4_period = BarNumber() - 1;
}


def NY_PM_Q4_count = CompoundValue(1, if NY_PM_Q4_aftermarket and NY_PM_Q4_period != NY_PM_Q4_period[1] then (NY_PM_Q4_count[1] + NY_PM_Q4_period - NY_PM_Q4_period[1]) % NY_PM_Q4_bars else NY_PM_Q4_count[1], 0);
def NY_PM_Q4_cond = NY_PM_Q4_count < NY_PM_Q4_count[1] + NY_PM_Q4_period - NY_PM_Q4_period[1];
def NY_PM_Q4_height;
switch (NY_PM_Q4_pricePerRowHeightMode) {
case AUTOMATIC:
NY_PM_Q4_height = PricePerRow.AUTOMATIC;
case TICKSIZE:
NY_PM_Q4_height = PricePerRow.TICKSIZE;
case CUSTOM:
NY_PM_Q4_height = NY_PM_Q4_customRowHeight;
}

profile NY_PM_Q4_vol = VolumeProfile("startNewProfile" = NY_PM_Q4_cond, "onExpansion" = no, "numberOfProfiles" = 1000, "pricePerRow" = NY_PM_Q4_height, "value area percent" = 0);

def NY_PM_Q4_con = CompoundValue(1, NY_PM_Q4_onExpansion, no);

def NY_PM_Q4_hProfile = if NY_PM_Q4_aftermarket and IsNaN(NY_PM_Q4_vol.GetHighest()) and NY_PM_Q4_con then NY_PM_Q4_hProfile[1] else NY_PM_Q4_vol.GetHighest();
def NY_PM_Q4_lProfile = if NY_PM_Q4_aftermarket and IsNaN(NY_PM_Q4_vol.GetLowest()) and NY_PM_Q4_con then NY_PM_Q4_lProfile[1] else NY_PM_Q4_vol.GetLowest();
def NY_PM_Q4_plotsDomain = IsNaN(close) == NY_PM_Q4_onExpansion;
def NY_PM_Q4_ProfileHigh = if NY_PM_Q4_aftermarket and NY_PM_Q4_plotsDomain then NY_PM_Q4_hProfile else Double.NaN;
def NY_PM_Q4_ProfileLow = if NY_PM_Q4_aftermarket and NY_PM_Q4_plotsDomain then NY_PM_Q4_lProfile else Double.NaN;

plot NY_PM_Q4_hrange = NY_PM_Q4_ProfileHigh;
plot NY_PM_Q4_lrange = NY_PM_Q4_ProfileLow;
NY_PM_Q4_hrange.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
NY_PM_Q4_lrange.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
NY_PM_Q4_hrange.SetDefaultColor(createcolor(255, 153, 102));
NY_PM_Q4_lrange.SetDefaultColor(createcolor(255, 153, 102));
NY_PM_Q4_hrange.SetLineWeight(1);
NY_PM_Q4_lrange.SetLineWeight(1);
#NY_PM_Q4_hrange.Hide();
#NY_PM_Q4_lrange.Hide();

def NY_PM_Q4_bubblemover = 0;
def NY_PM_Q4_b = NY_PM_Q4_bubblemover;
def NY_PM_Q4_b1 = NY_PM_Q4_b + 1;


input NY_PM_Q4_showbubbles = no;
AddChartBubble(NY_PM_Q4_showbubbles and (IsNaN(NY_PM_Q4_hrange[NY_PM_Q4_b1]) and NY_PM_Q4_hrange[NY_PM_Q4_b]) , NY_PM_Q4_hrange, AsText(NY_PM_Q4_hrange), Color.LIGHT_Red);

AddChartBubble(NY_PM_Q4_showbubbles and (IsNaN(NY_PM_Q4_hrange[NY_PM_Q4_b1]) and NY_PM_Q4_hrange[NY_PM_Q4_b]) , NY_PM_Q4_lrange, AsText(NY_PM_Q4_lrange), Color.LIGHT_Green, up = no);

input NY_PM_Q4_showverticalline = no;
AddVerticalLine(NY_PM_Q4_showverticalline and NY_PM_Q4_hrange != NY_PM_Q4_hrange[1], "", Color.BLUE, stroke = Curve.FIRM);

#Addcloud(hrange, lrange, createcolor(0, 51, 51), createcolor(0, 51, 51));
Addcloud(if Show_Cloud then NY_PM_Q4_hrange else double.nan, NY_PM_Q4_lrange, createcolor(255, 153, 102), createcolor(255, 153, 102));

Addcloud(if Show_Cloud2 then NY_PM_Q4_hrange else double.nan, NY_PM_Q4_lrange, color.black, color.black);

#Addcloud(NY_PM_Q4_hrange, NY_PM_Q4_lrange, color.black, color.black);

#############################################################################################################
#############################################################################################################
Screenshot 2023-06-27 115215.png
 
Last edited by a moderator:
Here's a code that highlights the range for the Asian, London, NY AM, and NY PM sessions.

I need some assistance with extending each line until the end of the day.

Attached is the screenshot of what the code currently looks like. I really appreciate any help anyone can provide.
Ruby:
declare hide_on_daily;

input Show_Cloud = no;
input Show_Cloud2 = no;
input Show_Vertical_Line = no;

def Asian_DrawLine =
getLastDay() and
(
!secondsFromTime(1800) [1]
);

#AddVerticalLine (DrawLine, "", Color.Dark_black,Curve.Long_DASH);
AddVerticalLine (if Show_Vertical_Line then Asian_DrawLine else double.nan, "Asian", Color.black,Curve.Firm);


input ShowTodayOnly = yes;
def Today = if GetDay() == GetLastDay() then 0 else 1;
#def Today = if GetDay() == GetLastDay() then 1 else 0;
#def Show_last = if GetDay() >= GetLastDay() then 1 else 0;

###############################################
def midn = 0000;
def midnite = if (SecondsfromTime(midn) == 0) then 1 else 0;
###############################################


#############################################################################################################
#############################################################################################################

#Q1
def Asian_Q1_afterbegin = 1800;
#def Asian_Q1_afterend = 2359;
def Asian_Q1_aftermarket = SecondsFromTime(Asian_Q1_afterbegin[1]) >= 0 and (SecondsfromTime(midn) == 0) >= 0;
def Asian_Q1_bars = 2000;

#input Asian_Q1_pricePerRowHeightMode = { AUTOMATIC, default TICKSIZE, CUSTOM};
input Asian_Q1_pricePerRowHeightMode = { TICKSIZE, default AUTOMATIC, CUSTOM};

def Asian_Q1_customRowHeight = 1.0;
input Asian_Q1_timePerProfile = {default BAR};
def Asian_Q1_onExpansion = no;
def Asian_Q1_profiles = 1000;

def Asian_Q1_period;

switch (Asian_Q1_timePerProfile) {
case BAR:
Asian_Q1_period = BarNumber() - 1;
}


def Asian_Q1_count = CompoundValue(1, if Asian_Q1_aftermarket and Asian_Q1_period != Asian_Q1_period[1] then (Asian_Q1_count[1] + Asian_Q1_period - Asian_Q1_period[1]) % Asian_Q1_bars else Asian_Q1_count[1], 0);
def Asian_Q1_cond = Asian_Q1_count < Asian_Q1_count[1] + Asian_Q1_period - Asian_Q1_period[1];
def Asian_Q1_height;
switch (Asian_Q1_pricePerRowHeightMode) {
case AUTOMATIC:
Asian_Q1_height = PricePerRow.AUTOMATIC;
case TICKSIZE:
Asian_Q1_height = PricePerRow.TICKSIZE;
case CUSTOM:
Asian_Q1_height = Asian_Q1_customRowHeight;
}

profile Asian_Q1_vol = VolumeProfile("startNewProfile" = Asian_Q1_cond, "onExpansion" = no, "numberOfProfiles" = 1000, "pricePerRow" = Asian_Q1_height, "value area percent" = 0);

def Asian_Q1_con = CompoundValue(1, Asian_Q1_onExpansion, no);

def Asian_Q1_hProfile = if Asian_Q1_aftermarket and IsNaN(Asian_Q1_vol.GetHighest()) and Asian_Q1_con then Asian_Q1_hProfile[1] else Asian_Q1_vol.GetHighest();
def Asian_Q1_lProfile = if Asian_Q1_aftermarket and IsNaN(Asian_Q1_vol.GetLowest()) and Asian_Q1_con then Asian_Q1_lProfile[1] else Asian_Q1_vol.GetLowest();
def Asian_Q1_plotsDomain = IsNaN(close) == Asian_Q1_onExpansion;
def Asian_Q1_ProfileHigh = if Asian_Q1_aftermarket and Asian_Q1_plotsDomain then Asian_Q1_hProfile else Double.NaN;
def Asian_Q1_ProfileLow = if Asian_Q1_aftermarket and Asian_Q1_plotsDomain then Asian_Q1_lProfile else Double.NaN;

plot Asian_Q1_hrange = Asian_Q1_ProfileHigh;
plot Asian_Q1_lrange = Asian_Q1_ProfileLow;
Asian_Q1_hrange.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
Asian_Q1_lrange.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
Asian_Q1_hrange.SetDefaultColor(createcolor(204, 255, 204));
Asian_Q1_lrange.SetDefaultColor(createcolor(204, 255, 204));
Asian_Q1_hrange.SetLineWeight(1);
Asian_Q1_lrange.SetLineWeight(1);
#Asian_Q1_hrange.Hide();
#Asian_Q1_lrange.Hide();

def Asian_Q1_bubblemover = 0;
def Asian_Q1_b = Asian_Q1_bubblemover;
def Asian_Q1_b1 = Asian_Q1_b + 1;


input Asian_Q1_showbubbles = no;
AddChartBubble(Asian_Q1_showbubbles and (IsNaN(Asian_Q1_hrange[Asian_Q1_b1]) and Asian_Q1_hrange[Asian_Q1_b]) , Asian_Q1_hrange, AsText(Asian_Q1_hrange), Color.LIGHT_Red);

AddChartBubble(Asian_Q1_showbubbles and (IsNaN(Asian_Q1_hrange[Asian_Q1_b1]) and Asian_Q1_hrange[Asian_Q1_b]) , Asian_Q1_lrange, AsText(Asian_Q1_lrange), Color.LIGHT_Green, up = no);

input Asian_Q1_showverticalline = no;
AddVerticalLine(Asian_Q1_showverticalline and Asian_Q1_hrange != Asian_Q1_hrange[1], "", Color.BLUE, stroke = Curve.FIRM);

#Addcloud(hrange, lrange, createcolor(0, 51, 51), createcolor(0, 51, 51));
Addcloud(if Show_Cloud then Asian_Q1_hrange else double.nan, Asian_Q1_lrange, createcolor(204, 255, 204), createcolor(204, 255, 204));

Addcloud(if Show_Cloud2 then Asian_Q1_hrange else double.nan, Asian_Q1_lrange, color.black, color.black);

#Addcloud(Asian_Q1_hrange, Asian_Q1_lrange, color.black, color.black);


###############################################################
###############################################################
###############################################################
#LONDON

def London_Q2_afterbegin = midn;
def London_Q2_afterend = 0600;
def London_Q2_aftermarket = SecondsFromTime(London_Q2_afterbegin) >= 0 and SecondsTillTime(London_Q2_afterend) >= 0;
def London_Q2_bars = 2000;

#input London_Q2_pricePerRowHeightMode = { AUTOMATIC, default TICKSIZE, CUSTOM};
input London_Q2_pricePerRowHeightMode = { TICKSIZE, default AUTOMATIC, CUSTOM};

def London_Q2_customRowHeight = 1.0;
input London_Q2_timePerProfile = {default BAR};
def London_Q2_onExpansion = no;
def London_Q2_profiles = 1000;

def London_Q2_period;

switch (London_Q2_timePerProfile) {
case BAR:
London_Q2_period = BarNumber() - 1;
}


def London_Q2_count = CompoundValue(1, if London_Q2_aftermarket and London_Q2_period != London_Q2_period[1] then (London_Q2_count[1] + London_Q2_period - London_Q2_period[1]) % London_Q2_bars else London_Q2_count[1], 0);
def London_Q2_cond = London_Q2_count < London_Q2_count[1] + London_Q2_period - London_Q2_period[1];
def London_Q2_height;
switch (London_Q2_pricePerRowHeightMode) {
case AUTOMATIC:
London_Q2_height = PricePerRow.AUTOMATIC;
case TICKSIZE:
London_Q2_height = PricePerRow.TICKSIZE;
case CUSTOM:
London_Q2_height = London_Q2_customRowHeight;
}

profile London_Q2_vol = VolumeProfile("startNewProfile" = London_Q2_cond, "onExpansion" = no, "numberOfProfiles" = 1000, "pricePerRow" = London_Q2_height, "value area percent" = 0);

def London_Q2_con = CompoundValue(1, London_Q2_onExpansion, no);

def London_Q2_hProfile = if London_Q2_aftermarket and IsNaN(London_Q2_vol.GetHighest()) and London_Q2_con then London_Q2_hProfile[1] else London_Q2_vol.GetHighest();
def London_Q2_lProfile = if London_Q2_aftermarket and IsNaN(London_Q2_vol.GetLowest()) and London_Q2_con then London_Q2_lProfile[1] else London_Q2_vol.GetLowest();
def London_Q2_plotsDomain = IsNaN(close) == London_Q2_onExpansion;
def London_Q2_ProfileHigh = if London_Q2_aftermarket and London_Q2_plotsDomain then London_Q2_hProfile else Double.NaN;
def London_Q2_ProfileLow = if London_Q2_aftermarket and London_Q2_plotsDomain then London_Q2_lProfile else Double.NaN;

plot London_Q2_hrange = London_Q2_ProfileHigh;
plot London_Q2_lrange = London_Q2_ProfileLow;
London_Q2_hrange.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
London_Q2_lrange.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
London_Q2_hrange.SetDefaultColor(createcolor(153, 153 ,255));
London_Q2_lrange.SetDefaultColor(createcolor(153, 153 ,255));
London_Q2_hrange.SetLineWeight(1);
London_Q2_lrange.SetLineWeight(1);
#London_Q2_hrange.Hide();
#London_Q2_lrange.Hide();

def London_Q2_bubblemover = 0;
def London_Q2_b = London_Q2_bubblemover;
def London_Q2_b1 = London_Q2_b + 1;


input London_Q2_showbubbles = no;
AddChartBubble(London_Q2_showbubbles and (IsNaN(London_Q2_hrange[London_Q2_b1]) and London_Q2_hrange[London_Q2_b]) , London_Q2_hrange, AsText(London_Q2_hrange), Color.LIGHT_Red);

AddChartBubble(London_Q2_showbubbles and (IsNaN(London_Q2_hrange[London_Q2_b1]) and London_Q2_hrange[London_Q2_b]) , London_Q2_lrange, AsText(London_Q2_lrange), Color.LIGHT_Green, up = no);

input London_Q2_showverticalline = no;
AddVerticalLine(London_Q2_showverticalline and London_Q2_hrange != London_Q2_hrange[1], "", Color.BLUE, stroke = Curve.FIRM);

#Addcloud(hrange, lrange, createcolor(0, 51, 51), createcolor(0, 51, 51));
Addcloud(if Show_Cloud then London_Q2_hrange else double.nan, London_Q2_lrange, createcolor(153, 153 ,255), createcolor(153, 153 ,255));

Addcloud(if Show_Cloud2 then London_Q2_hrange else double.nan, London_Q2_lrange, color.black, color.black);


#Addcloud(London_Q2_hrange, London_Q2_lrange, color.black, color.black);

#############################################################################################################
#############################################################################################################

#############################################################################################################
#############################################################################################################
def NY_DrawLine =
getDay() == getLastDay() and
(
!secondsFromTime(0600)
);

#AddVerticalLine (DrawLine, "", Color.Dark_black,Curve.Long_DASH);
AddVerticalLine (if Show_Vertical_Line then NY_Drawline else double.nan, "NY AM", Color.black,Curve.Firm);

def Show_last = if GetDay() == GetLastDay() then 1 else 0;

#############################################################################################################
#############################################################################################################

#Q3
def NY_Q3_afterbegin = 0600;
def NY_Q3_afterend = 1200;
def NY_Q3_aftermarket = SecondsFromTime(NY_Q3_afterbegin) >= 0 and SecondsTillTime(NY_Q3_afterend) >= 0;
def NY_Q3_bars = 2000;

#input NY_Q3_pricePerRowHeightMode = { AUTOMATIC, default TICKSIZE, CUSTOM};
input NY_Q3_pricePerRowHeightMode = { TICKSIZE, default AUTOMATIC, CUSTOM};

def NY_Q3_customRowHeight = 1.0;
input NY_Q3_timePerProfile = {default BAR};
def NY_Q3_onExpansion = no;
def NY_Q3_profiles = 1000;

def NY_Q3_period;

switch (NY_Q3_timePerProfile) {
case BAR:
NY_Q3_period = BarNumber() - 1;
}


def NY_Q3_count = CompoundValue(1, if NY_Q3_aftermarket and NY_Q3_period != NY_Q3_period[1] then (NY_Q3_count[1] + NY_Q3_period - NY_Q3_period[1]) % NY_Q3_bars else NY_Q3_count[1], 0);
def NY_Q3_cond = NY_Q3_count < NY_Q3_count[1] + NY_Q3_period - NY_Q3_period[1];
def NY_Q3_height;
switch (NY_Q3_pricePerRowHeightMode) {
case AUTOMATIC:
NY_Q3_height = PricePerRow.AUTOMATIC;
case TICKSIZE:
NY_Q3_height = PricePerRow.TICKSIZE;
case CUSTOM:
NY_Q3_height = NY_Q3_customRowHeight;
}

profile NY_Q3_vol = VolumeProfile("startNewProfile" = NY_Q3_cond, "onExpansion" = no, "numberOfProfiles" = 1000, "pricePerRow" = NY_Q3_height, "value area percent" = 0);

def NY_Q3_con = CompoundValue(1, NY_Q3_onExpansion, no);

def NY_Q3_hProfile = if NY_Q3_aftermarket and IsNaN(NY_Q3_vol.GetHighest()) and NY_Q3_con then NY_Q3_hProfile[1] else NY_Q3_vol.GetHighest();
def NY_Q3_lProfile = if NY_Q3_aftermarket and IsNaN(NY_Q3_vol.GetLowest()) and NY_Q3_con then NY_Q3_lProfile[1] else NY_Q3_vol.GetLowest();
def NY_Q3_plotsDomain = IsNaN(close) == NY_Q3_onExpansion;
def NY_Q3_ProfileHigh = if NY_Q3_aftermarket and NY_Q3_plotsDomain then NY_Q3_hProfile else Double.NaN;
def NY_Q3_ProfileLow = if NY_Q3_aftermarket and NY_Q3_plotsDomain then NY_Q3_lProfile else Double.NaN;

plot NY_Q3_hrange = NY_Q3_ProfileHigh;
plot NY_Q3_lrange = NY_Q3_ProfileLow;
NY_Q3_hrange.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
NY_Q3_lrange.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
NY_Q3_hrange.SetDefaultColor(createcolor(0, 153, 255));
NY_Q3_lrange.SetDefaultColor(createcolor(0, 153, 255));
NY_Q3_hrange.SetLineWeight(1);
NY_Q3_lrange.SetLineWeight(1);
#NY_Q3_hrange.Hide();
#NY_Q3_lrange.Hide();

def NY_Q3_bubblemover = 0;
def NY_Q3_b = NY_Q3_bubblemover;
def NY_Q3_b1 = NY_Q3_b + 1;


input NY_Q3_showbubbles = no;
AddChartBubble(NY_Q3_showbubbles and (IsNaN(NY_Q3_hrange[NY_Q3_b1]) and NY_Q3_hrange[NY_Q3_b]) , NY_Q3_hrange, AsText(NY_Q3_hrange), Color.LIGHT_Red);

AddChartBubble(NY_Q3_showbubbles and (IsNaN(NY_Q3_hrange[NY_Q3_b1]) and NY_Q3_hrange[NY_Q3_b]) , NY_Q3_lrange, AsText(NY_Q3_lrange), Color.LIGHT_Green, up = no);

input NY_Q3_showverticalline = no;
AddVerticalLine(NY_Q3_showverticalline and NY_Q3_hrange != NY_Q3_hrange[1], "", Color.BLUE, stroke = Curve.FIRM);

#Addcloud(hrange, lrange, createcolor(0, 51, 51), createcolor(0, 51, 51));
Addcloud(if Show_Cloud then NY_Q3_hrange else double.nan, NY_Q3_lrange, createcolor(0, 153, 255), createcolor(0, 153, 255));

Addcloud(if Show_Cloud2 then NY_Q3_hrange else double.nan, NY_Q3_lrange, color.black, color.black);

#Addcloud(NY_Q3_hrange, NY_Q3_lrange, color.black, color.black);

#############################################################################################################
#############################################################################################################

def NY_PM_DrawLine =
getDay() == getLastDay() and
(
!secondsFromTime(1200)
);

#AddVerticalLine (DrawLine, "", Color.Dark_black,Curve.Long_DASH);
AddVerticalLine (if Show_Vertical_Line then NY_PM_DrawLine else double.nan, "NY PM", Color.black,Curve.Firm);



#############################################################################################################
#############################################################################################################

#Q4
def NY_PM_Q4_afterbegin = 1200;
def NY_PM_Q4_afterend = 1800;
def NY_PM_Q4_aftermarket = SecondsFromTime(NY_PM_Q4_afterbegin) >= 0 and SecondsTillTime(NY_PM_Q4_afterend) >= 0;
def NY_PM_Q4_bars = 2000;

#input NY_PM_Q4_pricePerRowHeightMode = { AUTOMATIC, default TICKSIZE, CUSTOM};
input NY_PM_Q4_pricePerRowHeightMode = { TICKSIZE, default AUTOMATIC, CUSTOM};

def NY_PM_Q4_customRowHeight = 1.0;
input NY_PM_Q4_timePerProfile = {default BAR};
def NY_PM_Q4_onExpansion = no;
def NY_PM_Q4_profiles = 1000;

def NY_PM_Q4_period;

switch (NY_PM_Q4_timePerProfile) {
case BAR:
NY_PM_Q4_period = BarNumber() - 1;
}


def NY_PM_Q4_count = CompoundValue(1, if NY_PM_Q4_aftermarket and NY_PM_Q4_period != NY_PM_Q4_period[1] then (NY_PM_Q4_count[1] + NY_PM_Q4_period - NY_PM_Q4_period[1]) % NY_PM_Q4_bars else NY_PM_Q4_count[1], 0);
def NY_PM_Q4_cond = NY_PM_Q4_count < NY_PM_Q4_count[1] + NY_PM_Q4_period - NY_PM_Q4_period[1];
def NY_PM_Q4_height;
switch (NY_PM_Q4_pricePerRowHeightMode) {
case AUTOMATIC:
NY_PM_Q4_height = PricePerRow.AUTOMATIC;
case TICKSIZE:
NY_PM_Q4_height = PricePerRow.TICKSIZE;
case CUSTOM:
NY_PM_Q4_height = NY_PM_Q4_customRowHeight;
}

profile NY_PM_Q4_vol = VolumeProfile("startNewProfile" = NY_PM_Q4_cond, "onExpansion" = no, "numberOfProfiles" = 1000, "pricePerRow" = NY_PM_Q4_height, "value area percent" = 0);

def NY_PM_Q4_con = CompoundValue(1, NY_PM_Q4_onExpansion, no);

def NY_PM_Q4_hProfile = if NY_PM_Q4_aftermarket and IsNaN(NY_PM_Q4_vol.GetHighest()) and NY_PM_Q4_con then NY_PM_Q4_hProfile[1] else NY_PM_Q4_vol.GetHighest();
def NY_PM_Q4_lProfile = if NY_PM_Q4_aftermarket and IsNaN(NY_PM_Q4_vol.GetLowest()) and NY_PM_Q4_con then NY_PM_Q4_lProfile[1] else NY_PM_Q4_vol.GetLowest();
def NY_PM_Q4_plotsDomain = IsNaN(close) == NY_PM_Q4_onExpansion;
def NY_PM_Q4_ProfileHigh = if NY_PM_Q4_aftermarket and NY_PM_Q4_plotsDomain then NY_PM_Q4_hProfile else Double.NaN;
def NY_PM_Q4_ProfileLow = if NY_PM_Q4_aftermarket and NY_PM_Q4_plotsDomain then NY_PM_Q4_lProfile else Double.NaN;

plot NY_PM_Q4_hrange = NY_PM_Q4_ProfileHigh;
plot NY_PM_Q4_lrange = NY_PM_Q4_ProfileLow;
NY_PM_Q4_hrange.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
NY_PM_Q4_lrange.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
NY_PM_Q4_hrange.SetDefaultColor(createcolor(255, 153, 102));
NY_PM_Q4_lrange.SetDefaultColor(createcolor(255, 153, 102));
NY_PM_Q4_hrange.SetLineWeight(1);
NY_PM_Q4_lrange.SetLineWeight(1);
#NY_PM_Q4_hrange.Hide();
#NY_PM_Q4_lrange.Hide();

def NY_PM_Q4_bubblemover = 0;
def NY_PM_Q4_b = NY_PM_Q4_bubblemover;
def NY_PM_Q4_b1 = NY_PM_Q4_b + 1;


input NY_PM_Q4_showbubbles = no;
AddChartBubble(NY_PM_Q4_showbubbles and (IsNaN(NY_PM_Q4_hrange[NY_PM_Q4_b1]) and NY_PM_Q4_hrange[NY_PM_Q4_b]) , NY_PM_Q4_hrange, AsText(NY_PM_Q4_hrange), Color.LIGHT_Red);

AddChartBubble(NY_PM_Q4_showbubbles and (IsNaN(NY_PM_Q4_hrange[NY_PM_Q4_b1]) and NY_PM_Q4_hrange[NY_PM_Q4_b]) , NY_PM_Q4_lrange, AsText(NY_PM_Q4_lrange), Color.LIGHT_Green, up = no);

input NY_PM_Q4_showverticalline = no;
AddVerticalLine(NY_PM_Q4_showverticalline and NY_PM_Q4_hrange != NY_PM_Q4_hrange[1], "", Color.BLUE, stroke = Curve.FIRM);

#Addcloud(hrange, lrange, createcolor(0, 51, 51), createcolor(0, 51, 51));
Addcloud(if Show_Cloud then NY_PM_Q4_hrange else double.nan, NY_PM_Q4_lrange, createcolor(255, 153, 102), createcolor(255, 153, 102));

Addcloud(if Show_Cloud2 then NY_PM_Q4_hrange else double.nan, NY_PM_Q4_lrange, color.black, color.black);

#Addcloud(NY_PM_Q4_hrange, NY_PM_Q4_lrange, color.black, color.black);

#############################################################################################################
#############################################################################################################
View attachment 18986
SJP07 Have you got this script to work....extending lines? Plus it would be cool if you could add the lunch hour trade levels.
 
Last edited by a moderator:
SJP07 Have you got this script to work....extending lines? Plus it would be cool if you could add the lunch hour trade levels.

Hi @Mytrades1979, I found a way to extend the lines and have updated the script. I've also marked the lunch time range. Please let me know if you need any further assistance.

Code:
###############################################
#Asian
def midn = 0000;
def midnite = if (SecondsFromTime(midn) == 0) then 1 else 0;

def Asian_afterbegin = 1800;
#def Asian_Q1_afterend   = 2359;
def Asian_aftermarket =  SecondsFromTime(Asian_afterbegin[1]) >= 0 and (SecondsFromTime(midn) == 0) >= 0;

#DefineGlobalColor("Asian Color", (CreateColor(204, 255, 204)));
DefineGlobalColor("Asian Color", (color.White));
#AddLabel(yes, "Asian", (GlobalColor("Asian Color")));

###############################################

#LONDON
def London_afterbegin = midn;
def London_afterend   = 0600;
def London_aftermarket =  SecondsFromTime(London_afterbegin) >= 0 and SecondsTillTime(London_afterend) >= 0;
DefineGlobalColor("London Color", (CreateColor(153, 153 ,255)));
#AddLabel(yes, "London", (GlobalColor("London Color")));

###############################################
#NY AM
def NY_AM_afterbegin = 0600;
def NY_AM_afterend   = 1200;
def NY_AM_aftermarket =  SecondsFromTime(NY_AM_afterbegin) >= 0 and SecondsTillTime(NY_AM_afterend) >= 0;

DefineGlobalColor("NY_AM Color", (CreateColor(0, 153, 255)));
#AddLabel(yes, "NY_AM", (GlobalColor("NY_Lunch Color")));

###############################################
#NY Lunch
def NY_Lunch_afterbegin = 1100;
def NY_Lunch_afterend   = 1300;
def NY_Lunch_aftermarket =  SecondsFromTime(NY_Lunch_afterbegin) >= 0 and SecondsTillTime(NY_Lunch_afterend) >= 0;

DefineGlobalColor("NY_Lunch Color", (CreateColor(255, 153, 102)));
#AddLabel(yes, "NY_Lunch", (GlobalColor("NY_PM Color")));
###############################################

###############################################
#NY PM
def NY_PM_afterbegin = 1200;
def NY_PM_afterend   = 1800;
def NY_PM_aftermarket =  SecondsFromTime(NY_PM_afterbegin) >= 0 and SecondsTillTime(NY_PM_afterend) >= 0;

DefineGlobalColor("NY_PM Color", (CreateColor(255, 153, 102)));
#AddLabel(yes, "NY_PM", (GlobalColor("NY_PM Color")));
###############################################

declare hide_on_daily;
input PlotOverNightExtremes = yes;
input DisplayPriceBubbleOnHiLowBar = yes;
input DisplayPriceBubbleOnRightEdge = yes;  #Haven't figured this out yet..JQ
def numberOfTicks = 1;

#############################################################################################################################################
def Asian_o = open;
def Asian_h = high;
def Asian_l = low;
def Asian_c = close;
def Asian_v = volume;
def Asian_bar = BarNumber();



#Asian Code
def Asian_GlobeX =  Asian_aftermarket;

def Asian_vol = if Asian_GlobeX and !Asian_GlobeX[1]
then Asian_v
else if Asian_GlobeX
then Asian_vol[1] + Asian_v
else Double.NaN;

def Asian_GlobeX_Volume = Asian_vol;

def Asian_ONhigh = if Asian_GlobeX and !Asian_GlobeX[1]
then Asian_h
else if Asian_GlobeX and
Asian_h > Asian_ONhigh[1]
then Asian_h
else Asian_ONhigh[1];

def Asian_ONhighBar = if Asian_GlobeX and Asian_h == Asian_ONhigh
then Asian_bar
else Double.NaN;

def Asian_ONlow = if Asian_GlobeX and !Asian_GlobeX[1]
then Asian_l
else if Asian_GlobeX and
Asian_l < Asian_ONlow[1]
then Asian_l
else Asian_ONlow[1];

def Asian_ONlowBar = if Asian_GlobeX and Asian_l == Asian_ONlow
then Asian_bar
else Double.NaN;

def Asian_OverNightHigh = if BarNumber() == HighestAll(Asian_ONhighBar)
then Asian_ONhigh
else Asian_OverNightHigh[1];

def Asian_OverNightLow = if BarNumber() == HighestAll(Asian_ONlowBar)
then Asian_ONlow
else Asian_OverNightLow[1];


#
plot Asian_ONH = if Asian_OverNightHigh > 0
then Asian_OverNightHigh
else Double.NaN;

Asian_ONH.SetHiding(!PlotOverNightExtremes);
#ONH.SetPaintingStrategy(PaintingStrategy.SQUARES);
#ONH.SetDefaultColor(Color.Light_Gray);
Asian_ONH.SetDefaultColor(GlobalColor("Asian Color"));
#ONH.HideBubble();
#ONH.HideTitle();
#ONH.Hide();

#
plot Asian_ONL = if Asian_OverNightLow > 0
then Asian_OverNightLow
else Double.NaN;

Asian_ONL.SetHiding(!PlotOverNightExtremes);
#ONL.SetPaintingStrategy(PaintingStrategy.SQUARES);
#ONL.SetDefaultColor(Color.Light_Gray);
Asian_ONL.SetDefaultColor(GlobalColor("Asian Color"));
#ONL.Hide();

def Asian_High_plus_tick = Asian_ONH + numberOfTicks * TickSize();
def Asian_Low_plus_tick = Asian_ONL - numberOfTicks * TickSize();

#AddCloud(Asian_High_plus_tick,  Asian_ONH,  GlobalColor("Asian Color"),  GlobalColor("Asian Color"));
#AddCloud(Asian_Low_plus_tick,  Asian_ONL,  GlobalColor("Asian Color"),  GlobalColor("Asian Color"));

#############################################################################################################################################
#London Code
def London_o = open;
def London_h = high;
def London_l = low;
def London_c = close;
def London_v = volume;
def London_bar = BarNumber();


def London_GlobeX =  London_aftermarket;

def London_vol = if London_GlobeX and !London_GlobeX[1]
then London_v
else if London_GlobeX
then London_vol[1] + London_v
else Double.NaN;

def London_GlobeX_Volume = London_vol;

def London_ONhigh = if London_GlobeX and !London_GlobeX[1]
then London_h
else if London_GlobeX and
London_h > London_ONhigh[1]
then London_h
else London_ONhigh[1];

def London_ONhighBar = if London_GlobeX and London_h == London_ONhigh
then London_bar
else Double.NaN;

def London_ONlow = if London_GlobeX and !London_GlobeX[1]
then London_l
else if London_GlobeX and
London_l < London_ONlow[1]
then London_l
else London_ONlow[1];

def London_ONlowBar = if London_GlobeX and London_l == London_ONlow
then London_bar
else Double.NaN;

def London_OverNightHigh = if BarNumber() == HighestAll(London_ONhighBar)
then London_ONhigh
else London_OverNightHigh[1];

def London_OverNightLow = if BarNumber() == HighestAll(London_ONlowBar)
then London_ONlow
else London_OverNightLow[1];


#
plot London_ONH = if London_OverNightHigh > 0
then London_OverNightHigh
else Double.NaN;

London_ONH.SetHiding(!PlotOverNightExtremes);
#ONH.SetPaintingStrategy(PaintingStrategy.SQUARES);
#ONH.SetDefaultColor(Color.Light_Gray);
London_ONH.SetDefaultColor(GlobalColor("London Color"));
#ONH.HideBubble();
#ONH.HideTitle();
#ONH.Hide();

#
plot London_ONL = if London_OverNightLow > 0
then London_OverNightLow
else Double.NaN;

London_ONL.SetHiding(!PlotOverNightExtremes);
#ONL.SetPaintingStrategy(PaintingStrategy.SQUARES);
#ONL.SetDefaultColor(Color.Light_Gray);
London_ONL.SetDefaultColor(GlobalColor("London Color"));
#ONL.Hide();

def London_High_plus_tick = London_ONH + numberOfTicks * TickSize();
def London_Low_plus_tick = London_ONL - numberOfTicks * TickSize();

#AddCloud(London_High_plus_tick,  London_ONH,  GlobalColor("London Color"),  GlobalColor("London Color"));
#AddCloud(London_Low_plus_tick,  London_ONL,  GlobalColor("London Color"),  GlobalColor("London Color"));

#############################################################################################################################################
#NY_AM Code
def NY_AM_o = open;
def NY_AM_h = high;
def NY_AM_l = low;
def NY_AM_c = close;
def NY_AM_v = volume;
def NY_AM_bar = BarNumber();


def NY_AM_GlobeX =  NY_AM_aftermarket;

def NY_AM_vol = if NY_AM_GlobeX and !NY_AM_GlobeX[1]
then NY_AM_v
else if NY_AM_GlobeX
then NY_AM_vol[1] + NY_AM_v
else Double.NaN;

def NY_AM_GlobeX_Volume = NY_AM_vol;

def NY_AM_ONhigh = if NY_AM_GlobeX and !NY_AM_GlobeX[1]
then NY_AM_h
else if NY_AM_GlobeX and
NY_AM_h > NY_AM_ONhigh[1]
then NY_AM_h
else NY_AM_ONhigh[1];

def NY_AM_ONhighBar = if NY_AM_GlobeX and NY_AM_h == NY_AM_ONhigh
then NY_AM_bar
else Double.NaN;

def NY_AM_ONlow = if NY_AM_GlobeX and !NY_AM_GlobeX[1]
then NY_AM_l
else if NY_AM_GlobeX and
NY_AM_l < NY_AM_ONlow[1]
then NY_AM_l
else NY_AM_ONlow[1];

def NY_AM_ONlowBar = if NY_AM_GlobeX and NY_AM_l == NY_AM_ONlow
then NY_AM_bar
else Double.NaN;

def NY_AM_OverNightHigh = if BarNumber() == HighestAll(NY_AM_ONhighBar)
then NY_AM_ONhigh
else NY_AM_OverNightHigh[1];

def NY_AM_OverNightLow = if BarNumber() == HighestAll(NY_AM_ONlowBar)
then NY_AM_ONlow
else NY_AM_OverNightLow[1];


#
plot NY_AM_ONH = if NY_AM_OverNightHigh > 0
then NY_AM_OverNightHigh
else Double.NaN;

NY_AM_ONH.SetHiding(!PlotOverNightExtremes);
#ONH.SetPaintingStrategy(PaintingStrategy.SQUARES);
#ONH.SetDefaultColor(Color.Light_Gray);
NY_AM_ONH.SetDefaultColor(GlobalColor("NY_AM Color"));
#ONH.HideBubble();
#ONH.HideTitle();
NY_AM_ONH.Hide();

#
plot NY_AM_ONL = if NY_AM_OverNightLow > 0
then NY_AM_OverNightLow
else Double.NaN;

NY_AM_ONL.SetHiding(!PlotOverNightExtremes);
#ONL.SetPaintingStrategy(PaintingStrategy.SQUARES);
#ONL.SetDefaultColor(Color.Light_Gray);
NY_AM_ONL.SetDefaultColor(GlobalColor("NY_AM Color"));
NY_AM_ONL.Hide();

def NY_AM_High_plus_tick = NY_AM_ONH + numberOfTicks * TickSize();
def NY_AM_Low_plus_tick = NY_AM_ONL - numberOfTicks * TickSize();

#AddCloud(NY_AM_High_plus_tick,  NY_AM_ONH,  GlobalColor("NY_AM Color"),  GlobalColor("NY_AM Color"));
#AddCloud(NY_AM_Low_plus_tick,  NY_AM_ONL,  GlobalColor("NY_AM Color"),  GlobalColor("NY_AM Color"));
#############################################################################################################################################
#############################################################################################################################################
#NY_Lunch Code
def NY_Lunch_o = open;
def NY_Lunch_h = high;
def NY_Lunch_l = low;
def NY_Lunch_c = close;
def NY_Lunch_v = volume;
def NY_Lunch_bar = BarNumber();


def NY_Lunch_GlobeX =  NY_Lunch_aftermarket;

def NY_Lunch_vol = if NY_Lunch_GlobeX and !NY_Lunch_GlobeX[1]
then NY_Lunch_v
else if NY_Lunch_GlobeX
then NY_Lunch_vol[1] + NY_Lunch_v
else Double.NaN;

def NY_Lunch_GlobeX_Volume = NY_Lunch_vol;

def NY_Lunch_ONhigh = if NY_Lunch_GlobeX and !NY_Lunch_GlobeX[1]
then NY_Lunch_h
else if NY_Lunch_GlobeX and
NY_Lunch_h > NY_Lunch_ONhigh[1]
then NY_Lunch_h
else NY_Lunch_ONhigh[1];

def NY_Lunch_ONhighBar = if NY_Lunch_GlobeX and NY_Lunch_h == NY_Lunch_ONhigh
then NY_Lunch_bar
else Double.NaN;

def NY_Lunch_ONlow = if NY_Lunch_GlobeX and !NY_Lunch_GlobeX[1]
then NY_Lunch_l
else if NY_Lunch_GlobeX and
NY_Lunch_l < NY_Lunch_ONlow[1]
then NY_Lunch_l
else NY_Lunch_ONlow[1];

def NY_Lunch_ONlowBar = if NY_Lunch_GlobeX and NY_Lunch_l == NY_Lunch_ONlow
then NY_Lunch_bar
else Double.NaN;

def NY_Lunch_OverNightHigh = if BarNumber() == HighestAll(NY_Lunch_ONhighBar)
then NY_Lunch_ONhigh
else NY_Lunch_OverNightHigh[1];

def NY_Lunch_OverNightLow = if BarNumber() == HighestAll(NY_Lunch_ONlowBar)
then NY_Lunch_ONlow
else NY_Lunch_OverNightLow[1];


#
plot NY_Lunch_ONH = if NY_Lunch_OverNightHigh > 0
then NY_Lunch_OverNightHigh
else Double.NaN;

NY_Lunch_ONH.SetHiding(!PlotOverNightExtremes);
#ONH.SetPaintingStrategy(PaintingStrategy.SQUARES);
#ONH.SetDefaultColor(Color.Light_Gray);
NY_Lunch_ONH.SetDefaultColor(GlobalColor("NY_Lunch Color"));
#ONH.HideBubble();
#ONH.HideTitle();
#NY_Lunch_ONH.Hide();

#
plot NY_Lunch_ONL = if NY_Lunch_OverNightLow > 0
then NY_Lunch_OverNightLow
else Double.NaN;

NY_Lunch_ONL.SetHiding(!PlotOverNightExtremes);
#ONL.SetPaintingStrategy(PaintingStrategy.SQUARES);
#ONL.SetDefaultColor(Color.Light_Gray);
NY_Lunch_ONL.SetDefaultColor(GlobalColor("NY_Lunch Color"));
#NY_Lunch_ONL.Hide();

def NY_Lunch_High_plus_tick = NY_Lunch_ONH + numberOfTicks * TickSize();
def NY_Lunch_Low_plus_tick = NY_Lunch_ONL - numberOfTicks * TickSize();

#AddCloud(NY_Lunch_High_plus_tick,  NY_Lunch_ONH,  GlobalColor("NY_Lunch Color"),  GlobalColor("NY_Lunch Color"));
#AddCloud(NY_Lunch_Low_plus_tick,  NY_Lunch_ONL,  GlobalColor("NY_Lunch Color"),  GlobalColor("NY_Lunch Color"));
#############################################################################################################################################
#NY_PM Code
def NY_PM_o = open;
def NY_PM_h = high;
def NY_PM_l = low;
def NY_PM_c = close;
def NY_PM_v = volume;
def NY_PM_bar = BarNumber();


def NY_PM_GlobeX =  NY_PM_aftermarket;

def NY_PM_vol = if NY_PM_GlobeX and !NY_PM_GlobeX[1]
then NY_PM_v
else if NY_PM_GlobeX
then NY_PM_vol[1] + NY_PM_v
else Double.NaN;

def NY_PM_GlobeX_Volume = NY_PM_vol;

def NY_PM_ONhigh = if NY_PM_GlobeX and !NY_PM_GlobeX[1]
then NY_PM_h
else if NY_PM_GlobeX and
NY_PM_h > NY_PM_ONhigh[1]
then NY_PM_h
else NY_PM_ONhigh[1];

def NY_PM_ONhighBar = if NY_PM_GlobeX and NY_PM_h == NY_PM_ONhigh
then NY_PM_bar
else Double.NaN;

def NY_PM_ONlow = if NY_PM_GlobeX and !NY_PM_GlobeX[1]
then NY_PM_l
else if NY_PM_GlobeX and
NY_PM_l < NY_PM_ONlow[1]
then NY_PM_l
else NY_PM_ONlow[1];

def NY_PM_ONlowBar = if NY_PM_GlobeX and NY_PM_l == NY_PM_ONlow
then NY_PM_bar
else Double.NaN;

def NY_PM_OverNightHigh = if BarNumber() == HighestAll(NY_PM_ONhighBar)
then NY_PM_ONhigh
else NY_PM_OverNightHigh[1];

def NY_PM_OverNightLow = if BarNumber() == HighestAll(NY_PM_ONlowBar)
then NY_PM_ONlow
else NY_PM_OverNightLow[1];


#
plot NY_PM_ONH = if NY_PM_OverNightHigh > 0
then NY_PM_OverNightHigh
else Double.NaN;

NY_PM_ONH.SetHiding(!PlotOverNightExtremes);
#ONH.SetPaintingStrategy(PaintingStrategy.SQUARES);
#ONH.SetDefaultColor(Color.Light_Gray);
NY_PM_ONH.SetDefaultColor(GlobalColor("NY_PM Color"));
#ONH.HideBubble();
#ONH.HideTitle();
#NY_PM_ONH.Hide();

#
plot NY_PM_ONL = if NY_PM_OverNightLow > 0
then NY_PM_OverNightLow
else Double.NaN;

NY_PM_ONL.SetHiding(!PlotOverNightExtremes);
#ONL.SetPaintingStrategy(PaintingStrategy.SQUARES);
#ONL.SetDefaultColor(Color.Light_Gray);
NY_PM_ONL.SetDefaultColor(GlobalColor("NY_PM Color"));
#NY_PM_ONL.Hide();

def NY_PM_High_plus_tick = NY_PM_ONH + numberOfTicks * TickSize();
def NY_PM_Low_plus_tick = NY_PM_ONL - numberOfTicks * TickSize();

#AddCloud(NY_PM_High_plus_tick,  NY_PM_ONH,  GlobalColor("NY_PM Color"),  GlobalColor("NY_PM Color"));
#AddCloud(NY_PM_Low_plus_tick,  NY_PM_ONL,  GlobalColor("NY_PM Color"),  GlobalColor("NY_PM Color"));
#
 
Last edited by a moderator:
Hi @Mytrades1979, I found a way to extend the lines and have updated the script. I've also marked the lunch time range. Please let me know if you need any further assistance.


###############################################
#Asian
def midn = 0000;
def midnite = if (SecondsFromTime(midn) == 0) then 1 else 0;

def Asian_afterbegin = 1800;
#def Asian_Q1_afterend = 2359;
def Asian_aftermarket = SecondsFromTime(Asian_afterbegin[1]) >= 0 and (SecondsFromTime(midn) == 0) >= 0;

#DefineGlobalColor("Asian Color", (CreateColor(204, 255, 204)));
DefineGlobalColor("Asian Color", (color.White));
#AddLabel(yes, "Asian", (GlobalColor("Asian Color")));

###############################################

#LONDON
def London_afterbegin = midn;
def London_afterend = 0600;
def London_aftermarket = SecondsFromTime(London_afterbegin) >= 0 and SecondsTillTime(London_afterend) >= 0;
DefineGlobalColor("London Color", (CreateColor(153, 153 ,255)));
#AddLabel(yes, "London", (GlobalColor("London Color")));

###############################################
#NY AM
def NY_AM_afterbegin = 0600;
def NY_AM_afterend = 1200;
def NY_AM_aftermarket = SecondsFromTime(NY_AM_afterbegin) >= 0 and SecondsTillTime(NY_AM_afterend) >= 0;

DefineGlobalColor("NY_AM Color", (CreateColor(0, 153, 255)));
#AddLabel(yes, "NY_AM", (GlobalColor("NY_Lunch Color")));

###############################################
#NY Lunch
def NY_Lunch_afterbegin = 1100;
def NY_Lunch_afterend = 1300;
def NY_Lunch_aftermarket = SecondsFromTime(NY_Lunch_afterbegin) >= 0 and SecondsTillTime(NY_Lunch_afterend) >= 0;

DefineGlobalColor("NY_Lunch Color", (CreateColor(255, 153, 102)));
#AddLabel(yes, "NY_Lunch", (GlobalColor("NY_PM Color")));
###############################################

###############################################
#NY PM
def NY_PM_afterbegin = 1200;
def NY_PM_afterend = 1800;
def NY_PM_aftermarket = SecondsFromTime(NY_PM_afterbegin) >= 0 and SecondsTillTime(NY_PM_afterend) >= 0;

DefineGlobalColor("NY_PM Color", (CreateColor(255, 153, 102)));
#AddLabel(yes, "NY_PM", (GlobalColor("NY_PM Color")));
###############################################

declare hide_on_daily;
input PlotOverNightExtremes = yes;
input DisplayPriceBubbleOnHiLowBar = yes;
input DisplayPriceBubbleOnRightEdge = yes; #Haven't figured this out yet..JQ
def numberOfTicks = 1;

#############################################################################################################################################
def Asian_o = open;
def Asian_h = high;
def Asian_l = low;
def Asian_c = close;
def Asian_v = volume;
def Asian_bar = BarNumber();



#Asian Code
def Asian_GlobeX = Asian_aftermarket;

def Asian_vol = if Asian_GlobeX and !Asian_GlobeX[1]
then Asian_v
else if Asian_GlobeX
then Asian_vol[1] + Asian_v
else Double.NaN;

def Asian_GlobeX_Volume = Asian_vol;

def Asian_ONhigh = if Asian_GlobeX and !Asian_GlobeX[1]
then Asian_h
else if Asian_GlobeX and
Asian_h > Asian_ONhigh[1]
then Asian_h
else Asian_ONhigh[1];

def Asian_ONhighBar = if Asian_GlobeX and Asian_h == Asian_ONhigh
then Asian_bar
else Double.NaN;

def Asian_ONlow = if Asian_GlobeX and !Asian_GlobeX[1]
then Asian_l
else if Asian_GlobeX and
Asian_l < Asian_ONlow[1]
then Asian_l
else Asian_ONlow[1];

def Asian_ONlowBar = if Asian_GlobeX and Asian_l == Asian_ONlow
then Asian_bar
else Double.NaN;

def Asian_OverNightHigh = if BarNumber() == HighestAll(Asian_ONhighBar)
then Asian_ONhigh
else Asian_OverNightHigh[1];

def Asian_OverNightLow = if BarNumber() == HighestAll(Asian_ONlowBar)
then Asian_ONlow
else Asian_OverNightLow[1];


#
plot Asian_ONH = if Asian_OverNightHigh > 0
then Asian_OverNightHigh
else Double.NaN;

Asian_ONH.SetHiding(!PlotOverNightExtremes);
#ONH.SetPaintingStrategy(PaintingStrategy.SQUARES);
#ONH.SetDefaultColor(Color.Light_Gray);
Asian_ONH.SetDefaultColor(GlobalColor("Asian Color"));
#ONH.HideBubble();
#ONH.HideTitle();
#ONH.Hide();

#
plot Asian_ONL = if Asian_OverNightLow > 0
then Asian_OverNightLow
else Double.NaN;

Asian_ONL.SetHiding(!PlotOverNightExtremes);
#ONL.SetPaintingStrategy(PaintingStrategy.SQUARES);
#ONL.SetDefaultColor(Color.Light_Gray);
Asian_ONL.SetDefaultColor(GlobalColor("Asian Color"));
#ONL.Hide();

def Asian_High_plus_tick = Asian_ONH + numberOfTicks * TickSize();
def Asian_Low_plus_tick = Asian_ONL - numberOfTicks * TickSize();

#AddCloud(Asian_High_plus_tick, Asian_ONH, GlobalColor("Asian Color"), GlobalColor("Asian Color"));
#AddCloud(Asian_Low_plus_tick, Asian_ONL, GlobalColor("Asian Color"), GlobalColor("Asian Color"));

#############################################################################################################################################
#London Code
def London_o = open;
def London_h = high;
def London_l = low;
def London_c = close;
def London_v = volume;
def London_bar = BarNumber();


def London_GlobeX = London_aftermarket;

def London_vol = if London_GlobeX and !London_GlobeX[1]
then London_v
else if London_GlobeX
then London_vol[1] + London_v
else Double.NaN;

def London_GlobeX_Volume = London_vol;

def London_ONhigh = if London_GlobeX and !London_GlobeX[1]
then London_h
else if London_GlobeX and
London_h > London_ONhigh[1]
then London_h
else London_ONhigh[1];

def London_ONhighBar = if London_GlobeX and London_h == London_ONhigh
then London_bar
else Double.NaN;

def London_ONlow = if London_GlobeX and !London_GlobeX[1]
then London_l
else if London_GlobeX and
London_l < London_ONlow[1]
then London_l
else London_ONlow[1];

def London_ONlowBar = if London_GlobeX and London_l == London_ONlow
then London_bar
else Double.NaN;

def London_OverNightHigh = if BarNumber() == HighestAll(London_ONhighBar)
then London_ONhigh
else London_OverNightHigh[1];

def London_OverNightLow = if BarNumber() == HighestAll(London_ONlowBar)
then London_ONlow
else London_OverNightLow[1];


#
plot London_ONH = if London_OverNightHigh > 0
then London_OverNightHigh
else Double.NaN;

London_ONH.SetHiding(!PlotOverNightExtremes);
#ONH.SetPaintingStrategy(PaintingStrategy.SQUARES);
#ONH.SetDefaultColor(Color.Light_Gray);
London_ONH.SetDefaultColor(GlobalColor("London Color"));
#ONH.HideBubble();
#ONH.HideTitle();
#ONH.Hide();

#
plot London_ONL = if London_OverNightLow > 0
then London_OverNightLow
else Double.NaN;

London_ONL.SetHiding(!PlotOverNightExtremes);
#ONL.SetPaintingStrategy(PaintingStrategy.SQUARES);
#ONL.SetDefaultColor(Color.Light_Gray);
London_ONL.SetDefaultColor(GlobalColor("London Color"));
#ONL.Hide();

def London_High_plus_tick = London_ONH + numberOfTicks * TickSize();
def London_Low_plus_tick = London_ONL - numberOfTicks * TickSize();

#AddCloud(London_High_plus_tick, London_ONH, GlobalColor("London Color"), GlobalColor("London Color"));
#AddCloud(London_Low_plus_tick, London_ONL, GlobalColor("London Color"), GlobalColor("London Color"));

#############################################################################################################################################
#NY_AM Code
def NY_AM_o = open;
def NY_AM_h = high;
def NY_AM_l = low;
def NY_AM_c = close;
def NY_AM_v = volume;
def NY_AM_bar = BarNumber();


def NY_AM_GlobeX = NY_AM_aftermarket;

def NY_AM_vol = if NY_AM_GlobeX and !NY_AM_GlobeX[1]
then NY_AM_v
else if NY_AM_GlobeX
then NY_AM_vol[1] + NY_AM_v
else Double.NaN;

def NY_AM_GlobeX_Volume = NY_AM_vol;

def NY_AM_ONhigh = if NY_AM_GlobeX and !NY_AM_GlobeX[1]
then NY_AM_h
else if NY_AM_GlobeX and
NY_AM_h > NY_AM_ONhigh[1]
then NY_AM_h
else NY_AM_ONhigh[1];

def NY_AM_ONhighBar = if NY_AM_GlobeX and NY_AM_h == NY_AM_ONhigh
then NY_AM_bar
else Double.NaN;

def NY_AM_ONlow = if NY_AM_GlobeX and !NY_AM_GlobeX[1]
then NY_AM_l
else if NY_AM_GlobeX and
NY_AM_l < NY_AM_ONlow[1]
then NY_AM_l
else NY_AM_ONlow[1];

def NY_AM_ONlowBar = if NY_AM_GlobeX and NY_AM_l == NY_AM_ONlow
then NY_AM_bar
else Double.NaN;

def NY_AM_OverNightHigh = if BarNumber() == HighestAll(NY_AM_ONhighBar)
then NY_AM_ONhigh
else NY_AM_OverNightHigh[1];

def NY_AM_OverNightLow = if BarNumber() == HighestAll(NY_AM_ONlowBar)
then NY_AM_ONlow
else NY_AM_OverNightLow[1];


#
plot NY_AM_ONH = if NY_AM_OverNightHigh > 0
then NY_AM_OverNightHigh
else Double.NaN;

NY_AM_ONH.SetHiding(!PlotOverNightExtremes);
#ONH.SetPaintingStrategy(PaintingStrategy.SQUARES);
#ONH.SetDefaultColor(Color.Light_Gray);
NY_AM_ONH.SetDefaultColor(GlobalColor("NY_AM Color"));
#ONH.HideBubble();
#ONH.HideTitle();
NY_AM_ONH.Hide();

#
plot NY_AM_ONL = if NY_AM_OverNightLow > 0
then NY_AM_OverNightLow
else Double.NaN;

NY_AM_ONL.SetHiding(!PlotOverNightExtremes);
#ONL.SetPaintingStrategy(PaintingStrategy.SQUARES);
#ONL.SetDefaultColor(Color.Light_Gray);
NY_AM_ONL.SetDefaultColor(GlobalColor("NY_AM Color"));
NY_AM_ONL.Hide();

def NY_AM_High_plus_tick = NY_AM_ONH + numberOfTicks * TickSize();
def NY_AM_Low_plus_tick = NY_AM_ONL - numberOfTicks * TickSize();

#AddCloud(NY_AM_High_plus_tick, NY_AM_ONH, GlobalColor("NY_AM Color"), GlobalColor("NY_AM Color"));
#AddCloud(NY_AM_Low_plus_tick, NY_AM_ONL, GlobalColor("NY_AM Color"), GlobalColor("NY_AM Color"));
#############################################################################################################################################
#############################################################################################################################################
#NY_Lunch Code
def NY_Lunch_o = open;
def NY_Lunch_h = high;
def NY_Lunch_l = low;
def NY_Lunch_c = close;
def NY_Lunch_v = volume;
def NY_Lunch_bar = BarNumber();


def NY_Lunch_GlobeX = NY_Lunch_aftermarket;

def NY_Lunch_vol = if NY_Lunch_GlobeX and !NY_Lunch_GlobeX[1]
then NY_Lunch_v
else if NY_Lunch_GlobeX
then NY_Lunch_vol[1] + NY_Lunch_v
else Double.NaN;

def NY_Lunch_GlobeX_Volume = NY_Lunch_vol;

def NY_Lunch_ONhigh = if NY_Lunch_GlobeX and !NY_Lunch_GlobeX[1]
then NY_Lunch_h
else if NY_Lunch_GlobeX and
NY_Lunch_h > NY_Lunch_ONhigh[1]
then NY_Lunch_h
else NY_Lunch_ONhigh[1];

def NY_Lunch_ONhighBar = if NY_Lunch_GlobeX and NY_Lunch_h == NY_Lunch_ONhigh
then NY_Lunch_bar
else Double.NaN;

def NY_Lunch_ONlow = if NY_Lunch_GlobeX and !NY_Lunch_GlobeX[1]
then NY_Lunch_l
else if NY_Lunch_GlobeX and
NY_Lunch_l < NY_Lunch_ONlow[1]
then NY_Lunch_l
else NY_Lunch_ONlow[1];

def NY_Lunch_ONlowBar = if NY_Lunch_GlobeX and NY_Lunch_l == NY_Lunch_ONlow
then NY_Lunch_bar
else Double.NaN;

def NY_Lunch_OverNightHigh = if BarNumber() == HighestAll(NY_Lunch_ONhighBar)
then NY_Lunch_ONhigh
else NY_Lunch_OverNightHigh[1];

def NY_Lunch_OverNightLow = if BarNumber() == HighestAll(NY_Lunch_ONlowBar)
then NY_Lunch_ONlow
else NY_Lunch_OverNightLow[1];


#
plot NY_Lunch_ONH = if NY_Lunch_OverNightHigh > 0
then NY_Lunch_OverNightHigh
else Double.NaN;

NY_Lunch_ONH.SetHiding(!PlotOverNightExtremes);
#ONH.SetPaintingStrategy(PaintingStrategy.SQUARES);
#ONH.SetDefaultColor(Color.Light_Gray);
NY_Lunch_ONH.SetDefaultColor(GlobalColor("NY_Lunch Color"));
#ONH.HideBubble();
#ONH.HideTitle();
#NY_Lunch_ONH.Hide();

#
plot NY_Lunch_ONL = if NY_Lunch_OverNightLow > 0
then NY_Lunch_OverNightLow
else Double.NaN;

NY_Lunch_ONL.SetHiding(!PlotOverNightExtremes);
#ONL.SetPaintingStrategy(PaintingStrategy.SQUARES);
#ONL.SetDefaultColor(Color.Light_Gray);
NY_Lunch_ONL.SetDefaultColor(GlobalColor("NY_Lunch Color"));
#NY_Lunch_ONL.Hide();

def NY_Lunch_High_plus_tick = NY_Lunch_ONH + numberOfTicks * TickSize();
def NY_Lunch_Low_plus_tick = NY_Lunch_ONL - numberOfTicks * TickSize();

#AddCloud(NY_Lunch_High_plus_tick, NY_Lunch_ONH, GlobalColor("NY_Lunch Color"), GlobalColor("NY_Lunch Color"));
#AddCloud(NY_Lunch_Low_plus_tick, NY_Lunch_ONL, GlobalColor("NY_Lunch Color"), GlobalColor("NY_Lunch Color"));
#############################################################################################################################################
#NY_PM Code
def NY_PM_o = open;
def NY_PM_h = high;
def NY_PM_l = low;
def NY_PM_c = close;
def NY_PM_v = volume;
def NY_PM_bar = BarNumber();


def NY_PM_GlobeX = NY_PM_aftermarket;

def NY_PM_vol = if NY_PM_GlobeX and !NY_PM_GlobeX[1]
then NY_PM_v
else if NY_PM_GlobeX
then NY_PM_vol[1] + NY_PM_v
else Double.NaN;

def NY_PM_GlobeX_Volume = NY_PM_vol;

def NY_PM_ONhigh = if NY_PM_GlobeX and !NY_PM_GlobeX[1]
then NY_PM_h
else if NY_PM_GlobeX and
NY_PM_h > NY_PM_ONhigh[1]
then NY_PM_h
else NY_PM_ONhigh[1];

def NY_PM_ONhighBar = if NY_PM_GlobeX and NY_PM_h == NY_PM_ONhigh
then NY_PM_bar
else Double.NaN;

def NY_PM_ONlow = if NY_PM_GlobeX and !NY_PM_GlobeX[1]
then NY_PM_l
else if NY_PM_GlobeX and
NY_PM_l < NY_PM_ONlow[1]
then NY_PM_l
else NY_PM_ONlow[1];

def NY_PM_ONlowBar = if NY_PM_GlobeX and NY_PM_l == NY_PM_ONlow
then NY_PM_bar
else Double.NaN;

def NY_PM_OverNightHigh = if BarNumber() == HighestAll(NY_PM_ONhighBar)
then NY_PM_ONhigh
else NY_PM_OverNightHigh[1];

def NY_PM_OverNightLow = if BarNumber() == HighestAll(NY_PM_ONlowBar)
then NY_PM_ONlow
else NY_PM_OverNightLow[1];


#
plot NY_PM_ONH = if NY_PM_OverNightHigh > 0
then NY_PM_OverNightHigh
else Double.NaN;

NY_PM_ONH.SetHiding(!PlotOverNightExtremes);
#ONH.SetPaintingStrategy(PaintingStrategy.SQUARES);
#ONH.SetDefaultColor(Color.Light_Gray);
NY_PM_ONH.SetDefaultColor(GlobalColor("NY_PM Color"));
#ONH.HideBubble();
#ONH.HideTitle();
#NY_PM_ONH.Hide();

#
plot NY_PM_ONL = if NY_PM_OverNightLow > 0
then NY_PM_OverNightLow
else Double.NaN;

NY_PM_ONL.SetHiding(!PlotOverNightExtremes);
#ONL.SetPaintingStrategy(PaintingStrategy.SQUARES);
#ONL.SetDefaultColor(Color.Light_Gray);
NY_PM_ONL.SetDefaultColor(GlobalColor("NY_PM Color"));
#NY_PM_ONL.Hide();

def NY_PM_High_plus_tick = NY_PM_ONH + numberOfTicks * TickSize();
def NY_PM_Low_plus_tick = NY_PM_ONL - numberOfTicks * TickSize();

#AddCloud(NY_PM_High_plus_tick, NY_PM_ONH, GlobalColor("NY_PM Color"), GlobalColor("NY_PM Color"));
#AddCloud(NY_PM_Low_plus_tick, NY_PM_ONL, GlobalColor("NY_PM Color"), GlobalColor("NY_PM Color"));
Nice work @SJP07! I'm just getting into ICT concepts and this is going to help out a lot! Now I just need a better FVG indicator.
 
Hi @Mytrades1979, I found a way to extend the lines and have updated the script. I've also marked the lunch time range. Please let me know if you need any further assistance.


###############################################
#Asian
def midn = 0000;
def midnite = if (SecondsFromTime(midn) == 0) then 1 else 0;

def Asian_afterbegin = 1800;
#def Asian_Q1_afterend = 2359;
def Asian_aftermarket = SecondsFromTime(Asian_afterbegin[1]) >= 0 and (SecondsFromTime(midn) == 0) >= 0;

#DefineGlobalColor("Asian Color", (CreateColor(204, 255, 204)));
DefineGlobalColor("Asian Color", (color.White));
#AddLabel(yes, "Asian", (GlobalColor("Asian Color")));

###############################################

#LONDON
def London_afterbegin = midn;
def London_afterend = 0600;
def London_aftermarket = SecondsFromTime(London_afterbegin) >= 0 and SecondsTillTime(London_afterend) >= 0;
DefineGlobalColor("London Color", (CreateColor(153, 153 ,255)));
#AddLabel(yes, "London", (GlobalColor("London Color")));

###############################################
#NY AM
def NY_AM_afterbegin = 0600;
def NY_AM_afterend = 1200;
def NY_AM_aftermarket = SecondsFromTime(NY_AM_afterbegin) >= 0 and SecondsTillTime(NY_AM_afterend) >= 0;

DefineGlobalColor("NY_AM Color", (CreateColor(0, 153, 255)));
#AddLabel(yes, "NY_AM", (GlobalColor("NY_Lunch Color")));

###############################################
#NY Lunch
def NY_Lunch_afterbegin = 1100;
def NY_Lunch_afterend = 1300;
def NY_Lunch_aftermarket = SecondsFromTime(NY_Lunch_afterbegin) >= 0 and SecondsTillTime(NY_Lunch_afterend) >= 0;

DefineGlobalColor("NY_Lunch Color", (CreateColor(255, 153, 102)));
#AddLabel(yes, "NY_Lunch", (GlobalColor("NY_PM Color")));
###############################################

###############################################
#NY PM
def NY_PM_afterbegin = 1200;
def NY_PM_afterend = 1800;
def NY_PM_aftermarket = SecondsFromTime(NY_PM_afterbegin) >= 0 and SecondsTillTime(NY_PM_afterend) >= 0;

DefineGlobalColor("NY_PM Color", (CreateColor(255, 153, 102)));
#AddLabel(yes, "NY_PM", (GlobalColor("NY_PM Color")));
###############################################

declare hide_on_daily;
input PlotOverNightExtremes = yes;
input DisplayPriceBubbleOnHiLowBar = yes;
input DisplayPriceBubbleOnRightEdge = yes; #Haven't figured this out yet..JQ
def numberOfTicks = 1;

#############################################################################################################################################
def Asian_o = open;
def Asian_h = high;
def Asian_l = low;
def Asian_c = close;
def Asian_v = volume;
def Asian_bar = BarNumber();



#Asian Code
def Asian_GlobeX = Asian_aftermarket;

def Asian_vol = if Asian_GlobeX and !Asian_GlobeX[1]
then Asian_v
else if Asian_GlobeX
then Asian_vol[1] + Asian_v
else Double.NaN;

def Asian_GlobeX_Volume = Asian_vol;

def Asian_ONhigh = if Asian_GlobeX and !Asian_GlobeX[1]
then Asian_h
else if Asian_GlobeX and
Asian_h > Asian_ONhigh[1]
then Asian_h
else Asian_ONhigh[1];

def Asian_ONhighBar = if Asian_GlobeX and Asian_h == Asian_ONhigh
then Asian_bar
else Double.NaN;

def Asian_ONlow = if Asian_GlobeX and !Asian_GlobeX[1]
then Asian_l
else if Asian_GlobeX and
Asian_l < Asian_ONlow[1]
then Asian_l
else Asian_ONlow[1];

def Asian_ONlowBar = if Asian_GlobeX and Asian_l == Asian_ONlow
then Asian_bar
else Double.NaN;

def Asian_OverNightHigh = if BarNumber() == HighestAll(Asian_ONhighBar)
then Asian_ONhigh
else Asian_OverNightHigh[1];

def Asian_OverNightLow = if BarNumber() == HighestAll(Asian_ONlowBar)
then Asian_ONlow
else Asian_OverNightLow[1];


#
plot Asian_ONH = if Asian_OverNightHigh > 0
then Asian_OverNightHigh
else Double.NaN;

Asian_ONH.SetHiding(!PlotOverNightExtremes);
#ONH.SetPaintingStrategy(PaintingStrategy.SQUARES);
#ONH.SetDefaultColor(Color.Light_Gray);
Asian_ONH.SetDefaultColor(GlobalColor("Asian Color"));
#ONH.HideBubble();
#ONH.HideTitle();
#ONH.Hide();

#
plot Asian_ONL = if Asian_OverNightLow > 0
then Asian_OverNightLow
else Double.NaN;

Asian_ONL.SetHiding(!PlotOverNightExtremes);
#ONL.SetPaintingStrategy(PaintingStrategy.SQUARES);
#ONL.SetDefaultColor(Color.Light_Gray);
Asian_ONL.SetDefaultColor(GlobalColor("Asian Color"));
#ONL.Hide();

def Asian_High_plus_tick = Asian_ONH + numberOfTicks * TickSize();
def Asian_Low_plus_tick = Asian_ONL - numberOfTicks * TickSize();

#AddCloud(Asian_High_plus_tick, Asian_ONH, GlobalColor("Asian Color"), GlobalColor("Asian Color"));
#AddCloud(Asian_Low_plus_tick, Asian_ONL, GlobalColor("Asian Color"), GlobalColor("Asian Color"));

#############################################################################################################################################
#London Code
def London_o = open;
def London_h = high;
def London_l = low;
def London_c = close;
def London_v = volume;
def London_bar = BarNumber();


def London_GlobeX = London_aftermarket;

def London_vol = if London_GlobeX and !London_GlobeX[1]
then London_v
else if London_GlobeX
then London_vol[1] + London_v
else Double.NaN;

def London_GlobeX_Volume = London_vol;

def London_ONhigh = if London_GlobeX and !London_GlobeX[1]
then London_h
else if London_GlobeX and
London_h > London_ONhigh[1]
then London_h
else London_ONhigh[1];

def London_ONhighBar = if London_GlobeX and London_h == London_ONhigh
then London_bar
else Double.NaN;

def London_ONlow = if London_GlobeX and !London_GlobeX[1]
then London_l
else if London_GlobeX and
London_l < London_ONlow[1]
then London_l
else London_ONlow[1];

def London_ONlowBar = if London_GlobeX and London_l == London_ONlow
then London_bar
else Double.NaN;

def London_OverNightHigh = if BarNumber() == HighestAll(London_ONhighBar)
then London_ONhigh
else London_OverNightHigh[1];

def London_OverNightLow = if BarNumber() == HighestAll(London_ONlowBar)
then London_ONlow
else London_OverNightLow[1];


#
plot London_ONH = if London_OverNightHigh > 0
then London_OverNightHigh
else Double.NaN;

London_ONH.SetHiding(!PlotOverNightExtremes);
#ONH.SetPaintingStrategy(PaintingStrategy.SQUARES);
#ONH.SetDefaultColor(Color.Light_Gray);
London_ONH.SetDefaultColor(GlobalColor("London Color"));
#ONH.HideBubble();
#ONH.HideTitle();
#ONH.Hide();

#
plot London_ONL = if London_OverNightLow > 0
then London_OverNightLow
else Double.NaN;

London_ONL.SetHiding(!PlotOverNightExtremes);
#ONL.SetPaintingStrategy(PaintingStrategy.SQUARES);
#ONL.SetDefaultColor(Color.Light_Gray);
London_ONL.SetDefaultColor(GlobalColor("London Color"));
#ONL.Hide();

def London_High_plus_tick = London_ONH + numberOfTicks * TickSize();
def London_Low_plus_tick = London_ONL - numberOfTicks * TickSize();

#AddCloud(London_High_plus_tick, London_ONH, GlobalColor("London Color"), GlobalColor("London Color"));
#AddCloud(London_Low_plus_tick, London_ONL, GlobalColor("London Color"), GlobalColor("London Color"));

#############################################################################################################################################
#NY_AM Code
def NY_AM_o = open;
def NY_AM_h = high;
def NY_AM_l = low;
def NY_AM_c = close;
def NY_AM_v = volume;
def NY_AM_bar = BarNumber();


def NY_AM_GlobeX = NY_AM_aftermarket;

def NY_AM_vol = if NY_AM_GlobeX and !NY_AM_GlobeX[1]
then NY_AM_v
else if NY_AM_GlobeX
then NY_AM_vol[1] + NY_AM_v
else Double.NaN;

def NY_AM_GlobeX_Volume = NY_AM_vol;

def NY_AM_ONhigh = if NY_AM_GlobeX and !NY_AM_GlobeX[1]
then NY_AM_h
else if NY_AM_GlobeX and
NY_AM_h > NY_AM_ONhigh[1]
then NY_AM_h
else NY_AM_ONhigh[1];

def NY_AM_ONhighBar = if NY_AM_GlobeX and NY_AM_h == NY_AM_ONhigh
then NY_AM_bar
else Double.NaN;

def NY_AM_ONlow = if NY_AM_GlobeX and !NY_AM_GlobeX[1]
then NY_AM_l
else if NY_AM_GlobeX and
NY_AM_l < NY_AM_ONlow[1]
then NY_AM_l
else NY_AM_ONlow[1];

def NY_AM_ONlowBar = if NY_AM_GlobeX and NY_AM_l == NY_AM_ONlow
then NY_AM_bar
else Double.NaN;

def NY_AM_OverNightHigh = if BarNumber() == HighestAll(NY_AM_ONhighBar)
then NY_AM_ONhigh
else NY_AM_OverNightHigh[1];

def NY_AM_OverNightLow = if BarNumber() == HighestAll(NY_AM_ONlowBar)
then NY_AM_ONlow
else NY_AM_OverNightLow[1];


#
plot NY_AM_ONH = if NY_AM_OverNightHigh > 0
then NY_AM_OverNightHigh
else Double.NaN;

NY_AM_ONH.SetHiding(!PlotOverNightExtremes);
#ONH.SetPaintingStrategy(PaintingStrategy.SQUARES);
#ONH.SetDefaultColor(Color.Light_Gray);
NY_AM_ONH.SetDefaultColor(GlobalColor("NY_AM Color"));
#ONH.HideBubble();
#ONH.HideTitle();
NY_AM_ONH.Hide();

#
plot NY_AM_ONL = if NY_AM_OverNightLow > 0
then NY_AM_OverNightLow
else Double.NaN;

NY_AM_ONL.SetHiding(!PlotOverNightExtremes);
#ONL.SetPaintingStrategy(PaintingStrategy.SQUARES);
#ONL.SetDefaultColor(Color.Light_Gray);
NY_AM_ONL.SetDefaultColor(GlobalColor("NY_AM Color"));
NY_AM_ONL.Hide();

def NY_AM_High_plus_tick = NY_AM_ONH + numberOfTicks * TickSize();
def NY_AM_Low_plus_tick = NY_AM_ONL - numberOfTicks * TickSize();

#AddCloud(NY_AM_High_plus_tick, NY_AM_ONH, GlobalColor("NY_AM Color"), GlobalColor("NY_AM Color"));
#AddCloud(NY_AM_Low_plus_tick, NY_AM_ONL, GlobalColor("NY_AM Color"), GlobalColor("NY_AM Color"));
#############################################################################################################################################
#############################################################################################################################################
#NY_Lunch Code
def NY_Lunch_o = open;
def NY_Lunch_h = high;
def NY_Lunch_l = low;
def NY_Lunch_c = close;
def NY_Lunch_v = volume;
def NY_Lunch_bar = BarNumber();


def NY_Lunch_GlobeX = NY_Lunch_aftermarket;

def NY_Lunch_vol = if NY_Lunch_GlobeX and !NY_Lunch_GlobeX[1]
then NY_Lunch_v
else if NY_Lunch_GlobeX
then NY_Lunch_vol[1] + NY_Lunch_v
else Double.NaN;

def NY_Lunch_GlobeX_Volume = NY_Lunch_vol;

def NY_Lunch_ONhigh = if NY_Lunch_GlobeX and !NY_Lunch_GlobeX[1]
then NY_Lunch_h
else if NY_Lunch_GlobeX and
NY_Lunch_h > NY_Lunch_ONhigh[1]
then NY_Lunch_h
else NY_Lunch_ONhigh[1];

def NY_Lunch_ONhighBar = if NY_Lunch_GlobeX and NY_Lunch_h == NY_Lunch_ONhigh
then NY_Lunch_bar
else Double.NaN;

def NY_Lunch_ONlow = if NY_Lunch_GlobeX and !NY_Lunch_GlobeX[1]
then NY_Lunch_l
else if NY_Lunch_GlobeX and
NY_Lunch_l < NY_Lunch_ONlow[1]
then NY_Lunch_l
else NY_Lunch_ONlow[1];

def NY_Lunch_ONlowBar = if NY_Lunch_GlobeX and NY_Lunch_l == NY_Lunch_ONlow
then NY_Lunch_bar
else Double.NaN;

def NY_Lunch_OverNightHigh = if BarNumber() == HighestAll(NY_Lunch_ONhighBar)
then NY_Lunch_ONhigh
else NY_Lunch_OverNightHigh[1];

def NY_Lunch_OverNightLow = if BarNumber() == HighestAll(NY_Lunch_ONlowBar)
then NY_Lunch_ONlow
else NY_Lunch_OverNightLow[1];


#
plot NY_Lunch_ONH = if NY_Lunch_OverNightHigh > 0
then NY_Lunch_OverNightHigh
else Double.NaN;

NY_Lunch_ONH.SetHiding(!PlotOverNightExtremes);
#ONH.SetPaintingStrategy(PaintingStrategy.SQUARES);
#ONH.SetDefaultColor(Color.Light_Gray);
NY_Lunch_ONH.SetDefaultColor(GlobalColor("NY_Lunch Color"));
#ONH.HideBubble();
#ONH.HideTitle();
#NY_Lunch_ONH.Hide();

#
plot NY_Lunch_ONL = if NY_Lunch_OverNightLow > 0
then NY_Lunch_OverNightLow
else Double.NaN;

NY_Lunch_ONL.SetHiding(!PlotOverNightExtremes);
#ONL.SetPaintingStrategy(PaintingStrategy.SQUARES);
#ONL.SetDefaultColor(Color.Light_Gray);
NY_Lunch_ONL.SetDefaultColor(GlobalColor("NY_Lunch Color"));
#NY_Lunch_ONL.Hide();

def NY_Lunch_High_plus_tick = NY_Lunch_ONH + numberOfTicks * TickSize();
def NY_Lunch_Low_plus_tick = NY_Lunch_ONL - numberOfTicks * TickSize();

#AddCloud(NY_Lunch_High_plus_tick, NY_Lunch_ONH, GlobalColor("NY_Lunch Color"), GlobalColor("NY_Lunch Color"));
#AddCloud(NY_Lunch_Low_plus_tick, NY_Lunch_ONL, GlobalColor("NY_Lunch Color"), GlobalColor("NY_Lunch Color"));
#############################################################################################################################################
#NY_PM Code
def NY_PM_o = open;
def NY_PM_h = high;
def NY_PM_l = low;
def NY_PM_c = close;
def NY_PM_v = volume;
def NY_PM_bar = BarNumber();


def NY_PM_GlobeX = NY_PM_aftermarket;

def NY_PM_vol = if NY_PM_GlobeX and !NY_PM_GlobeX[1]
then NY_PM_v
else if NY_PM_GlobeX
then NY_PM_vol[1] + NY_PM_v
else Double.NaN;

def NY_PM_GlobeX_Volume = NY_PM_vol;

def NY_PM_ONhigh = if NY_PM_GlobeX and !NY_PM_GlobeX[1]
then NY_PM_h
else if NY_PM_GlobeX and
NY_PM_h > NY_PM_ONhigh[1]
then NY_PM_h
else NY_PM_ONhigh[1];

def NY_PM_ONhighBar = if NY_PM_GlobeX and NY_PM_h == NY_PM_ONhigh
then NY_PM_bar
else Double.NaN;

def NY_PM_ONlow = if NY_PM_GlobeX and !NY_PM_GlobeX[1]
then NY_PM_l
else if NY_PM_GlobeX and
NY_PM_l < NY_PM_ONlow[1]
then NY_PM_l
else NY_PM_ONlow[1];

def NY_PM_ONlowBar = if NY_PM_GlobeX and NY_PM_l == NY_PM_ONlow
then NY_PM_bar
else Double.NaN;

def NY_PM_OverNightHigh = if BarNumber() == HighestAll(NY_PM_ONhighBar)
then NY_PM_ONhigh
else NY_PM_OverNightHigh[1];

def NY_PM_OverNightLow = if BarNumber() == HighestAll(NY_PM_ONlowBar)
then NY_PM_ONlow
else NY_PM_OverNightLow[1];


#
plot NY_PM_ONH = if NY_PM_OverNightHigh > 0
then NY_PM_OverNightHigh
else Double.NaN;

NY_PM_ONH.SetHiding(!PlotOverNightExtremes);
#ONH.SetPaintingStrategy(PaintingStrategy.SQUARES);
#ONH.SetDefaultColor(Color.Light_Gray);
NY_PM_ONH.SetDefaultColor(GlobalColor("NY_PM Color"));
#ONH.HideBubble();
#ONH.HideTitle();
#NY_PM_ONH.Hide();

#
plot NY_PM_ONL = if NY_PM_OverNightLow > 0
then NY_PM_OverNightLow
else Double.NaN;

NY_PM_ONL.SetHiding(!PlotOverNightExtremes);
#ONL.SetPaintingStrategy(PaintingStrategy.SQUARES);
#ONL.SetDefaultColor(Color.Light_Gray);
NY_PM_ONL.SetDefaultColor(GlobalColor("NY_PM Color"));
#NY_PM_ONL.Hide();

def NY_PM_High_plus_tick = NY_PM_ONH + numberOfTicks * TickSize();
def NY_PM_Low_plus_tick = NY_PM_ONL - numberOfTicks * TickSize();

#AddCloud(NY_PM_High_plus_tick, NY_PM_ONH, GlobalColor("NY_PM Color"), GlobalColor("NY_PM Color"));
#AddCloud(NY_PM_Low_plus_tick, NY_PM_ONL, GlobalColor("NY_PM Color"), GlobalColor("NY_PM Color"));
Is there an error with Asian and London lows? Seems like they're just the low of the first 1HR candle of each session.
 
Is there an error with Asian and London lows? Seems like they're just the low of the first 1HR candle of each session.
Yeah I noticed that too, it keeps moving when it's not suppose to.
Try this. It's been working well for me.

Code:
declare hide_on_daily;

input Show_Cloud = No;
input Show_Cloud2 = no;
input Show_Vertical_Line = no;

def Asian_DrawLine =
     getLastDay() and
    (
        !secondsFromTime(1800) [1]
    );

#AddVerticalLine (DrawLine, "", Color.Dark_black,Curve.Long_DASH);
AddVerticalLine (if Show_Vertical_Line then Asian_DrawLine else double.nan, "Asian", Color.black,Curve.Firm);


input ShowTodayOnly = yes;
def Today = if GetDay() == GetLastDay() then 0 else 1;
#def Today = if GetDay() == GetLastDay() then 1 else 0;
#def Show_last = if GetDay() >= GetLastDay() then 1 else 0;

###############################################
def midn = 0000;
def midnite = if (SecondsfromTime(midn) == 0) then 1 else 0;
###############################################


#############################################################################################################
#############################################################################################################

#Q1
def Asian_Q1_afterbegin = 1800;
#def Asian_Q1_afterend   = 2359;
def Asian_Q1_aftermarket =  SecondsFromTime(Asian_Q1_afterbegin[1]) >= 0 and (SecondsfromTime(midn) == 0) >= 0;
def Asian_Q1_bars   = 2000;

#input Asian_Q1_pricePerRowHeightMode = { AUTOMATIC, default TICKSIZE, CUSTOM};
input Asian_Q1_pricePerRowHeightMode = { TICKSIZE, default AUTOMATIC, CUSTOM};

def Asian_Q1_customRowHeight = 1.0;
input Asian_Q1_timePerProfile = {default BAR};
def Asian_Q1_onExpansion = no;
def Asian_Q1_profiles = 1000;

def Asian_Q1_period;

switch (Asian_Q1_timePerProfile) {
case BAR:
Asian_Q1_period = BarNumber() - 1;
}


def Asian_Q1_count = CompoundValue(1, if Asian_Q1_aftermarket and Asian_Q1_period != Asian_Q1_period[1] then (Asian_Q1_count[1] + Asian_Q1_period - Asian_Q1_period[1]) % Asian_Q1_bars else Asian_Q1_count[1], 0);
def Asian_Q1_cond = Asian_Q1_count < Asian_Q1_count[1] + Asian_Q1_period - Asian_Q1_period[1];
def Asian_Q1_height;
switch (Asian_Q1_pricePerRowHeightMode) {
case AUTOMATIC:
Asian_Q1_height = PricePerRow.AUTOMATIC;
case TICKSIZE:
Asian_Q1_height = PricePerRow.TICKSIZE;
case CUSTOM:
Asian_Q1_height = Asian_Q1_customRowHeight;
}

profile Asian_Q1_vol = VolumeProfile("startNewProfile" = Asian_Q1_cond, "onExpansion" = no, "numberOfProfiles" = 1000, "pricePerRow" = Asian_Q1_height, "value area percent" = 0);

def Asian_Q1_con = CompoundValue(1, Asian_Q1_onExpansion, no);

def Asian_Q1_hProfile = if Asian_Q1_aftermarket and IsNaN(Asian_Q1_vol.GetHighest()) and Asian_Q1_con then Asian_Q1_hProfile[1] else Asian_Q1_vol.GetHighest();
def Asian_Q1_lProfile = if Asian_Q1_aftermarket and IsNaN(Asian_Q1_vol.GetLowest()) and Asian_Q1_con then Asian_Q1_lProfile[1] else Asian_Q1_vol.GetLowest();
def Asian_Q1_plotsDomain = IsNaN(close) == Asian_Q1_onExpansion;
def Asian_Q1_ProfileHigh = if Asian_Q1_aftermarket and Asian_Q1_plotsDomain then Asian_Q1_hProfile else Double.NaN;
def Asian_Q1_ProfileLow = if Asian_Q1_aftermarket and Asian_Q1_plotsDomain then Asian_Q1_lProfile else Double.NaN;

plot Asian_Q1_hrange = Asian_Q1_ProfileHigh;
plot Asian_Q1_lrange = Asian_Q1_ProfileLow;
Asian_Q1_hrange.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
Asian_Q1_lrange.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
Asian_Q1_hrange.SetDefaultColor(createcolor(204, 255, 204));
Asian_Q1_lrange.SetDefaultColor(createcolor(204, 255, 204));
Asian_Q1_hrange.SetLineWeight(1);
Asian_Q1_lrange.SetLineWeight(1);
#Asian_Q1_hrange.Hide();
#Asian_Q1_lrange.Hide();

def Asian_Q1_bubblemover = 0;
def Asian_Q1_b  = Asian_Q1_bubblemover;
def Asian_Q1_b1 = Asian_Q1_b + 1;


input Asian_Q1_showbubbles = no;
AddChartBubble(Asian_Q1_showbubbles and (IsNaN(Asian_Q1_hrange[Asian_Q1_b1]) and Asian_Q1_hrange[Asian_Q1_b])  , Asian_Q1_hrange, AsText(Asian_Q1_hrange), Color.LIGHT_Red);

AddChartBubble(Asian_Q1_showbubbles and (IsNaN(Asian_Q1_hrange[Asian_Q1_b1]) and Asian_Q1_hrange[Asian_Q1_b]) , Asian_Q1_lrange, AsText(Asian_Q1_lrange), Color.LIGHT_Green, up = no);

input Asian_Q1_showverticalline = no;
AddVerticalLine(Asian_Q1_showverticalline and Asian_Q1_hrange != Asian_Q1_hrange[1], "", Color.BLUE, stroke = Curve.FIRM);

#Addcloud(hrange, lrange, createcolor(0, 51, 51), createcolor(0, 51, 51));
Addcloud(if Show_Cloud then Asian_Q1_hrange else double.nan, Asian_Q1_lrange, createcolor(204, 255, 204), createcolor(204, 255, 204));

Addcloud(if Show_Cloud2 then Asian_Q1_hrange else double.nan, Asian_Q1_lrange, color.black, color.black);

#Addcloud(Asian_Q1_hrange, Asian_Q1_lrange, color.black, color.black);


###############################################################
###############################################################
###############################################################
#LONDON

def London_Q2_afterbegin = midn;
def London_Q2_afterend   = 0600;
def London_Q2_aftermarket =  SecondsFromTime(London_Q2_afterbegin) >= 0 and SecondsTillTime(London_Q2_afterend) >= 0;
def London_Q2_bars   = 2000;

#input London_Q2_pricePerRowHeightMode = { AUTOMATIC, default TICKSIZE, CUSTOM};
input London_Q2_pricePerRowHeightMode = { TICKSIZE, default AUTOMATIC, CUSTOM};

def London_Q2_customRowHeight = 1.0;
input London_Q2_timePerProfile = {default BAR};
def London_Q2_onExpansion = no;
def London_Q2_profiles = 1000;

def London_Q2_period;

switch (London_Q2_timePerProfile) {
case BAR:
London_Q2_period = BarNumber() - 1;
}


def London_Q2_count = CompoundValue(1, if London_Q2_aftermarket and London_Q2_period != London_Q2_period[1] then (London_Q2_count[1] + London_Q2_period - London_Q2_period[1]) % London_Q2_bars else London_Q2_count[1], 0);
def London_Q2_cond = London_Q2_count < London_Q2_count[1] + London_Q2_period - London_Q2_period[1];
def London_Q2_height;
switch (London_Q2_pricePerRowHeightMode) {
case AUTOMATIC:
London_Q2_height = PricePerRow.AUTOMATIC;
case TICKSIZE:
London_Q2_height = PricePerRow.TICKSIZE;
case CUSTOM:
London_Q2_height = London_Q2_customRowHeight;
}

profile London_Q2_vol = VolumeProfile("startNewProfile" = London_Q2_cond, "onExpansion" = no, "numberOfProfiles" = 1000, "pricePerRow" = London_Q2_height, "value area percent" = 0);

def London_Q2_con = CompoundValue(1, London_Q2_onExpansion, no);

def London_Q2_hProfile = if London_Q2_aftermarket and IsNaN(London_Q2_vol.GetHighest()) and London_Q2_con then London_Q2_hProfile[1] else London_Q2_vol.GetHighest();
def London_Q2_lProfile = if London_Q2_aftermarket and IsNaN(London_Q2_vol.GetLowest()) and London_Q2_con then London_Q2_lProfile[1] else London_Q2_vol.GetLowest();
def London_Q2_plotsDomain = IsNaN(close) == London_Q2_onExpansion;
def London_Q2_ProfileHigh = if London_Q2_aftermarket and London_Q2_plotsDomain then London_Q2_hProfile else Double.NaN;
def London_Q2_ProfileLow = if London_Q2_aftermarket and London_Q2_plotsDomain then London_Q2_lProfile else Double.NaN;

plot London_Q2_hrange = London_Q2_ProfileHigh;
plot London_Q2_lrange = London_Q2_ProfileLow;
London_Q2_hrange.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
London_Q2_lrange.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
London_Q2_hrange.SetDefaultColor(createcolor(153, 153 ,255));
London_Q2_lrange.SetDefaultColor(createcolor(153, 153 ,255));
London_Q2_hrange.SetLineWeight(1);
London_Q2_lrange.SetLineWeight(1);
#London_Q2_hrange.Hide();
#London_Q2_lrange.Hide();

def London_Q2_bubblemover = 0;
def London_Q2_b  = London_Q2_bubblemover;
def London_Q2_b1 = London_Q2_b + 1;


input London_Q2_showbubbles = no;
AddChartBubble(London_Q2_showbubbles and (IsNaN(London_Q2_hrange[London_Q2_b1]) and London_Q2_hrange[London_Q2_b])  , London_Q2_hrange, AsText(London_Q2_hrange), Color.LIGHT_Red);

AddChartBubble(London_Q2_showbubbles and (IsNaN(London_Q2_hrange[London_Q2_b1]) and London_Q2_hrange[London_Q2_b]) , London_Q2_lrange, AsText(London_Q2_lrange), Color.LIGHT_Green, up = no);

input London_Q2_showverticalline = no;
AddVerticalLine(London_Q2_showverticalline and London_Q2_hrange != London_Q2_hrange[1], "", Color.BLUE, stroke = Curve.FIRM);

#Addcloud(hrange, lrange, createcolor(0, 51, 51), createcolor(0, 51, 51));
Addcloud(if Show_Cloud then London_Q2_hrange else double.nan, London_Q2_lrange, createcolor(153, 153 ,255), createcolor(153, 153 ,255));

Addcloud(if Show_Cloud2 then London_Q2_hrange else double.nan, London_Q2_lrange, color.black, color.black);


#Addcloud(London_Q2_hrange, London_Q2_lrange, color.black, color.black);

#############################################################################################################
#############################################################################################################

#############################################################################################################
#############################################################################################################
def NY_DrawLine =
    getDay() == getLastDay() and
    (
        !secondsFromTime(0600)
    );

#AddVerticalLine (DrawLine, "", Color.Dark_black,Curve.Long_DASH);
AddVerticalLine (if Show_Vertical_Line then NY_Drawline else double.nan, "NY AM", Color.black,Curve.Firm);

def Show_last = if GetDay() == GetLastDay() then 1 else 0;

#############################################################################################################
#############################################################################################################

#Q3
def NY_Q3_afterbegin = 0600;
def NY_Q3_afterend   = 1200;
def NY_Q3_aftermarket =  SecondsFromTime(NY_Q3_afterbegin) >= 0 and SecondsTillTime(NY_Q3_afterend) >= 0;
def NY_Q3_bars   = 2000;

#input NY_Q3_pricePerRowHeightMode = { AUTOMATIC, default TICKSIZE, CUSTOM};
input NY_Q3_pricePerRowHeightMode = { TICKSIZE, default AUTOMATIC, CUSTOM};

def NY_Q3_customRowHeight = 1.0;
input NY_Q3_timePerProfile = {default BAR};
def NY_Q3_onExpansion = no;
def NY_Q3_profiles = 1000;

def NY_Q3_period;

switch (NY_Q3_timePerProfile) {
case BAR:
NY_Q3_period = BarNumber() - 1;
}


def NY_Q3_count = CompoundValue(1, if NY_Q3_aftermarket and NY_Q3_period != NY_Q3_period[1] then (NY_Q3_count[1] + NY_Q3_period - NY_Q3_period[1]) % NY_Q3_bars else NY_Q3_count[1], 0);
def NY_Q3_cond = NY_Q3_count < NY_Q3_count[1] + NY_Q3_period - NY_Q3_period[1];
def NY_Q3_height;
switch (NY_Q3_pricePerRowHeightMode) {
case AUTOMATIC:
NY_Q3_height = PricePerRow.AUTOMATIC;
case TICKSIZE:
NY_Q3_height = PricePerRow.TICKSIZE;
case CUSTOM:
NY_Q3_height = NY_Q3_customRowHeight;
}

profile NY_Q3_vol = VolumeProfile("startNewProfile" = NY_Q3_cond, "onExpansion" = no, "numberOfProfiles" = 1000, "pricePerRow" = NY_Q3_height, "value area percent" = 0);

def NY_Q3_con = CompoundValue(1, NY_Q3_onExpansion, no);

def NY_Q3_hProfile = if NY_Q3_aftermarket and IsNaN(NY_Q3_vol.GetHighest()) and NY_Q3_con then NY_Q3_hProfile[1] else NY_Q3_vol.GetHighest();
def NY_Q3_lProfile = if NY_Q3_aftermarket and IsNaN(NY_Q3_vol.GetLowest()) and NY_Q3_con then NY_Q3_lProfile[1] else NY_Q3_vol.GetLowest();
def NY_Q3_plotsDomain = IsNaN(close) == NY_Q3_onExpansion;
def NY_Q3_ProfileHigh = if NY_Q3_aftermarket and NY_Q3_plotsDomain then NY_Q3_hProfile else Double.NaN;
def NY_Q3_ProfileLow = if NY_Q3_aftermarket and NY_Q3_plotsDomain then NY_Q3_lProfile else Double.NaN;

plot NY_Q3_hrange = NY_Q3_ProfileHigh;
plot NY_Q3_lrange = NY_Q3_ProfileLow;
NY_Q3_hrange.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
NY_Q3_lrange.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
NY_Q3_hrange.SetDefaultColor(createcolor(0, 153, 255));
NY_Q3_lrange.SetDefaultColor(createcolor(0, 153, 255));
NY_Q3_hrange.SetLineWeight(1);
NY_Q3_lrange.SetLineWeight(1);
#NY_Q3_hrange.Hide();
#NY_Q3_lrange.Hide();

def NY_Q3_bubblemover = 0;
def NY_Q3_b  = NY_Q3_bubblemover;
def NY_Q3_b1 = NY_Q3_b + 1;


input NY_Q3_showbubbles = no;
AddChartBubble(NY_Q3_showbubbles and (IsNaN(NY_Q3_hrange[NY_Q3_b1]) and NY_Q3_hrange[NY_Q3_b])  , NY_Q3_hrange, AsText(NY_Q3_hrange), Color.LIGHT_Red);

AddChartBubble(NY_Q3_showbubbles and (IsNaN(NY_Q3_hrange[NY_Q3_b1]) and NY_Q3_hrange[NY_Q3_b]) , NY_Q3_lrange, AsText(NY_Q3_lrange), Color.LIGHT_Green, up = no);

input NY_Q3_showverticalline = no;
AddVerticalLine(NY_Q3_showverticalline and NY_Q3_hrange != NY_Q3_hrange[1], "", Color.BLUE, stroke = Curve.FIRM);

#Addcloud(hrange, lrange, createcolor(0, 51, 51), createcolor(0, 51, 51));
Addcloud(if Show_Cloud then NY_Q3_hrange else double.nan, NY_Q3_lrange, createcolor(0, 153, 255), createcolor(0, 153, 255));

Addcloud(if Show_Cloud2 then NY_Q3_hrange else double.nan, NY_Q3_lrange, color.black, color.black);

#Addcloud(NY_Q3_hrange, NY_Q3_lrange, color.black, color.black);

#############################################################################################################
#############################################################################################################

def NY_PM_DrawLine =
    getDay() == getLastDay() and
    (
        !secondsFromTime(1200)
    );

#AddVerticalLine (DrawLine, "", Color.Dark_black,Curve.Long_DASH);
AddVerticalLine (if Show_Vertical_Line then NY_PM_DrawLine else double.nan, "NY PM", Color.black,Curve.Firm);



#############################################################################################################
#############################################################################################################

#Q4
def NY_PM_Q4_afterbegin = 1200;
def NY_PM_Q4_afterend   = 1800;
def NY_PM_Q4_aftermarket =  SecondsFromTime(NY_PM_Q4_afterbegin) >= 0 and SecondsTillTime(NY_PM_Q4_afterend) >= 0;
def NY_PM_Q4_bars   = 2000;

#input NY_PM_Q4_pricePerRowHeightMode = { AUTOMATIC, default TICKSIZE, CUSTOM};
input NY_PM_Q4_pricePerRowHeightMode = { TICKSIZE, default AUTOMATIC, CUSTOM};

def NY_PM_Q4_customRowHeight = 1.0;
input NY_PM_Q4_timePerProfile = {default BAR};
def NY_PM_Q4_onExpansion = no;
def NY_PM_Q4_profiles = 1000;

def NY_PM_Q4_period;

switch (NY_PM_Q4_timePerProfile) {
case BAR:
NY_PM_Q4_period = BarNumber() - 1;
}


def NY_PM_Q4_count = CompoundValue(1, if NY_PM_Q4_aftermarket and NY_PM_Q4_period != NY_PM_Q4_period[1] then (NY_PM_Q4_count[1] + NY_PM_Q4_period - NY_PM_Q4_period[1]) % NY_PM_Q4_bars else NY_PM_Q4_count[1], 0);
def NY_PM_Q4_cond = NY_PM_Q4_count < NY_PM_Q4_count[1] + NY_PM_Q4_period - NY_PM_Q4_period[1];
def NY_PM_Q4_height;
switch (NY_PM_Q4_pricePerRowHeightMode) {
case AUTOMATIC:
NY_PM_Q4_height = PricePerRow.AUTOMATIC;
case TICKSIZE:
NY_PM_Q4_height = PricePerRow.TICKSIZE;
case CUSTOM:
NY_PM_Q4_height = NY_PM_Q4_customRowHeight;
}

profile NY_PM_Q4_vol = VolumeProfile("startNewProfile" = NY_PM_Q4_cond, "onExpansion" = no, "numberOfProfiles" = 1000, "pricePerRow" = NY_PM_Q4_height, "value area percent" = 0);

def NY_PM_Q4_con = CompoundValue(1, NY_PM_Q4_onExpansion, no);

def NY_PM_Q4_hProfile = if NY_PM_Q4_aftermarket and IsNaN(NY_PM_Q4_vol.GetHighest()) and NY_PM_Q4_con then NY_PM_Q4_hProfile[1] else NY_PM_Q4_vol.GetHighest();
def NY_PM_Q4_lProfile = if NY_PM_Q4_aftermarket and IsNaN(NY_PM_Q4_vol.GetLowest()) and NY_PM_Q4_con then NY_PM_Q4_lProfile[1] else NY_PM_Q4_vol.GetLowest();
def NY_PM_Q4_plotsDomain = IsNaN(close) == NY_PM_Q4_onExpansion;
def NY_PM_Q4_ProfileHigh = if NY_PM_Q4_aftermarket and NY_PM_Q4_plotsDomain then NY_PM_Q4_hProfile else Double.NaN;
def NY_PM_Q4_ProfileLow = if NY_PM_Q4_aftermarket and NY_PM_Q4_plotsDomain then NY_PM_Q4_lProfile else Double.NaN;

plot NY_PM_Q4_hrange = NY_PM_Q4_ProfileHigh;
plot NY_PM_Q4_lrange = NY_PM_Q4_ProfileLow;
NY_PM_Q4_hrange.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
NY_PM_Q4_lrange.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
NY_PM_Q4_hrange.SetDefaultColor(createcolor(255, 153, 102));
NY_PM_Q4_lrange.SetDefaultColor(createcolor(255, 153, 102));
NY_PM_Q4_hrange.SetLineWeight(1);
NY_PM_Q4_lrange.SetLineWeight(1);
#NY_PM_Q4_hrange.Hide();
#NY_PM_Q4_lrange.Hide();

def NY_PM_Q4_bubblemover = 0;
def NY_PM_Q4_b  = NY_PM_Q4_bubblemover;
def NY_PM_Q4_b1 = NY_PM_Q4_b + 1;


input NY_PM_Q4_showbubbles = no;
AddChartBubble(NY_PM_Q4_showbubbles and (IsNaN(NY_PM_Q4_hrange[NY_PM_Q4_b1]) and NY_PM_Q4_hrange[NY_PM_Q4_b])  , NY_PM_Q4_hrange, AsText(NY_PM_Q4_hrange), Color.LIGHT_Red);

AddChartBubble(NY_PM_Q4_showbubbles and (IsNaN(NY_PM_Q4_hrange[NY_PM_Q4_b1]) and NY_PM_Q4_hrange[NY_PM_Q4_b]) , NY_PM_Q4_lrange, AsText(NY_PM_Q4_lrange), Color.LIGHT_Green, up = no);

input NY_PM_Q4_showverticalline = no;
AddVerticalLine(NY_PM_Q4_showverticalline and NY_PM_Q4_hrange != NY_PM_Q4_hrange[1], "", Color.BLUE, stroke = Curve.FIRM);

#Addcloud(hrange, lrange, createcolor(0, 51, 51), createcolor(0, 51, 51));
Addcloud(if Show_Cloud then NY_PM_Q4_hrange else double.nan, NY_PM_Q4_lrange, createcolor(255, 153, 102), createcolor(255, 153, 102));

Addcloud(if Show_Cloud2 then NY_PM_Q4_hrange else double.nan, NY_PM_Q4_lrange, color.black, color.black);

#Addcloud(NY_PM_Q4_hrange, NY_PM_Q4_lrange, color.black, color.black);

#############################################################################################################
#############################################################################################################
 
Last edited by a moderator:
Nice work @SJP07! I'm just getting into ICT concepts and this is going to help out a lot! Now I just need a better FVG indicator.
As someone who is an ICT trader the best indicator is you drawing them in. It trains your eye to spot them.
I went through different time frames and just kept drawing.
I first went the route of a few FVG indicators and to be honest just like Michael says you have to do the work to train your eye.
 
Here's a code that highlights the range for the Asian, London, NY AM, and NY PM sessions.

I need some assistance with extending each line until the end of the day.

Attached is the screenshot of what the code currently looks like. I really appreciate any help anyone can provide.
Ruby:
declare hide_on_daily;

input Show_Cloud = no;
input Show_Cloud2 = no;
input Show_Vertical_Line = no;

def Asian_DrawLine =
getLastDay() and
(
!secondsFromTime(1800) [1]
);

#AddVerticalLine (DrawLine, "", Color.Dark_black,Curve.Long_DASH);
AddVerticalLine (if Show_Vertical_Line then Asian_DrawLine else double.nan, "Asian", Color.black,Curve.Firm);


input ShowTodayOnly = yes;
def Today = if GetDay() == GetLastDay() then 0 else 1;
#def Today = if GetDay() == GetLastDay() then 1 else 0;
#def Show_last = if GetDay() >= GetLastDay() then 1 else 0;

###############################################
def midn = 0000;
def midnite = if (SecondsfromTime(midn) == 0) then 1 else 0;
###############################################


#############################################################################################################
#############################################################################################################

#Q1
def Asian_Q1_afterbegin = 1800;
#def Asian_Q1_afterend = 2359;
def Asian_Q1_aftermarket = SecondsFromTime(Asian_Q1_afterbegin[1]) >= 0 and (SecondsfromTime(midn) == 0) >= 0;
def Asian_Q1_bars = 2000;

#input Asian_Q1_pricePerRowHeightMode = { AUTOMATIC, default TICKSIZE, CUSTOM};
input Asian_Q1_pricePerRowHeightMode = { TICKSIZE, default AUTOMATIC, CUSTOM};

def Asian_Q1_customRowHeight = 1.0;
input Asian_Q1_timePerProfile = {default BAR};
def Asian_Q1_onExpansion = no;
def Asian_Q1_profiles = 1000;

def Asian_Q1_period;

switch (Asian_Q1_timePerProfile) {
case BAR:
Asian_Q1_period = BarNumber() - 1;
}


def Asian_Q1_count = CompoundValue(1, if Asian_Q1_aftermarket and Asian_Q1_period != Asian_Q1_period[1] then (Asian_Q1_count[1] + Asian_Q1_period - Asian_Q1_period[1]) % Asian_Q1_bars else Asian_Q1_count[1], 0);
def Asian_Q1_cond = Asian_Q1_count < Asian_Q1_count[1] + Asian_Q1_period - Asian_Q1_period[1];
def Asian_Q1_height;
switch (Asian_Q1_pricePerRowHeightMode) {
case AUTOMATIC:
Asian_Q1_height = PricePerRow.AUTOMATIC;
case TICKSIZE:
Asian_Q1_height = PricePerRow.TICKSIZE;
case CUSTOM:
Asian_Q1_height = Asian_Q1_customRowHeight;
}

profile Asian_Q1_vol = VolumeProfile("startNewProfile" = Asian_Q1_cond, "onExpansion" = no, "numberOfProfiles" = 1000, "pricePerRow" = Asian_Q1_height, "value area percent" = 0);

def Asian_Q1_con = CompoundValue(1, Asian_Q1_onExpansion, no);

def Asian_Q1_hProfile = if Asian_Q1_aftermarket and IsNaN(Asian_Q1_vol.GetHighest()) and Asian_Q1_con then Asian_Q1_hProfile[1] else Asian_Q1_vol.GetHighest();
def Asian_Q1_lProfile = if Asian_Q1_aftermarket and IsNaN(Asian_Q1_vol.GetLowest()) and Asian_Q1_con then Asian_Q1_lProfile[1] else Asian_Q1_vol.GetLowest();
def Asian_Q1_plotsDomain = IsNaN(close) == Asian_Q1_onExpansion;
def Asian_Q1_ProfileHigh = if Asian_Q1_aftermarket and Asian_Q1_plotsDomain then Asian_Q1_hProfile else Double.NaN;
def Asian_Q1_ProfileLow = if Asian_Q1_aftermarket and Asian_Q1_plotsDomain then Asian_Q1_lProfile else Double.NaN;

plot Asian_Q1_hrange = Asian_Q1_ProfileHigh;
plot Asian_Q1_lrange = Asian_Q1_ProfileLow;
Asian_Q1_hrange.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
Asian_Q1_lrange.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
Asian_Q1_hrange.SetDefaultColor(createcolor(204, 255, 204));
Asian_Q1_lrange.SetDefaultColor(createcolor(204, 255, 204));
Asian_Q1_hrange.SetLineWeight(1);
Asian_Q1_lrange.SetLineWeight(1);
#Asian_Q1_hrange.Hide();
#Asian_Q1_lrange.Hide();

def Asian_Q1_bubblemover = 0;
def Asian_Q1_b = Asian_Q1_bubblemover;
def Asian_Q1_b1 = Asian_Q1_b + 1;


input Asian_Q1_showbubbles = no;
AddChartBubble(Asian_Q1_showbubbles and (IsNaN(Asian_Q1_hrange[Asian_Q1_b1]) and Asian_Q1_hrange[Asian_Q1_b]) , Asian_Q1_hrange, AsText(Asian_Q1_hrange), Color.LIGHT_Red);

AddChartBubble(Asian_Q1_showbubbles and (IsNaN(Asian_Q1_hrange[Asian_Q1_b1]) and Asian_Q1_hrange[Asian_Q1_b]) , Asian_Q1_lrange, AsText(Asian_Q1_lrange), Color.LIGHT_Green, up = no);

input Asian_Q1_showverticalline = no;
AddVerticalLine(Asian_Q1_showverticalline and Asian_Q1_hrange != Asian_Q1_hrange[1], "", Color.BLUE, stroke = Curve.FIRM);

#Addcloud(hrange, lrange, createcolor(0, 51, 51), createcolor(0, 51, 51));
Addcloud(if Show_Cloud then Asian_Q1_hrange else double.nan, Asian_Q1_lrange, createcolor(204, 255, 204), createcolor(204, 255, 204));

Addcloud(if Show_Cloud2 then Asian_Q1_hrange else double.nan, Asian_Q1_lrange, color.black, color.black);

#Addcloud(Asian_Q1_hrange, Asian_Q1_lrange, color.black, color.black);


###############################################################
###############################################################
###############################################################
#LONDON

def London_Q2_afterbegin = midn;
def London_Q2_afterend = 0600;
def London_Q2_aftermarket = SecondsFromTime(London_Q2_afterbegin) >= 0 and SecondsTillTime(London_Q2_afterend) >= 0;
def London_Q2_bars = 2000;

#input London_Q2_pricePerRowHeightMode = { AUTOMATIC, default TICKSIZE, CUSTOM};
input London_Q2_pricePerRowHeightMode = { TICKSIZE, default AUTOMATIC, CUSTOM};

def London_Q2_customRowHeight = 1.0;
input London_Q2_timePerProfile = {default BAR};
def London_Q2_onExpansion = no;
def London_Q2_profiles = 1000;

def London_Q2_period;

switch (London_Q2_timePerProfile) {
case BAR:
London_Q2_period = BarNumber() - 1;
}


def London_Q2_count = CompoundValue(1, if London_Q2_aftermarket and London_Q2_period != London_Q2_period[1] then (London_Q2_count[1] + London_Q2_period - London_Q2_period[1]) % London_Q2_bars else London_Q2_count[1], 0);
def London_Q2_cond = London_Q2_count < London_Q2_count[1] + London_Q2_period - London_Q2_period[1];
def London_Q2_height;
switch (London_Q2_pricePerRowHeightMode) {
case AUTOMATIC:
London_Q2_height = PricePerRow.AUTOMATIC;
case TICKSIZE:
London_Q2_height = PricePerRow.TICKSIZE;
case CUSTOM:
London_Q2_height = London_Q2_customRowHeight;
}

profile London_Q2_vol = VolumeProfile("startNewProfile" = London_Q2_cond, "onExpansion" = no, "numberOfProfiles" = 1000, "pricePerRow" = London_Q2_height, "value area percent" = 0);

def London_Q2_con = CompoundValue(1, London_Q2_onExpansion, no);

def London_Q2_hProfile = if London_Q2_aftermarket and IsNaN(London_Q2_vol.GetHighest()) and London_Q2_con then London_Q2_hProfile[1] else London_Q2_vol.GetHighest();
def London_Q2_lProfile = if London_Q2_aftermarket and IsNaN(London_Q2_vol.GetLowest()) and London_Q2_con then London_Q2_lProfile[1] else London_Q2_vol.GetLowest();
def London_Q2_plotsDomain = IsNaN(close) == London_Q2_onExpansion;
def London_Q2_ProfileHigh = if London_Q2_aftermarket and London_Q2_plotsDomain then London_Q2_hProfile else Double.NaN;
def London_Q2_ProfileLow = if London_Q2_aftermarket and London_Q2_plotsDomain then London_Q2_lProfile else Double.NaN;

plot London_Q2_hrange = London_Q2_ProfileHigh;
plot London_Q2_lrange = London_Q2_ProfileLow;
London_Q2_hrange.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
London_Q2_lrange.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
London_Q2_hrange.SetDefaultColor(createcolor(153, 153 ,255));
London_Q2_lrange.SetDefaultColor(createcolor(153, 153 ,255));
London_Q2_hrange.SetLineWeight(1);
London_Q2_lrange.SetLineWeight(1);
#London_Q2_hrange.Hide();
#London_Q2_lrange.Hide();

def London_Q2_bubblemover = 0;
def London_Q2_b = London_Q2_bubblemover;
def London_Q2_b1 = London_Q2_b + 1;


input London_Q2_showbubbles = no;
AddChartBubble(London_Q2_showbubbles and (IsNaN(London_Q2_hrange[London_Q2_b1]) and London_Q2_hrange[London_Q2_b]) , London_Q2_hrange, AsText(London_Q2_hrange), Color.LIGHT_Red);

AddChartBubble(London_Q2_showbubbles and (IsNaN(London_Q2_hrange[London_Q2_b1]) and London_Q2_hrange[London_Q2_b]) , London_Q2_lrange, AsText(London_Q2_lrange), Color.LIGHT_Green, up = no);

input London_Q2_showverticalline = no;
AddVerticalLine(London_Q2_showverticalline and London_Q2_hrange != London_Q2_hrange[1], "", Color.BLUE, stroke = Curve.FIRM);

#Addcloud(hrange, lrange, createcolor(0, 51, 51), createcolor(0, 51, 51));
Addcloud(if Show_Cloud then London_Q2_hrange else double.nan, London_Q2_lrange, createcolor(153, 153 ,255), createcolor(153, 153 ,255));

Addcloud(if Show_Cloud2 then London_Q2_hrange else double.nan, London_Q2_lrange, color.black, color.black);


#Addcloud(London_Q2_hrange, London_Q2_lrange, color.black, color.black);

#############################################################################################################
#############################################################################################################

#############################################################################################################
#############################################################################################################
def NY_DrawLine =
getDay() == getLastDay() and
(
!secondsFromTime(0600)
);

#AddVerticalLine (DrawLine, "", Color.Dark_black,Curve.Long_DASH);
AddVerticalLine (if Show_Vertical_Line then NY_Drawline else double.nan, "NY AM", Color.black,Curve.Firm);

def Show_last = if GetDay() == GetLastDay() then 1 else 0;

#############################################################################################################
#############################################################################################################

#Q3
def NY_Q3_afterbegin = 0600;
def NY_Q3_afterend = 1200;
def NY_Q3_aftermarket = SecondsFromTime(NY_Q3_afterbegin) >= 0 and SecondsTillTime(NY_Q3_afterend) >= 0;
def NY_Q3_bars = 2000;

#input NY_Q3_pricePerRowHeightMode = { AUTOMATIC, default TICKSIZE, CUSTOM};
input NY_Q3_pricePerRowHeightMode = { TICKSIZE, default AUTOMATIC, CUSTOM};

def NY_Q3_customRowHeight = 1.0;
input NY_Q3_timePerProfile = {default BAR};
def NY_Q3_onExpansion = no;
def NY_Q3_profiles = 1000;

def NY_Q3_period;

switch (NY_Q3_timePerProfile) {
case BAR:
NY_Q3_period = BarNumber() - 1;
}


def NY_Q3_count = CompoundValue(1, if NY_Q3_aftermarket and NY_Q3_period != NY_Q3_period[1] then (NY_Q3_count[1] + NY_Q3_period - NY_Q3_period[1]) % NY_Q3_bars else NY_Q3_count[1], 0);
def NY_Q3_cond = NY_Q3_count < NY_Q3_count[1] + NY_Q3_period - NY_Q3_period[1];
def NY_Q3_height;
switch (NY_Q3_pricePerRowHeightMode) {
case AUTOMATIC:
NY_Q3_height = PricePerRow.AUTOMATIC;
case TICKSIZE:
NY_Q3_height = PricePerRow.TICKSIZE;
case CUSTOM:
NY_Q3_height = NY_Q3_customRowHeight;
}

profile NY_Q3_vol = VolumeProfile("startNewProfile" = NY_Q3_cond, "onExpansion" = no, "numberOfProfiles" = 1000, "pricePerRow" = NY_Q3_height, "value area percent" = 0);

def NY_Q3_con = CompoundValue(1, NY_Q3_onExpansion, no);

def NY_Q3_hProfile = if NY_Q3_aftermarket and IsNaN(NY_Q3_vol.GetHighest()) and NY_Q3_con then NY_Q3_hProfile[1] else NY_Q3_vol.GetHighest();
def NY_Q3_lProfile = if NY_Q3_aftermarket and IsNaN(NY_Q3_vol.GetLowest()) and NY_Q3_con then NY_Q3_lProfile[1] else NY_Q3_vol.GetLowest();
def NY_Q3_plotsDomain = IsNaN(close) == NY_Q3_onExpansion;
def NY_Q3_ProfileHigh = if NY_Q3_aftermarket and NY_Q3_plotsDomain then NY_Q3_hProfile else Double.NaN;
def NY_Q3_ProfileLow = if NY_Q3_aftermarket and NY_Q3_plotsDomain then NY_Q3_lProfile else Double.NaN;

plot NY_Q3_hrange = NY_Q3_ProfileHigh;
plot NY_Q3_lrange = NY_Q3_ProfileLow;
NY_Q3_hrange.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
NY_Q3_lrange.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
NY_Q3_hrange.SetDefaultColor(createcolor(0, 153, 255));
NY_Q3_lrange.SetDefaultColor(createcolor(0, 153, 255));
NY_Q3_hrange.SetLineWeight(1);
NY_Q3_lrange.SetLineWeight(1);
#NY_Q3_hrange.Hide();
#NY_Q3_lrange.Hide();

def NY_Q3_bubblemover = 0;
def NY_Q3_b = NY_Q3_bubblemover;
def NY_Q3_b1 = NY_Q3_b + 1;


input NY_Q3_showbubbles = no;
AddChartBubble(NY_Q3_showbubbles and (IsNaN(NY_Q3_hrange[NY_Q3_b1]) and NY_Q3_hrange[NY_Q3_b]) , NY_Q3_hrange, AsText(NY_Q3_hrange), Color.LIGHT_Red);

AddChartBubble(NY_Q3_showbubbles and (IsNaN(NY_Q3_hrange[NY_Q3_b1]) and NY_Q3_hrange[NY_Q3_b]) , NY_Q3_lrange, AsText(NY_Q3_lrange), Color.LIGHT_Green, up = no);

input NY_Q3_showverticalline = no;
AddVerticalLine(NY_Q3_showverticalline and NY_Q3_hrange != NY_Q3_hrange[1], "", Color.BLUE, stroke = Curve.FIRM);

#Addcloud(hrange, lrange, createcolor(0, 51, 51), createcolor(0, 51, 51));
Addcloud(if Show_Cloud then NY_Q3_hrange else double.nan, NY_Q3_lrange, createcolor(0, 153, 255), createcolor(0, 153, 255));

Addcloud(if Show_Cloud2 then NY_Q3_hrange else double.nan, NY_Q3_lrange, color.black, color.black);

#Addcloud(NY_Q3_hrange, NY_Q3_lrange, color.black, color.black);

#############################################################################################################
#############################################################################################################

def NY_PM_DrawLine =
getDay() == getLastDay() and
(
!secondsFromTime(1200)
);

#AddVerticalLine (DrawLine, "", Color.Dark_black,Curve.Long_DASH);
AddVerticalLine (if Show_Vertical_Line then NY_PM_DrawLine else double.nan, "NY PM", Color.black,Curve.Firm);



#############################################################################################################
#############################################################################################################

#Q4
def NY_PM_Q4_afterbegin = 1200;
def NY_PM_Q4_afterend = 1800;
def NY_PM_Q4_aftermarket = SecondsFromTime(NY_PM_Q4_afterbegin) >= 0 and SecondsTillTime(NY_PM_Q4_afterend) >= 0;
def NY_PM_Q4_bars = 2000;

#input NY_PM_Q4_pricePerRowHeightMode = { AUTOMATIC, default TICKSIZE, CUSTOM};
input NY_PM_Q4_pricePerRowHeightMode = { TICKSIZE, default AUTOMATIC, CUSTOM};

def NY_PM_Q4_customRowHeight = 1.0;
input NY_PM_Q4_timePerProfile = {default BAR};
def NY_PM_Q4_onExpansion = no;
def NY_PM_Q4_profiles = 1000;

def NY_PM_Q4_period;

switch (NY_PM_Q4_timePerProfile) {
case BAR:
NY_PM_Q4_period = BarNumber() - 1;
}


def NY_PM_Q4_count = CompoundValue(1, if NY_PM_Q4_aftermarket and NY_PM_Q4_period != NY_PM_Q4_period[1] then (NY_PM_Q4_count[1] + NY_PM_Q4_period - NY_PM_Q4_period[1]) % NY_PM_Q4_bars else NY_PM_Q4_count[1], 0);
def NY_PM_Q4_cond = NY_PM_Q4_count < NY_PM_Q4_count[1] + NY_PM_Q4_period - NY_PM_Q4_period[1];
def NY_PM_Q4_height;
switch (NY_PM_Q4_pricePerRowHeightMode) {
case AUTOMATIC:
NY_PM_Q4_height = PricePerRow.AUTOMATIC;
case TICKSIZE:
NY_PM_Q4_height = PricePerRow.TICKSIZE;
case CUSTOM:
NY_PM_Q4_height = NY_PM_Q4_customRowHeight;
}

profile NY_PM_Q4_vol = VolumeProfile("startNewProfile" = NY_PM_Q4_cond, "onExpansion" = no, "numberOfProfiles" = 1000, "pricePerRow" = NY_PM_Q4_height, "value area percent" = 0);

def NY_PM_Q4_con = CompoundValue(1, NY_PM_Q4_onExpansion, no);

def NY_PM_Q4_hProfile = if NY_PM_Q4_aftermarket and IsNaN(NY_PM_Q4_vol.GetHighest()) and NY_PM_Q4_con then NY_PM_Q4_hProfile[1] else NY_PM_Q4_vol.GetHighest();
def NY_PM_Q4_lProfile = if NY_PM_Q4_aftermarket and IsNaN(NY_PM_Q4_vol.GetLowest()) and NY_PM_Q4_con then NY_PM_Q4_lProfile[1] else NY_PM_Q4_vol.GetLowest();
def NY_PM_Q4_plotsDomain = IsNaN(close) == NY_PM_Q4_onExpansion;
def NY_PM_Q4_ProfileHigh = if NY_PM_Q4_aftermarket and NY_PM_Q4_plotsDomain then NY_PM_Q4_hProfile else Double.NaN;
def NY_PM_Q4_ProfileLow = if NY_PM_Q4_aftermarket and NY_PM_Q4_plotsDomain then NY_PM_Q4_lProfile else Double.NaN;

plot NY_PM_Q4_hrange = NY_PM_Q4_ProfileHigh;
plot NY_PM_Q4_lrange = NY_PM_Q4_ProfileLow;
NY_PM_Q4_hrange.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
NY_PM_Q4_lrange.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
NY_PM_Q4_hrange.SetDefaultColor(createcolor(255, 153, 102));
NY_PM_Q4_lrange.SetDefaultColor(createcolor(255, 153, 102));
NY_PM_Q4_hrange.SetLineWeight(1);
NY_PM_Q4_lrange.SetLineWeight(1);
#NY_PM_Q4_hrange.Hide();
#NY_PM_Q4_lrange.Hide();

def NY_PM_Q4_bubblemover = 0;
def NY_PM_Q4_b = NY_PM_Q4_bubblemover;
def NY_PM_Q4_b1 = NY_PM_Q4_b + 1;


input NY_PM_Q4_showbubbles = no;
AddChartBubble(NY_PM_Q4_showbubbles and (IsNaN(NY_PM_Q4_hrange[NY_PM_Q4_b1]) and NY_PM_Q4_hrange[NY_PM_Q4_b]) , NY_PM_Q4_hrange, AsText(NY_PM_Q4_hrange), Color.LIGHT_Red);

AddChartBubble(NY_PM_Q4_showbubbles and (IsNaN(NY_PM_Q4_hrange[NY_PM_Q4_b1]) and NY_PM_Q4_hrange[NY_PM_Q4_b]) , NY_PM_Q4_lrange, AsText(NY_PM_Q4_lrange), Color.LIGHT_Green, up = no);

input NY_PM_Q4_showverticalline = no;
AddVerticalLine(NY_PM_Q4_showverticalline and NY_PM_Q4_hrange != NY_PM_Q4_hrange[1], "", Color.BLUE, stroke = Curve.FIRM);

#Addcloud(hrange, lrange, createcolor(0, 51, 51), createcolor(0, 51, 51));
Addcloud(if Show_Cloud then NY_PM_Q4_hrange else double.nan, NY_PM_Q4_lrange, createcolor(255, 153, 102), createcolor(255, 153, 102));

Addcloud(if Show_Cloud2 then NY_PM_Q4_hrange else double.nan, NY_PM_Q4_lrange, color.black, color.black);

#Addcloud(NY_PM_Q4_hrange, NY_PM_Q4_lrange, color.black, color.black);

#############################################################################################################
#############################################################################################################
View attachment 18986
How do I disable all prior high and low plots for all london, asia and ny session in such a way that it would only display me just one plot for each of london, asia and ny session? I do not want to clutter the chart with plots for all past times, it should instead show only 1 plot for each of those.
 
How do I disable all prior high and low plots for all london, asia and ny session in such a way that it would only display me just one plot for each of london, asia and ny session? I do not want to clutter the chart with plots for all past times, it should instead show only 1 plot for each of those.

Use input display_last_zone = yes; to only show the last plots of the zones
Code used from https://usethinkscript.com/threads/...time-labels-for-thinkorswim.15632/post-134698
Screenshot 2024-06-10 160626.png

Code:
declare hide_on_daily;

input display_last_zone = yes;
input Show_Cloud = no;
input Show_Cloud2 = no;
input Show_Vertical_Line = no;

def Asian_DrawLine =
GetLastDay() and
(
!SecondsFromTime(1800) [1]
);

#AddVerticalLine (DrawLine, "", Color.Dark_black,Curve.Long_DASH);
AddVerticalLine (if Show_Vertical_Line then Asian_DrawLine else Double.NaN, "Asian", Color.BLACK, Curve.FIRM);


#input ShowTodayOnly = yes;
#def Today = if GetDay() == GetLastDay() then 0 else 1;
#def Today = if GetDay() == GetLastDay() then 1 else 0;
#def Show_last = if GetDay() >= GetLastDay() then 1 else 0;

###############################################
def midn = 0000;
def midnite = if (SecondsFromTime(midn) == 0) then 1 else 0;
###############################################


#############################################################################################################
#############################################################################################################

#Q1
def Asian_Q1_afterbegin = 1800;
#def Asian_Q1_afterend = 2359;
def Asian_Q1_aftermarket = SecondsFromTime(Asian_Q1_afterbegin[1]) >= 0 and (SecondsFromTime(midn) == 0) >= 0;
def Asian_Q1_bars = 2000;

#input Asian_Q1_pricePerRowHeightMode = { AUTOMATIC, default TICKSIZE, CUSTOM};
input Asian_Q1_pricePerRowHeightMode = { TICKSIZE, default AUTOMATIC, CUSTOM};

def Asian_Q1_customRowHeight = 1.0;
input Asian_Q1_timePerProfile = {default BAR};
def Asian_Q1_onExpansion = no;
def Asian_Q1_profiles = 1000;

def Asian_Q1_period;

switch (Asian_Q1_timePerProfile) {
case BAR:
    Asian_Q1_period = BarNumber() - 1;
}


def Asian_Q1_count = CompoundValue(1, if Asian_Q1_aftermarket and Asian_Q1_period != Asian_Q1_period[1] then (Asian_Q1_count[1] + Asian_Q1_period - Asian_Q1_period[1]) % Asian_Q1_bars else Asian_Q1_count[1], 0);
def Asian_Q1_cond = Asian_Q1_count < Asian_Q1_count[1] + Asian_Q1_period - Asian_Q1_period[1];
def Asian_Q1_height;
switch (Asian_Q1_pricePerRowHeightMode) {
case AUTOMATIC:
    Asian_Q1_height = PricePerRow.AUTOMATIC;
case TICKSIZE:
    Asian_Q1_height = PricePerRow.TICKSIZE;
case CUSTOM:
    Asian_Q1_height = Asian_Q1_customRowHeight;
}

profile Asian_Q1_vol = VolumeProfile("startNewProfile" = Asian_Q1_cond, "onExpansion" = no, "numberOfProfiles" = 1000, "pricePerRow" = Asian_Q1_height, "value area percent" = 0);

def Asian_Q1_con = CompoundValue(1, Asian_Q1_onExpansion, no);

def Asian_Q1_hProfile = if Asian_Q1_aftermarket and IsNaN(Asian_Q1_vol.GetHighest()) and Asian_Q1_con then Asian_Q1_hProfile[1] else Asian_Q1_vol.GetHighest();
def Asian_Q1_lProfile = if Asian_Q1_aftermarket and IsNaN(Asian_Q1_vol.GetLowest()) and Asian_Q1_con then Asian_Q1_lProfile[1] else Asian_Q1_vol.GetLowest();
def Asian_Q1_plotsDomain = IsNaN(close) == Asian_Q1_onExpansion;
def Asian_Q1_ProfileHigh = if Asian_Q1_aftermarket and Asian_Q1_plotsDomain then Asian_Q1_hProfile else Double.NaN;
def Asian_Q1_ProfileLow = if Asian_Q1_aftermarket and Asian_Q1_plotsDomain then Asian_Q1_lProfile else Double.NaN;

def basis      = if TickSize() > .01 then GetYYYYMMDD() else GetDay();
def asiancount = if basis != basis[1] then  asiancount[1] + 1 else asiancount[1];
def asiancond  = HighestAll(asiancount) - asiancount + 1;

plot Asian_Q1_hrange = if display_last_zone and asiancond != 1 then Double.NaN else Asian_Q1_ProfileHigh;
plot Asian_Q1_lrange = if display_last_zone and asiancond != 1 then Double.NaN else Asian_Q1_ProfileLow;
Asian_Q1_hrange.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
Asian_Q1_lrange.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
Asian_Q1_hrange.SetDefaultColor(CreateColor(204, 255, 204));
Asian_Q1_lrange.SetDefaultColor(CreateColor(204, 255, 204));
Asian_Q1_hrange.SetLineWeight(1);
Asian_Q1_lrange.SetLineWeight(1);
#Asian_Q1_hrange.Hide();
#Asian_Q1_lrange.Hide();

def Asian_Q1_bubblemover = 0;
def Asian_Q1_b = Asian_Q1_bubblemover;
def Asian_Q1_b1 = Asian_Q1_b + 1;


input Asian_Q1_showbubbles = no;
AddChartBubble(Asian_Q1_showbubbles and (IsNaN(Asian_Q1_hrange[Asian_Q1_b1]) and Asian_Q1_hrange[Asian_Q1_b]) , Asian_Q1_hrange, AsText(Asian_Q1_hrange), Color.LIGHT_RED);

AddChartBubble(Asian_Q1_showbubbles and (IsNaN(Asian_Q1_hrange[Asian_Q1_b1]) and Asian_Q1_hrange[Asian_Q1_b]) , Asian_Q1_lrange, AsText(Asian_Q1_lrange), Color.LIGHT_GREEN, up = no);

input Asian_Q1_showverticalline = no;
AddVerticalLine(Asian_Q1_showverticalline and Asian_Q1_hrange != Asian_Q1_hrange[1], "", Color.BLUE, stroke = Curve.FIRM);

#Addcloud(hrange, lrange, createcolor(0, 51, 51), createcolor(0, 51, 51));
AddCloud(if Show_Cloud then Asian_Q1_hrange else Double.NaN, Asian_Q1_lrange, CreateColor(204, 255, 204), CreateColor(204, 255, 204));

AddCloud(if Show_Cloud2 then Asian_Q1_hrange else Double.NaN, Asian_Q1_lrange, Color.BLACK, Color.BLACK);

#Addcloud(Asian_Q1_hrange, Asian_Q1_lrange, color.black, color.black);


###############################################################
###############################################################
###############################################################
#LONDON

def London_Q2_afterbegin = midn;
def London_Q2_afterend = 0600;
def London_Q2_aftermarket = SecondsFromTime(London_Q2_afterbegin) >= 0 and SecondsTillTime(London_Q2_afterend) >= 0;
def London_Q2_bars = 2000;

#input London_Q2_pricePerRowHeightMode = { AUTOMATIC, default TICKSIZE, CUSTOM};
input London_Q2_pricePerRowHeightMode = { TICKSIZE, default AUTOMATIC, CUSTOM};

def London_Q2_customRowHeight = 1.0;
input London_Q2_timePerProfile = {default BAR};
def London_Q2_onExpansion = no;
def London_Q2_profiles = 1000;

def London_Q2_period;

switch (London_Q2_timePerProfile) {
case BAR:
    London_Q2_period = BarNumber() - 1;
}


def London_Q2_count = CompoundValue(1, if London_Q2_aftermarket and London_Q2_period != London_Q2_period[1] then (London_Q2_count[1] + London_Q2_period - London_Q2_period[1]) % London_Q2_bars else London_Q2_count[1], 0);
def London_Q2_cond = London_Q2_count < London_Q2_count[1] + London_Q2_period - London_Q2_period[1];
def London_Q2_height;
switch (London_Q2_pricePerRowHeightMode) {
case AUTOMATIC:
    London_Q2_height = PricePerRow.AUTOMATIC;
case TICKSIZE:
    London_Q2_height = PricePerRow.TICKSIZE;
case CUSTOM:
    London_Q2_height = London_Q2_customRowHeight;
}

profile London_Q2_vol = VolumeProfile("startNewProfile" = London_Q2_cond, "onExpansion" = no, "numberOfProfiles" = 1000, "pricePerRow" = London_Q2_height, "value area percent" = 0);

def London_Q2_con = CompoundValue(1, London_Q2_onExpansion, no);

def London_Q2_hProfile = if London_Q2_aftermarket and IsNaN(London_Q2_vol.GetHighest()) and London_Q2_con then London_Q2_hProfile[1] else London_Q2_vol.GetHighest();
def London_Q2_lProfile = if London_Q2_aftermarket and IsNaN(London_Q2_vol.GetLowest()) and London_Q2_con then London_Q2_lProfile[1] else London_Q2_vol.GetLowest();
def London_Q2_plotsDomain = IsNaN(close) == London_Q2_onExpansion;
def London_Q2_ProfileHigh = if London_Q2_aftermarket and London_Q2_plotsDomain then London_Q2_hProfile else Double.NaN;
def London_Q2_ProfileLow = if London_Q2_aftermarket and London_Q2_plotsDomain then London_Q2_lProfile else Double.NaN;

def londoncount = if basis != basis[1] then  londoncount[1] + 1 else londoncount[1];
def londoncond  = HighestAll(londoncount) - londoncount + 1;

plot London_Q2_hrange = if display_last_zone and londoncond != 1 then Double.NaN else London_Q2_ProfileHigh;
plot London_Q2_lrange = if display_last_zone and londoncond != 1 then Double.NaN else London_Q2_ProfileLow;
London_Q2_hrange.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
London_Q2_lrange.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
London_Q2_hrange.SetDefaultColor(CreateColor(153, 153 , 255));
London_Q2_lrange.SetDefaultColor(CreateColor(153, 153 , 255));
London_Q2_hrange.SetLineWeight(1);
London_Q2_lrange.SetLineWeight(1);
#London_Q2_hrange.Hide();
#London_Q2_lrange.Hide();

def London_Q2_bubblemover = 0;
def London_Q2_b = London_Q2_bubblemover;
def London_Q2_b1 = London_Q2_b + 1;


input London_Q2_showbubbles = no;
AddChartBubble(London_Q2_showbubbles and (IsNaN(London_Q2_hrange[London_Q2_b1]) and London_Q2_hrange[London_Q2_b]) , London_Q2_hrange, AsText(London_Q2_hrange), Color.LIGHT_RED);

AddChartBubble(London_Q2_showbubbles and (IsNaN(London_Q2_hrange[London_Q2_b1]) and London_Q2_hrange[London_Q2_b]) , London_Q2_lrange, AsText(London_Q2_lrange), Color.LIGHT_GREEN, up = no);

input London_Q2_showverticalline = no;
AddVerticalLine(London_Q2_showverticalline and London_Q2_hrange != London_Q2_hrange[1], "", Color.BLUE, stroke = Curve.FIRM);

#Addcloud(hrange, lrange, createcolor(0, 51, 51), createcolor(0, 51, 51));
AddCloud(if Show_Cloud then London_Q2_hrange else Double.NaN, London_Q2_lrange, CreateColor(153, 153 , 255), CreateColor(153, 153 , 255));

AddCloud(if Show_Cloud2 then London_Q2_hrange else Double.NaN, London_Q2_lrange, Color.BLACK, Color.BLACK);


#Addcloud(London_Q2_hrange, London_Q2_lrange, color.black, color.black);

#############################################################################################################
#############################################################################################################

#############################################################################################################
#############################################################################################################
def NY_DrawLine =
GetDay() == GetLastDay() and
(
!SecondsFromTime(0600)
);

#AddVerticalLine (DrawLine, "", Color.Dark_black,Curve.Long_DASH);
AddVerticalLine (if Show_Vertical_Line then NY_DrawLine else Double.NaN, "NY AM", Color.BLACK, Curve.FIRM);

def Show_last = if GetDay() == GetLastDay() then 1 else 0;

#############################################################################################################
#############################################################################################################

#Q3
def NY_Q3_afterbegin = 0600;
def NY_Q3_afterend = 1200;
def NY_Q3_aftermarket = SecondsFromTime(NY_Q3_afterbegin) >= 0 and SecondsTillTime(NY_Q3_afterend) >= 0;
def NY_Q3_bars = 2000;

#input NY_Q3_pricePerRowHeightMode = { AUTOMATIC, default TICKSIZE, CUSTOM};
input NY_Q3_pricePerRowHeightMode = { TICKSIZE, default AUTOMATIC, CUSTOM};

def NY_Q3_customRowHeight = 1.0;
input NY_Q3_timePerProfile = {default BAR};
def NY_Q3_onExpansion = no;
def NY_Q3_profiles = 1000;

def NY_Q3_period;

switch (NY_Q3_timePerProfile) {
case BAR:
    NY_Q3_period = BarNumber() - 1;
}


def NY_Q3_count = CompoundValue(1, if NY_Q3_aftermarket and NY_Q3_period != NY_Q3_period[1] then (NY_Q3_count[1] + NY_Q3_period - NY_Q3_period[1]) % NY_Q3_bars else NY_Q3_count[1], 0);
def NY_Q3_cond = NY_Q3_count < NY_Q3_count[1] + NY_Q3_period - NY_Q3_period[1];
def NY_Q3_height;
switch (NY_Q3_pricePerRowHeightMode) {
case AUTOMATIC:
    NY_Q3_height = PricePerRow.AUTOMATIC;
case TICKSIZE:
    NY_Q3_height = PricePerRow.TICKSIZE;
case CUSTOM:
    NY_Q3_height = NY_Q3_customRowHeight;
}

profile NY_Q3_vol = VolumeProfile("startNewProfile" = NY_Q3_cond, "onExpansion" = no, "numberOfProfiles" = 1000, "pricePerRow" = NY_Q3_height, "value area percent" = 0);

def NY_Q3_con = CompoundValue(1, NY_Q3_onExpansion, no);

def NY_Q3_hProfile = if NY_Q3_aftermarket and IsNaN(NY_Q3_vol.GetHighest()) and NY_Q3_con then NY_Q3_hProfile[1] else NY_Q3_vol.GetHighest();
def NY_Q3_lProfile = if NY_Q3_aftermarket and IsNaN(NY_Q3_vol.GetLowest()) and NY_Q3_con then NY_Q3_lProfile[1] else NY_Q3_vol.GetLowest();
def NY_Q3_plotsDomain = IsNaN(close) == NY_Q3_onExpansion;
def NY_Q3_ProfileHigh = if NY_Q3_aftermarket and NY_Q3_plotsDomain then NY_Q3_hProfile else Double.NaN;
def NY_Q3_ProfileLow = if NY_Q3_aftermarket and NY_Q3_plotsDomain then NY_Q3_lProfile else Double.NaN;

def nyq3count = if basis != basis[1] then  nyq3count[1] + 1 else nyq3count[1];
def nyq3cond  = HighestAll(nyq3count) - nyq3count + 1;

plot NY_Q3_hrange = if display_last_zone and nyq3cond != 1 then Double.NaN else NY_Q3_ProfileHigh;
plot NY_Q3_lrange = if display_last_zone and nyq3cond != 1 then Double.NaN else NY_Q3_ProfileLow;
NY_Q3_hrange.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
NY_Q3_lrange.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
NY_Q3_hrange.SetDefaultColor(CreateColor(0, 153, 255));
NY_Q3_lrange.SetDefaultColor(CreateColor(0, 153, 255));
NY_Q3_hrange.SetLineWeight(1);
NY_Q3_lrange.SetLineWeight(1);
#NY_Q3_hrange.Hide();
#NY_Q3_lrange.Hide();

def NY_Q3_bubblemover = 0;
def NY_Q3_b = NY_Q3_bubblemover;
def NY_Q3_b1 = NY_Q3_b + 1;


input NY_Q3_showbubbles = no;
AddChartBubble(NY_Q3_showbubbles and (IsNaN(NY_Q3_hrange[NY_Q3_b1]) and NY_Q3_hrange[NY_Q3_b]) , NY_Q3_hrange, AsText(NY_Q3_hrange), Color.LIGHT_RED);

AddChartBubble(NY_Q3_showbubbles and (IsNaN(NY_Q3_hrange[NY_Q3_b1]) and NY_Q3_hrange[NY_Q3_b]) , NY_Q3_lrange, AsText(NY_Q3_lrange), Color.LIGHT_GREEN, up = no);

input NY_Q3_showverticalline = no;
AddVerticalLine(NY_Q3_showverticalline and NY_Q3_hrange != NY_Q3_hrange[1], "", Color.BLUE, stroke = Curve.FIRM);

#Addcloud(hrange, lrange, createcolor(0, 51, 51), createcolor(0, 51, 51));
AddCloud(if Show_Cloud then NY_Q3_hrange else Double.NaN, NY_Q3_lrange, CreateColor(0, 153, 255), CreateColor(0, 153, 255));

AddCloud(if Show_Cloud2 then NY_Q3_hrange else Double.NaN, NY_Q3_lrange, Color.BLACK, Color.BLACK);

#Addcloud(NY_Q3_hrange, NY_Q3_lrange, color.black, color.black);

#############################################################################################################
#############################################################################################################

def NY_PM_DrawLine =
GetDay() == GetLastDay() and
(
!SecondsFromTime(1200)
);

#AddVerticalLine (DrawLine, "", Color.Dark_black,Curve.Long_DASH);
AddVerticalLine (if Show_Vertical_Line then NY_PM_DrawLine else Double.NaN, "NY PM", Color.BLACK, Curve.FIRM);



#############################################################################################################
#############################################################################################################

#Q4
def NY_PM_Q4_afterbegin = 1200;
def NY_PM_Q4_afterend = 1800;
def NY_PM_Q4_aftermarket = SecondsFromTime(NY_PM_Q4_afterbegin) >= 0 and SecondsTillTime(NY_PM_Q4_afterend) >= 0;
def NY_PM_Q4_bars = 2000;

#input NY_PM_Q4_pricePerRowHeightMode = { AUTOMATIC, default TICKSIZE, CUSTOM};
input NY_PM_Q4_pricePerRowHeightMode = { TICKSIZE, default AUTOMATIC, CUSTOM};

def NY_PM_Q4_customRowHeight = 1.0;
input NY_PM_Q4_timePerProfile = {default BAR};
def NY_PM_Q4_onExpansion = no;
def NY_PM_Q4_profiles = 1000;

def NY_PM_Q4_period;

switch (NY_PM_Q4_timePerProfile) {
case BAR:
    NY_PM_Q4_period = BarNumber() - 1;
}


def NY_PM_Q4_count = CompoundValue(1, if NY_PM_Q4_aftermarket and NY_PM_Q4_period != NY_PM_Q4_period[1] then (NY_PM_Q4_count[1] + NY_PM_Q4_period - NY_PM_Q4_period[1]) % NY_PM_Q4_bars else NY_PM_Q4_count[1], 0);
def NY_PM_Q4_cond = NY_PM_Q4_count < NY_PM_Q4_count[1] + NY_PM_Q4_period - NY_PM_Q4_period[1];
def NY_PM_Q4_height;
switch (NY_PM_Q4_pricePerRowHeightMode) {
case AUTOMATIC:
    NY_PM_Q4_height = PricePerRow.AUTOMATIC;
case TICKSIZE:
    NY_PM_Q4_height = PricePerRow.TICKSIZE;
case CUSTOM:
    NY_PM_Q4_height = NY_PM_Q4_customRowHeight;
}

profile NY_PM_Q4_vol = VolumeProfile("startNewProfile" = NY_PM_Q4_cond, "onExpansion" = no, "numberOfProfiles" = 1000, "pricePerRow" = NY_PM_Q4_height, "value area percent" = 0);

def NY_PM_Q4_con = CompoundValue(1, NY_PM_Q4_onExpansion, no);

def NY_PM_Q4_hProfile = if NY_PM_Q4_aftermarket and IsNaN(NY_PM_Q4_vol.GetHighest()) and NY_PM_Q4_con then NY_PM_Q4_hProfile[1] else NY_PM_Q4_vol.GetHighest();
def NY_PM_Q4_lProfile = if NY_PM_Q4_aftermarket and IsNaN(NY_PM_Q4_vol.GetLowest()) and NY_PM_Q4_con then NY_PM_Q4_lProfile[1] else NY_PM_Q4_vol.GetLowest();
def NY_PM_Q4_plotsDomain = IsNaN(close) == NY_PM_Q4_onExpansion;
def NY_PM_Q4_ProfileHigh = if NY_PM_Q4_aftermarket and NY_PM_Q4_plotsDomain then NY_PM_Q4_hProfile else Double.NaN;
def NY_PM_Q4_ProfileLow = if NY_PM_Q4_aftermarket and NY_PM_Q4_plotsDomain then NY_PM_Q4_lProfile else Double.NaN;

def nyq4count = if basis != basis[1] then  nyq4count[1] + 1 else nyq4count[1];
def nyq4cond  = HighestAll(nyq4count) - nyq4count + 1;

plot NY_PM_Q4_hrange = if display_last_zone and nyq4cond != 1 then Double.NaN else NY_PM_Q4_ProfileHigh;
plot NY_PM_Q4_lrange = if display_last_zone and nyq4cond != 1 then Double.NaN else NY_PM_Q4_ProfileLow;
NY_PM_Q4_hrange.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
NY_PM_Q4_lrange.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
NY_PM_Q4_hrange.SetDefaultColor(CreateColor(255, 153, 102));
NY_PM_Q4_lrange.SetDefaultColor(CreateColor(255, 153, 102));
NY_PM_Q4_hrange.SetLineWeight(1);
NY_PM_Q4_lrange.SetLineWeight(1);
#NY_PM_Q4_hrange.Hide();
#NY_PM_Q4_lrange.Hide();

def NY_PM_Q4_bubblemover = 0;
def NY_PM_Q4_b = NY_PM_Q4_bubblemover;
def NY_PM_Q4_b1 = NY_PM_Q4_b + 1;


input NY_PM_Q4_showbubbles = no;
AddChartBubble(NY_PM_Q4_showbubbles and (IsNaN(NY_PM_Q4_hrange[NY_PM_Q4_b1]) and NY_PM_Q4_hrange[NY_PM_Q4_b]) , NY_PM_Q4_hrange, AsText(NY_PM_Q4_hrange), Color.LIGHT_RED);

AddChartBubble(NY_PM_Q4_showbubbles and (IsNaN(NY_PM_Q4_hrange[NY_PM_Q4_b1]) and NY_PM_Q4_hrange[NY_PM_Q4_b]) , NY_PM_Q4_lrange, AsText(NY_PM_Q4_lrange), Color.LIGHT_GREEN, up = no);

input NY_PM_Q4_showverticalline = no;
AddVerticalLine(NY_PM_Q4_showverticalline and NY_PM_Q4_hrange != NY_PM_Q4_hrange[1], "", Color.BLUE, stroke = Curve.FIRM);

#Addcloud(hrange, lrange, createcolor(0, 51, 51), createcolor(0, 51, 51));
AddCloud(if Show_Cloud then NY_PM_Q4_hrange else Double.NaN, NY_PM_Q4_lrange, CreateColor(255, 153, 102), CreateColor(255, 153, 102));

AddCloud(if Show_Cloud2 then NY_PM_Q4_hrange else Double.NaN, NY_PM_Q4_lrange, Color.BLACK, Color.BLACK);

#Addcloud(NY_PM_Q4_hrange, NY_PM_Q4_lrange, color.black, color.black);

#############################################################################################################
#############################################################################################################
 
Last edited:
It looks like you are testing it over the weekend when TOS is in maintenance mode.
I just tested it this morning and it works on 1m and 5m charts
I tested after 7 PM PST yesterday, it didn't show anything but it was showing plots on 1 min, just not on 5 min. It would be great if it can be tweaked to get it worked during all time.
 
I tested after 7 PM PST yesterday, it didn't show anything but it was showing plots on 1 min, just not on 5 min. It would be great if it can be tweaked to get it worked during all time.

"not working" is not enough information to say where you have gone astray.

If you provide a shared chart link, members will be able to see what you are seeing and provide more constructive feedback.

How to create a shared chart link:
https://usethinkscript.com/threads/how-to-share-a-chart-in-thinkorswim.14221/
 
Last edited by a moderator:
I tested after 7 PM PST yesterday, it didn't show anything but it was showing plots on 1 min, just not on 5 min. It would be great if it can be tweaked to get it worked during all time.
My post above had a 5m chart with it working.
So I need to know what chart informtion you are having an issue (symbol, timeframe) so that I can try to help you.
 
My post above had a 5m chart with it working.
So I need to know what chart informtion you are having an issue (symbol, timeframe) so that I can try to help you.
I tried it on /ES, /NQ again today at 8:20 PM PST and it shows plots only on 1 min.

Tried all other timeframes like 5 min, 15 min, 30 min, 1 hr, 4 hr and it doesn't show the plots although I noticed that last zone plot appears for a couple of seconds and then disappears quickly.

Here is my link: http://tos.mx/!F0enRDiB
 
I tried it on /ES, /NQ again today at 8:20 PM PST and it shows plots only on 1 min.

Tried all other timeframes like 5 min, 15 min, 30 min, 1 hr, 4 hr and it doesn't show the plots although I noticed that last zone plot appears for a couple of seconds and then disappears quickly.

Here is my link: http://tos.mx/!F0enRDiB

Thank you for providing the additional information.

I have replaced the code in post #12. It now seems to include the last plots for futures.

This example is the part of the code that determines what is the last plots. Before it used a basis of just getday(), which worked for stocks and sorta worked for futures. Now for futures, it uses getyyyymmdd(), which includes trading hours starting in the previous day, for example at 1800 vs getdaty(), which starts at 0400.

Screenshot 2024-06-12 040417.jpg
Code:
def basis      = if TickSize() > .01 then GetYYYYMMDD() else GetDay();
def asiancount = if basis != basis[1] then  asiancount[1] + 1 else asiancount[1];
def asiancond  = HighestAll(asiancount) - asiancount + 1;

plot Asian_Q1_hrange = if display_last_zone and asiancond != 1 then Double.NaN else Asian_Q1_ProfileHigh;
plot Asian_Q1_lrange = if display_last_zone and asiancond != 1 then Double.NaN else Asian_Q1_ProfileLow;
 
Thank you for providing the additional information.

I have replaced the code in post #12. It now seems to include the last plots for futures.

This example is the part of the code that determines what is the last plots. Before it used a basis of just getday(), which worked for stocks and sorta worked for futures. Now for futures, it uses getyyyymmdd(), which includes trading hours starting in the previous day, for example at 1800 vs getdaty(), which starts at 0400.
Hello @SleepyZ Thanks again for your prompt reply and patience. Yes, now I can see that its working as expected on all timeframes but I was expecting to have all last session plots and not just one last plot. Would that be possible to have one latest plot of each sessions for asia, london, ny, etc? As of now, it shows just the last current running session.

Can the same logic be applied to vertical lines to show them only for last latest session for asia, london and newyork?

Ideally, code should have show_last session_only flag which if set to true, should show only last plots for each asia, london, ny session and vertical lines.

I truly appreciate all your help and thanks again for your efforts.
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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