3

I use pine script and I want to check if some variable is NA. Say:

float value = na

if value == na
   // do something

As far as I am aware, the manual says that it is not guaranteed to work. Are there any alternatives to check if a variable is NA? I can't assign it to 0 though, since the outcome value can be 0.0 in my script. I am new to Pine Script. Thanks!

1 Answers1

7

You should use the na() function :

if na(value)
     // do something
rumpypumpydumpy
  • 3,435
  • 2
  • 5
  • 10