Pinescript TradingView Undeclared Identifier

18 Views Asked by At

In the 2nd instance of "haOpen" , im getting an undeclared Identifier error when coding the Heikin Ashi Calculation for a Trading strategy. Isnt the first instance the declaration ?

haOpen = na(haOpen[1]) ? (open + close) / 2 : (haOpen[1] + haClose[1]) / 2

// Heikin Ashi Calculation

haClose = (open + high + low + close) / 4
haOpen = na(haOpen[1]) ? (open + close) / 2 : (haOpen[1] + haClose[1]) / 2
haHigh = math.max(high, math.max(haOpen, haClose))
haLow = math.min(low, math.min(haOpen, haClose))

haClose, haHigh, and haLow did not have any errors

0

There are 0 best solutions below