Is there a call in PS to query the duration of the current session? Seems like everything is bar-driven so there is a way to ask if the current bar is in or out of a session, but I want to know about a future bar - the bar at the end of the session. I don't think that is possible.
barstate.isfirst — true if the current bar is the first in the whole range of bars available, false otherwise.
barstate.islast — true if the current bar is the last in the whole range of bars available, false otherwise. This flag helps to detect the last historical bar.