One Setup for Life ICT.txt
Copy
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Giovanni-1-
//Credit for open source code:
//@joshuuu
//@version=5
indicator('One Setup for Life ICT' , overlay = true , precision = 0 , max_boxes_count = 500 , max_labels_count = 500 , max_lines_count = 500 , max_bars_back = 500)
max_tf = input.int(defval = 15 , title = 'Max TF Show ' , maxval = 60 , inline = '0' , group = 'Input')
Timezone = 'America/New_York'
DOM = (timeframe.multiplier <= max_tf) and (timeframe.isintraday)
//--------------
//---Function
//--------------
is_newbar(sess) =>
t = time('D', sess, Timezone)
na(t[1]) and not na(t) or t[1] < t
is_session(sess) =>
not na(time('D', sess, Timezone))
//--------------
//---End Function
//--------------
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------//
// Divider Daily and open NY
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------//
//---Input
show_daily= input.bool(defval = true , title = 'Daily' , inline = 'divider' , inline = '0' , group = 'Divider')
col_D = input.color(defval = color.new(color.gray,85) , title = '' , inline = '0' , group = 'Divider')
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------//
// Silver Bullet
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------//
//---Br
show_BR_Sess = input.bool(defval = false , title = 'Session' , inline = '0' , group = 'Background')
show_BR_SB = input.bool(defval = false , title = 'Silver Bullet' , inline = '0' , group = 'Background')
show_BR_LN = input.bool(defval = false , title = 'LN' , inline = '1' , group = 'Background')
show_BR_NY = input.bool(defval = false , title = 'NY' , inline = '1' , group = 'Background')
show_BR_PM = input.bool(defval = false , title = 'PM' , inline = '1' , group = 'Background')
BarInSession(sess) =>
time(timeframe.period, sess, Timezone) != 0
chartColour1 = DOM and show_BR_Sess and show_BR_LN and BarInSession('0200-0500') ? color.new(color.blue , 97) : na
bgcolor(color = chartColour1 , title = 'Session LN' , transp = 95)
chartColour2 = DOM and show_BR_Sess and show_BR_NY and BarInSession('0930-1200') ? color.new(color.red , 97) : na
bgcolor(color = chartColour2 , title = 'Session NY' , transp = 95)
chartColour3 = DOM and show_BR_Sess and show_BR_PM and BarInSession('1330-1600') ? color.new(color.purple , 97) : na
bgcolor(color = chartColour3 , title = 'Session PM' , transp = 95)
chartColour4 = DOM and show_BR_SB and show_BR_LN and BarInSession('0300-0400') ? color.new(color.blue , 90) : na
bgcolor(color = chartColour4 , title = 'Silver Bullet London' , transp = 95)
chartColour5 = DOM and show_BR_SB and show_BR_NY and BarInSession('1000-1100') ? color.new(color.red , 90) : na
bgcolor(color = chartColour5 , title = 'Silver Bullet NewYork' , transp = 95)
chartColour6 = DOM and show_BR_SB and show_BR_PM and BarInSession('1400-1500') ? color.new(color.purple , 90) : na
bgcolor(color = chartColour6 , title = 'Silver Bullet PM' , transp = 95)
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------//
// One set up for life
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------//
show_Sess = input.bool(defval = true , title = 'Session ' , inline = '00' , group = 'Session One Set Up for Life')
show_Box_Sess = input.bool(defval = true , title = 'Box ' , inline = '00' , group = 'Session One Set Up for Life')
show_txt_box = input.bool(defval = true , title = 'Text Box ' , inline = '00' , group = 'Session One Set Up for Life')
show_Prev_Lin_Sess = input.bool(defval = true , title = 'Prev. H/L ' , inline = '01' , group = 'Session One Set Up for Life')
show_txt_Lin_Sess = input.bool(defval = false , title = 'Text ' , inline = '01' , group = 'Session One Set Up for Life')
show_price_ses = input.bool(defval = false , title = 'Price' , inline = '01' , group = 'Session One Set Up for Life')
Show_OND = input.bool(defval = false , title = 'Show Only for Today' , inline = '02' , group = 'Session One Set Up for Life')
choise_start_OSFL = input.string(defval = '09:30' , title = 'Start time when you take Prev.H/L' , options = ['00:00' , '02:00' , '08:30' , '09:30'] , inline = '03' , group = 'Session One Set Up for Life')
show_line_start = input.bool(defval = true , title = 'Line Start' , inline = '03' , group = 'Session One Set Up for Life')
col_line_start = input.color(defval = color.new(color.orange,60) , title = '' , inline = '03' , group = 'Session One Set Up for Life')
show_Sess_0 = input.bool(defval = true , title = 'London' , inline = '0' , group = 'Session One Set Up for Life')
Sess_0 = '0200-0500'
col_Sess_0 = input.color(defval = color.blue , title = '' , inline = '1' , group = 'Session One Set Up for Life')
txt_Sess_0 = 'London'
show_Sess_1 = input.bool(defval = true , title = 'Prev.AM' , inline = '0' , group = 'Session One Set Up for Life')
Sess_1 = '0930-1200'
col_Sess_1 = input.color(defval = color.red , title = ' ' , inline = '1' , group = 'Session One Set Up for Life')
txt_Sess_1 = 'Prev.AM'
show_Sess_2 = input.bool(defval = true , title = 'Lunch' , inline = '0' , group = 'Session One Set Up for Life')
Sess_2 = '1200-1330'
col_Sess_2 = input.color(defval = color.yellow , title = ' ' , inline = '1' , group = 'Session One Set Up for Life')
txt_Sess_2 = 'Lunch'
show_Sess_3 = input.bool(defval = true , title = 'PM' , inline = '0' , group = 'Session One Set Up for Life')
Sess_3 = '1330-1600'
col_Sess_3 = input.color(defval = color.purple , title = ' ' , inline = '1' , group = 'Session One Set Up for Life')
txt_Sess_3 = 'PM'
time_start = choise_start_OSFL == '00:00' ? timestamp(Timezone , year , month , dayofmonth , 0, 00 , 00) : choise_start_OSFL == '02:00' ? timestamp(Timezone , year , month , dayofmonth , 2, 00 , 00)
: choise_start_OSFL == '08:30' ? timestamp(Timezone , year , month , dayofmonth , 8, 30 , 00) : timestamp(Timezone , year , month , dayofmonth , 9, 30 , 00)
time_start_LN = timestamp(Timezone , year , month , dayofmonth , 2, 00 , 00)
time_start_LC = timestamp(Timezone , year , month , dayofmonth , 13, 30 , 00)
// Daily Dividers
//--Timing Session
is_new_session = time(timeframe.period , '0000-0001', Timezone)
is_new_session_AS = time(timeframe.period , '0000-0001' , Timezone)
is_sess_start_LN_0 = time(timeframe.period , '0200-0201' , Timezone)
is_new_session_LN = time(timeframe.period , '0500-0501' , Timezone)
//is_new_session_LN = time(timeframe.period , '0930-0931' , Timezone)
is_new_session_NY = time(timeframe.period , '1200-1201' , Timezone)
is_new_session_LC = time(timeframe.period , '1330-1331' , Timezone)
is_sess_start_PM_0 = time(timeframe.period , '1600-1601' , Timezone)
is_new_session_PM = time(timeframe.period , '1800-1801' , Timezone)
is_line_start = choise_start_OSFL == '02:00' ? time(timeframe.period, '0200-0201', Timezone) : choise_start_OSFL == '08:30' ? time(timeframe.period, '0830-0831', Timezone) : time(timeframe.period, '0930-0931', Timezone)
var line D_open = na
var line Ny_open = na
if is_new_session and show_daily and DOM
D_open := line.new(bar_index , bar_index , bar_index , bar_index + 1 , extend = extend.both , color = col_D , style = line.style_solid)
if is_line_start and show_line_start and DOM
Ny_open := line.new(bar_index , bar_index , bar_index , bar_index + 1 , extend = extend.both , color = col_line_start , style = line.style_dotted)
//--------------
//---Text Box
//--------------
if DOM and show_Sess
var float top_bottom = 0
var color kz_color = na
var bool in_kz = na
var string kz_text = na
if show_txt_box
if show_Sess_0 and time(timeframe.period, Sess_0 , Timezone)
in_kz := true
kz_color := color.new(col_Sess_0 , 80)
kz_text := txt_Sess_0
else if show_Sess_1 and time(timeframe.period, Sess_1 , Timezone)
in_kz := true
kz_color := color.new(col_Sess_1 , 80)
kz_text := txt_Sess_1
else if show_Sess_2 and time(timeframe.period, '1201-1330' , Timezone)
in_kz := true
kz_color := color.new(col_Sess_2 , 80)
kz_text := txt_Sess_2
else if show_Sess_3 and time(timeframe.period, '1331-1600' , Timezone)
in_kz := true
kz_color := color.new(col_Sess_3 , 80)
kz_text := txt_Sess_3
else
in_kz := false
else
in_kz := true
var box kz_box = na
var line kz_start_line = na
var line kz_end_line = na
if show_txt_box
if in_kz and not in_kz[1]
kz_box := box.new(bar_index, high, bar_index, low, border_color = color.new(color.red, 100), bgcolor = kz_color, text = kz_text , text_size = size.small)
kz_start_line := line.new(bar_index, high, bar_index, box.get_top(kz_box), color = kz_color, style = line.style_dotted)
top_bottom := 0
if in_kz[1]
box.set_right(kz_box, bar_index)
if high>box.get_bottom(kz_box)
box.set_bottom(kz_box,1.0010* high)
box.set_top(kz_box,1.0015*high)
line.set_y2(kz_start_line, box.get_top(kz_box))
if in_kz[1] and not in_kz
kz_end_line := line.new(bar_index, high, bar_index, box.get_top(kz_box), color = kz_color, style = line.style_dotted)
//--------------
//---High Low Prev Session
//--------------
if DOM and show_Sess and show_Sess_0
var box box_sess_0 = na
if is_newbar(Sess_0)
box_sess_0 := box.new(bar_index, high, bar_index, low , border_color = color.new(#c78234, 100) , bgcolor = show_Box_Sess ? color.new(col_Sess_0 , 90) : na)
if Show_OND
box.delete(box_sess_0[1])
else if is_session(Sess_0)
box.set_right(box_sess_0, bar_index+1)
if high > box.get_top(box_sess_0)
box.set_top(box_sess_0, high)
if low < box.get_bottom(box_sess_0)
box.set_bottom(box_sess_0, low)
var bool can_draw_high_sess_0 = false
var bool can_draw_low_sess_0 = false
var line high_sess_0 = na
var line low_sess_0 = na
var label LBhigh_sess_0 = na
var label LBlow_sess_0 = na
if (is_new_session_LN) and show_Sess_0 and show_Prev_Lin_Sess
can_draw_high_sess_0 := true
can_draw_low_sess_0 := true
high_sess_0 := line.new(bar_index, box.get_top(box_sess_0), bar_index, box.get_top(box_sess_0), color = col_Sess_0) // Get new line id
low_sess_0 := line.new(bar_index, box.get_bottom(box_sess_0), bar_index, box.get_bottom(box_sess_0), color = col_Sess_0)
if Show_OND
line.delete(high_sess_0[1])
line.delete(low_sess_0[1])
if show_txt_Lin_Sess
LBhigh_sess_0 := label.new(x = last_bar_index , y = box.get_top(box_sess_0) , text = show_price_ses ? txt_Sess_0 +' High '+ str.tostring(box.get_top(box_sess_0)) : txt_Sess_0 +' High ', xloc = xloc.bar_index , yloc = yloc.price , color = na , style = label.style_label_down, textcolor = col_Sess_0 , textalign = text.align_right , tooltip = 'Prev.PM High' )
LBlow_sess_0 := label.new(x = last_bar_index , y = box.get_bottom(box_sess_0) , text = show_price_ses ? txt_Sess_0 +' Low ' +str.tostring(box.get_bottom(box_sess_0)): txt_Sess_0 +' Low ', xloc = xloc.bar_index , yloc = yloc.price , color = na , style = label.style_label_center, textcolor = col_Sess_0 , textalign = text.align_right , tooltip = 'Prev.PM Low')
label.delete(LBhigh_sess_0[1])
label.delete(LBlow_sess_0[1])
else
if (can_draw_high_sess_0)
if (time > (time_start_LN + 0 * 1000*60) and high > line.get_y1(high_sess_0))
can_draw_high_sess_0 := false
label.delete(LBhigh_sess_0[0])
else
line.set_x2(high_sess_0, bar_index)
if (can_draw_low_sess_0)
if (time > (time_start_LN + 0 * 1000*60) and low < line.get_y1(low_sess_0))
can_draw_low_sess_0 := false
label.delete(LBlow_sess_0[0])
else
line.set_x2(low_sess_0, bar_index)
// _1
if DOM and show_Sess and show_Sess_1
var box box_sess_1 = na
if is_newbar(Sess_1)
box_sess_1 := box.new(bar_index, high, bar_index, low , border_color = color.new(#c78234, 100), bgcolor = show_Box_Sess ? color.new(col_Sess_1 , 90) : na)
if Show_OND
box.delete(box_sess_1[1])
else if is_session(Sess_1)
box.set_right(box_sess_1, bar_index+1)
if high > box.get_top(box_sess_1)
box.set_top(box_sess_1, high)
if low < box.get_bottom(box_sess_1)
box.set_bottom(box_sess_1, low)
var bool can_draw_high_sess_1 = false
var bool can_draw_low_sess_1 = false
var line high_sess_1 = na
var line low_sess_1 = na
var label LBhigh_sess_1 = na
var label LBlow_sess_1 = na
if (is_new_session_NY) and show_Sess_1 and show_Prev_Lin_Sess
can_draw_high_sess_1 := true
can_draw_low_sess_1 := true
high_sess_1 := line.new(bar_index, box.get_top(box_sess_1), bar_index, box.get_top(box_sess_1), color = col_Sess_1) // Get new line id
low_sess_1 := line.new(bar_index, box.get_bottom(box_sess_1), bar_index, box.get_bottom(box_sess_1), color = col_Sess_1)
if Show_OND
line.delete(high_sess_1[1])
line.delete(low_sess_1[1])
if show_txt_Lin_Sess
LBhigh_sess_1 := label.new(x = last_bar_index , y = box.get_top(box_sess_1) , text = show_price_ses ? txt_Sess_1 +' High '+ str.tostring(box.get_top(box_sess_1)) : txt_Sess_1 +' High ', xloc = xloc.bar_index , yloc = yloc.price , color = na , style = label.style_label_down, textcolor = col_Sess_1 , textalign = text.align_right , tooltip = 'Prev.PM High' )
LBlow_sess_1 := label.new(x = last_bar_index , y = box.get_bottom(box_sess_1) , text = show_price_ses ? txt_Sess_1 +' Low ' +str.tostring(box.get_bottom(box_sess_1)): txt_Sess_1 +' Low ', xloc = xloc.bar_index , yloc = yloc.price , color = na , style = label.style_label_center, textcolor = col_Sess_1 , textalign = text.align_right , tooltip = 'Prev.PM Low')
label.delete(LBhigh_sess_1[1])
label.delete(LBlow_sess_1[1])
else
if (can_draw_high_sess_1)
if (time > (time_start + 0 * 1000*60) and high > line.get_y1(high_sess_1))
can_draw_high_sess_1 := false
label.delete(LBhigh_sess_1[0])
else
line.set_x2(high_sess_1, bar_index)
if (can_draw_low_sess_1)
if (time > (time_start + 0 * 1000*60) and low < line.get_y1(low_sess_1))
can_draw_low_sess_1 := false
label.delete(LBlow_sess_1[0])
else
line.set_x2(low_sess_1, bar_index)
// _2
if DOM and show_Sess and show_Sess_2
var box box_sess_2 = na
if is_newbar(Sess_2)
box_sess_2 := box.new(bar_index, high, bar_index, low , border_color = color.new(#c78234, 100) , bgcolor = show_Box_Sess ? color.new(col_Sess_2 , 90) : na)
if Show_OND
box.delete(box_sess_2[1])
else if is_session(Sess_2)
box.set_right(box_sess_2, bar_index+1)
if high > box.get_top(box_sess_2)
box.set_top(box_sess_2, high)
if low < box.get_bottom(box_sess_2)
box.set_bottom(box_sess_2, low)
var bool can_draw_high_sess_2 = false
var bool can_draw_low_sess_2 = false
var line high_sess_2 = na
var line low_sess_2 = na
var label LBhigh_sess_2 = na
var label LBlow_sess_2 = na
if (is_new_session_LC) and show_Sess_2 and show_Prev_Lin_Sess
can_draw_high_sess_2 := true
can_draw_low_sess_2 := true
high_sess_2 := line.new(bar_index, box.get_top(box_sess_2), bar_index, box.get_top(box_sess_2), color = col_Sess_2) // Get new line id
low_sess_2 := line.new(bar_index, box.get_bottom(box_sess_2), bar_index, box.get_bottom(box_sess_2), color = col_Sess_2)
if Show_OND
line.delete(high_sess_2[1])
line.delete(low_sess_2[1])
if show_txt_Lin_Sess
LBhigh_sess_2 := label.new(x = last_bar_index , y = box.get_top(box_sess_2) , text = show_price_ses ? txt_Sess_2 +' High '+ str.tostring(box.get_top(box_sess_2)) : txt_Sess_2 +' High ', xloc = xloc.bar_index , yloc = yloc.price , color = na , style = label.style_label_down, textcolor = col_Sess_2 , textalign = text.align_right , tooltip = 'Prev.PM High' )
LBlow_sess_2 := label.new(x = last_bar_index , y = box.get_bottom(box_sess_2) , text = show_price_ses ? txt_Sess_2 +' Low ' +str.tostring(box.get_bottom(box_sess_2)): txt_Sess_2 +' Low ', xloc = xloc.bar_index , yloc = yloc.price , color = na , style = label.style_label_center, textcolor = col_Sess_2 , textalign = text.align_right , tooltip = 'Prev.PM Low')
label.delete(LBhigh_sess_2[1])
label.delete(LBlow_sess_2[1])
else
if (can_draw_high_sess_2)
if (time > (time_start_LC + 0 * 1000*60) or (time_start + 0 * 1000*60) and high > line.get_y1(high_sess_2))
can_draw_high_sess_2 := false
label.delete(LBhigh_sess_2[0])
else
line.set_x2(high_sess_2, bar_index)
if (can_draw_low_sess_2)
if (time > (time_start_LC + 0 * 1000*60) and low < line.get_y1(low_sess_2))
can_draw_low_sess_2 := false
label.delete(LBlow_sess_2[0])
else
line.set_x2(low_sess_2, bar_index)
// -3
if DOM and show_Sess and show_Sess_3
var box box_sess_3 = na
if is_newbar(Sess_3)
box_sess_3 := box.new(bar_index, high, bar_index, low , border_color = color.new(#c78234, 100), bgcolor = show_Box_Sess ? color.new(col_Sess_3 , 90) : na)
if Show_OND
box.delete(box_sess_3[2])
else if is_session(Sess_3)
box.set_right(box_sess_3, bar_index+1)
if high > box.get_top(box_sess_3)
box.set_top(box_sess_3, high)
if low < box.get_bottom(box_sess_3)
box.set_bottom(box_sess_3, low)
var bool can_draw_high_sess_3 = false
var bool can_draw_low_sess_3 = false
var line high_sess_3 = na
var line low_sess_3 = na
var label LBhigh_sess_3 = na
var label LBlow_sess_3 = na
if (is_new_session) and show_Sess_3 and show_Prev_Lin_Sess
can_draw_high_sess_3 := true
can_draw_low_sess_3 := true
high_sess_3 := line.new(bar_index, box.get_top(box_sess_3), bar_index, box.get_top(box_sess_3), color = col_Sess_3) // Get new line id
low_sess_3 := line.new(bar_index, box.get_bottom(box_sess_3), bar_index, box.get_bottom(box_sess_3), color = col_Sess_3)
if Show_OND
line.delete(high_sess_3[1])
line.delete(low_sess_3[1])
if show_txt_Lin_Sess
LBhigh_sess_3 := label.new(x = last_bar_index , y = box.get_top(box_sess_3) , text = show_price_ses ? txt_Sess_3 +' High '+ str.tostring(box.get_top(box_sess_3)) : txt_Sess_3 +' High ', xloc = xloc.bar_index , yloc = yloc.price , color = na , style = label.style_label_down, textcolor = col_Sess_3 , textalign = text.align_right , tooltip = 'Prev.PM High' )
LBlow_sess_3 := label.new(x = last_bar_index , y = box.get_bottom(box_sess_3) , text = show_price_ses ? txt_Sess_3 +' Low ' +str.tostring(box.get_bottom(box_sess_3)): txt_Sess_3 +' Low ', xloc = xloc.bar_index , yloc = yloc.price , color = na , style = label.style_label_center, textcolor = col_Sess_3 , textalign = text.align_right , tooltip = 'Prev.PM Low')
label.delete(LBhigh_sess_3[1])
label.delete(LBlow_sess_3[1])
else
if (can_draw_high_sess_3)
if (time > (time_start + 0 * 1000*60) and high > line.get_y1(high_sess_3))
can_draw_high_sess_3 := false
label.delete(LBhigh_sess_3[0])
else
line.set_x2(high_sess_3, bar_index)
if (can_draw_low_sess_3)
if (time > (time_start + 0 * 1000*60) and low < line.get_y1(low_sess_3))
can_draw_low_sess_3 := false
label.delete(LBlow_sess_3[0])
else
line.set_x2(low_sess_3, bar_index)
Show all 361 lines