The session type the chart uses for this symbol, either regular or extended hours.
syminfo.session is a simple string equal to session.regular or session.extended. It says which of the symbol's trading hours the chart is built from: the main session only, or the main session plus pre-market and post-market.
The two constants are plain strings, regular and extended, so a comparison with either the constant or the text works.
Type
simple string
Remarks
- Extended sessions add bars before and after the regular hours, so a count of bars per day changes with this setting.
session.ismarket,session.ispremarketandsession.ispostmarkettell you which part a given bar belongs to. - On Sidechair: the value is always the text regular. The
session.regularconstant reads as the textsession.regularhere, so the two do not compare equal; test against "regular" in a script you run on Sidechair.
Example
//@version=6
indicator("Session setting", overlay = true)
plot(close, "Close", color.gray)
bgcolor(syminfo.session == "regular" ? na : color.new(color.purple, 90))
if barstate.islast
label.new(bar_index, high, "session: " + syminfo.session)See also
Runs on Sidechair