Couldn't find a way to display a centered Text (no label) in a time range (between f.e. "0800" and "1000") at the top of the Chart.
Would appreciate some help here.
Many thanks.
Update -----------
Find myself an incomplete solution :
tSBLN = time(timeframe.period, "0330-0331")
labelSBLN = if (not na(tSBLN))
label.new(bar_index, high, yloc=yloc.abovebar, textcolor=color.white, style=label.style_none, textalign=text.align_center, size=size.normal)
label.set_text(id=labelSBLN, text="SB")
Would someone be so kind and explain me how I can set this label, not abovebar but at the top of the Chart or move him vertically upward ?
SOLUTION
Hereafter how I could solve it :
//@version=5
indicator("[IND] Range", overlay = true)
// InSession() determines if a price bar falls inside the specified session
InSession(sess) => na(time(timeframe.period, sess)) == false
var bool showRange = input(false, title="See Range", tooltip = "[1100-1400 EST]", group="RANGE")
titleRange = "Range"
range_Range = input.session("1100-1400", title=titleRange, group="RANGE") // Define the start and end time of your range
color_Range = color.new(color.gray,0)
bgcolor(InSession(range_Range)[1] and showRange ? color_Range: na, editable=false)
tRange = time(timeframe.period, "1230-1231") // Define the middle of the range in order to center your text horizontally in the plotted (bgcolor) range
plotshape(not na(tRange) and showRange ? high: na, style=shape.square, text=titleRange, size=size.large, location=location.top, textcolor=color.black, color=color.new(color.gray,100)))