检查变量是否为 NA

Far*_*gun 5 null pine-script

我使用 pine 脚本,我想检查某些变量是否为 NA。说:

float value = na

if value == na
   // do something
Run Code Online (Sandbox Code Playgroud)

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!

rum*_*mpy 10

您应该使用该na()功能:

if na(value)
     // do something
Run Code Online (Sandbox Code Playgroud)