Professional Documents
Culture Documents
////////////////////////////////////////////
startTime = 0
startTime := inSession and not inSession[1] ? time : startTime[1]
//Box lines
var line lowHLine = na
var line topHLine = na
var line leftVLine = na
var line rightVLine = na
var line middleHLine = na
var box bgBox = na
// Plot lines
if inSession and timeframe.isintraday
if inSession[1]
line.delete(lowHLine)
line.delete(topHLine)
line.delete(leftVLine)
line.delete(rightVLine)
line.delete(middleHLine)
box.delete(bgBox)
if showLines
lowHLine := line.new(startTime, low_val, time, low_val, xloc=xloc.bar_time,
color=boxLineColor, style=line.style_solid, width=linesWidth)
topHLine := line.new(startTime, high_val, time, high_val,
xloc=xloc.bar_time, color=boxLineColor, style=line.style_solid, width=linesWidth)
leftVLine := line.new(startTime, high_val, startTime, low_val,
xloc=xloc.bar_time, color=boxLineColor, style=line.style_solid, width=linesWidth)
rightVLine := line.new(time, high_val, time, low_val, xloc=xloc.bar_time,
color=boxLineColor, style=line.style_solid, width=linesWidth)
else
if inExtend and extendLines and not inSession and timeframe.isintraday
time1 = line.get_x1(lowHLine)
time2 = line.get_x2(lowHLine)
price = line.get_y1(lowHLine)
line.delete(lowHLine)
lowHLine := line.new(time1, price, time, price, xloc=xloc.bar_time,
color=boxLineColor, style=line.style_solid, width=linesWidth)
time1 := line.get_x1(topHLine)
time2 := line.get_x2(topHLine)
price := line.get_y1(topHLine)
line.delete(topHLine)
topHLine := line.new(time1, price, time, price, xloc=xloc.bar_time,
color=boxLineColor, style=line.style_solid, width=linesWidth)
time1 := line.get_x1(middleHLine)
time2 := line.get_x2(middleHLine)
price := line.get_y1(middleHLine)
line.delete(middleHLine)
middleHLine := line.new(time1, price, time, price, xloc=xloc.bar_time,
color=middleLineColor, style=line.style_solid, width=linesWidth)
middleHLine
////////////////////////////////////////////
startTime0 = 0
startTime0 := inSession0 and not inSession0[1] ? time : startTime0[1]
//Box lines
var line lowHLine0 = na
var line topHLine0 = na
var line leftVLine0 = na
var line rightVLine0 = na
var line middleHLine0 = na
var box bgBox0 = na
// Plot lines
if inSession0 and timeframe.isintraday
if inSession0[1]
line.delete(lowHLine0)
line.delete(topHLine0)
line.delete(leftVLine0)
line.delete(rightVLine0)
line.delete(middleHLine0)
box.delete(bgBox0)
//Create Box
//x1, y1, x2, y2
if showBackground0
bgBox0 := box.new(startTime0, high_val0, time, low_val0,
xloc=xloc.bar_time, bgcolor=backgroundColor0, border_width=0)
if showLines0
lowHLine0 := line.new(startTime0, low_val0, time, low_val0,
xloc=xloc.bar_time, color=boxLineColor0, style=line.style_solid, width=linesWidth0)
topHLine0 := line.new(startTime0, high_val0, time, high_val0,
xloc=xloc.bar_time, color=boxLineColor0, style=line.style_solid, width=linesWidth0)
leftVLine0 := line.new(startTime0, high_val0, startTime0, low_val0,
xloc=xloc.bar_time, color=boxLineColor0, style=line.style_solid, width=linesWidth0)
rightVLine0 := line.new(time, high_val0, time, low_val0,
xloc=xloc.bar_time, color=boxLineColor0, style=line.style_solid, width=linesWidth0)
////////////////////////////////////////////
startTime4 = 0
startTime4 := inSession4 and not inSession4[1] ? time : startTime4[1]
//Box lines
var line lowHLine4 = na
var line topHLine4 = na
var line leftVLine4 = na
var line rightVLine4 = na
var line middleHLine4 = na
var box bgBox4 = na
var low_val4 = 0.0
var high_val4 = 0.0
if inSession4 and not inSession4[1]
low_val4 := low
high_val4 := high
high_val4
// Plot lines
if inSession4 and timeframe.isintraday
if inSession4[1]
line.delete(lowHLine4)
line.delete(topHLine4)
line.delete(leftVLine4)
line.delete(rightVLine4)
line.delete(middleHLine4)
box.delete(bgBox4)
//Create Box
//x1, y1, x2, y2
if showBackground4
bgBox4 := box.new(startTime4, high_val4, time, low_val4,
xloc=xloc.bar_time, bgcolor=backgroundColor4, border_width=0)
if showLines4
lowHLine4 := line.new(startTime4, low_val4, time, low_val4,
xloc=xloc.bar_time, color=boxLineColor4, style=line.style_solid, width=linesWidth4)
topHLine4 := line.new(startTime4, high_val4, time, high_val4,
xloc=xloc.bar_time, color=boxLineColor4, style=line.style_solid, width=linesWidth4)
leftVLine4 := line.new(startTime4, high_val4, startTime4, low_val4,
xloc=xloc.bar_time, color=boxLineColor4, style=line.style_solid, width=linesWidth4)
rightVLine4 := line.new(time, high_val4, time, low_val4,
xloc=xloc.bar_time, color=boxLineColor4, style=line.style_solid, width=linesWidth4)
////////////////////////////////////////////
startTime5 = 0
startTime5 := inSession5 and not inSession5[1] ? time : startTime5[1]
//Box lines
var line lowHLine5 = na
var line topHLine5 = na
var line leftVLine5 = na
var line rightVLine5 = na
var line middleHLine5 = na
var box bgBox5 = na
// Plot lines
if inSession5 and timeframe.isintraday
if inSession5[1]
line.delete(lowHLine5)
line.delete(topHLine5)
line.delete(leftVLine5)
line.delete(rightVLine5)
line.delete(middleHLine5)
box.delete(bgBox5)
//Create Box
//x1, y1, x2, y2
if showBackground5
bgBox5 := box.new(startTime5, high_val5, time, low_val5,
xloc=xloc.bar_time, bgcolor=backgroundColor5, border_width=0)
if showLines5
lowHLine5 := line.new(startTime5, low_val5, time, low_val5,
xloc=xloc.bar_time, color=boxLineColor5, style=line.style_solid, width=linesWidth5)
topHLine5 := line.new(startTime5, high_val5, time, high_val5,
xloc=xloc.bar_time, color=boxLineColor5, style=line.style_solid, width=linesWidth5)
leftVLine5 := line.new(startTime5, high_val5, startTime5, low_val5,
xloc=xloc.bar_time, color=boxLineColor5, style=line.style_solid, width=linesWidth5)
rightVLine5 := line.new(time, high_val5, time, low_val5,
xloc=xloc.bar_time, color=boxLineColor5, style=line.style_solid, width=linesWidth5)
///////////////////////////////////////////////
//INPUTS
//Plot lines
in_session_ff = time(timeframe.period, ffRange)
sessionffActive = in_session_ff and timeframe.multiplier <= 240
var line ff = na
if sessionffActive and sessionffActive[1] == false
ff := line.new(ffmmmshow ? bar_index : na, high+0.001, bar_index, low-
0.001,color=ffcolor, style=ffStyle)
offset_val = 10
daily_open(x) =>
trigger = na(time('D')) or ta.change(time('D'))
ta.valuewhen(trigger, open, x)
///////////////////////////////////