Lipi Reference Lipi

Keywords

intra

varip (var intrabar persist) is the keyword used for the assignment and one-time initialization of a variable or a field of a user-defined type. It’s similar to the var keyword, but variables and fields declared with varip retain their values between executions of the script on the same bar.

Syntax

                intra <data_type> <variable_name> = <expression>
              

Example


          indicator("varip Example", overlay=False)
// Declare a persistent variable that resets each new bar
intra int count = 0
// Increase count on each price update within the same bar
count := count + 1
// Plot the intrabar update count as a line
plot(count, title="Intrabar Execution Count", color=color.blue)