session.isfirstbar_regular - Pine Script Variable
session.isfirstbar_regular
Section titled “session.isfirstbar_regular”Overview
Section titled “Overview”Returns true on the first regular session bar of the day, false otherwise. The result is the same whether extended session information is used or not.
boolQualifier
Section titled “Qualifier”series
Examples
Section titled “Examples”Example 1
Section titled “Example 1”//@version=6strategy("`session.isfirstbar_regular` Example", overlay = true)longCondition = year >= 2022// Place a long order at the `close` of the trading session's first bar.if session.isfirstbar and longConditionstrategy.entry("Long", strategy.long)// Close the long position at the `close` of the trading session's last bar.if session.islastbar_regular and barstate.isconfirmedstrategy.close("Long", immediately = true)