0

//I'm having problems with the line.new function. I want a line from close to close between 0830-1630, so probably a diagonal...

_zoneSession = input(title = "Session", type = input.session, defval = "0830-1630:1234567")

_zoneInitialBalanceStop   = input(title = "Initial Balance Session", type = input.session, defval = "0930-0931:1234567")

_timeZone  = time(timeframe.period, _zoneSession)

_hLZone = time(timeframe.period,_zoneInitialBalanceStop)

_session_Start= plot(na(_timeZone)[1] == 1 and na(_timeZone) == 0 ? close : na, style = plot.style_histogram, linewidth = 3, color = color.green)

_session_Stop= plot(na(_timeZone)[1] == 0 and na(_timeZone) == 1 ? close : na, style = plot.style_histogram, linewidth = 3, color = color.green)

_session_bal_Stop= plot(na(_hLZone)[1] == 0 and na(_hLZone) == 1 ? close : na, style = plot.style_histogram, linewidth = 3, color = color.red)



_sessionSy1_condx1 = na(_timeZone)[1] == 1 and na(_timeZone) == 0 ? close : na
_sessionSy1_condx2 = na(_timeZone)[1] == 0 and na(_timeZone) == 1 ? close : na


//I HAVE PROBLEMS WITH THE LINE.NEW FUNCTION I WNAT A LINE FROM CLOSE TO CLOSE BTWN 0830-1630 so probably a diagonal...

line.new(timestamp(year,month,dayofmonth,08,30),_sessionSy1_condx1, timestamp(year,month,dayofmonth,16,30),_sessionSy1_condx2, xloc= xloc.bar_index, extend = extend.right)
Greg
  • 3,570
  • 5
  • 18
  • 31

1 Answers1

0

Need to use xloc= xloc.bar_time in your line.new call when using time values for x1= and x2=.

PineCoders-LucF
  • 8,288
  • 2
  • 12
  • 21