Lipi Reference Lipi

Variables

session.isfirst

True on the first bar of a session. This is the flag to reach for when something has to reset once per session. The cumulative delta function reads it for exactly that purpose, seeding its running total from zero rather than carrying the previous bar's total forward.

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