Farmer With Shotgun
Farmer With Shotgun

Reputation: 63

check if variable is NA

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!

Upvotes: 6

Views: 6740

Answers (1)

rumpypumpydumpy
rumpypumpydumpy

Reputation: 3823

You should use the na() function :

if na(value)
     // do something

Upvotes: 12

Related Questions