requesting to help me by converting pine script version 2 to version 5

49 views Asked by At

help me to convert below pine script 3 lines in version 5.(below lines are in version 2)

src=ohlc4
haOpen = (src + nz(haOpen[1]))/2
haC=(ohlc4+haOpen+max(high,haOpen)+min(low,haOpen))/4

try to convert pine script version 2 to version 5

1

There are 1 answers

0
vitruvius On

Self-referenced variables are removed

So, you need to first define the variable and use := to assign a value to it.

src=ohlc4
haOpen = 0.0
haOpen := (src + nz(haOpen[1]))/2
haC=(ohlc4+haOpen+math.max(high,haOpen)+math.min(low,haOpen))/4