RJS1956
Pine Script Rookie
Pine Script Rookie
Posts: 1
Joined: November 22nd, 2022

Session duration

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.

NakedYolow
Pine Script Rookie
Pine Script Rookie
Posts: 1
Joined: November 23rd, 2022

Re: Session duration

is.lastbar? I dont really understand the context.

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.

Return to “Pine Script Q&A”