Addition of series and float always returns n/a in pine script
Using var saves a value and := sets it to another. At run time the statement (close/close[1]) returns na on the first bar, so the effective calculation that results is :
cur_val = 0.0 + na
var keeps the value and we set it to na
A way to avoid this is either remove var, or place cur_val:= cur_val + (close/close[1]) under the local scope of an if statement to assign a new value conditionally
Cheers!