Lipi Reference Lipi

Variables

session.isfirst

Returns true only on the first bar of a new trading session, useful for resetting values or performing session-based calculations like daily CVD or highs/lows.

Example


          indicator("CVD with session.first", overlay=false)
// Initialize persistent variable
static customCVD = 0
// Check if it's the first candle of the session
if session.isfirst {
    customCVD := 0
} else  {
    customCVD := customCVD + orderflow.delta
}
plot(customCVD, title="Session CVD", color=color.blue)
        

Type

series bool