T114
invalid session literal
Severity Error
A session string must have the form "HHMM-HHMM" in 24-hour time, with hours from 00 to 24 and minutes from 00 to 59. Here an hour or minute is out of range or the format is wrong.
Correct the times. Sessions crossing midnight are written with the end earlier than the start, for example "2200-0600".
Failing example
script "London session"
data chart = subscribe(data.ohlcv)
setup london = session("0800-2600")
plot bg = plot.bg(title: "London hours")
on chart.close {
let t = chart.time
if t != null && time.inSession(t, london, "Europe/London") {
bg.plot(1.0, color: color.withAlpha(color.accent, 30))
}
}Fixed example
script "London session"
data chart = subscribe(data.ohlcv)
setup london = session("0800-1630")
plot bg = plot.bg(title: "London hours")
on chart.close {
let t = chart.time
if t != null && time.inSession(t, london, "Europe/London") {
bg.plot(1.0, color: color.withAlpha(color.accent, 30))
}
}