CS5102
error name is na.
#What it means
The script used an array, map, matrix or object that is na (it was never created), so there is nothing to read from or write to.
#Typical cause
- A collection declared as
naand never given a value, as instate xs: float[] = na. - A field of an object read before the object was created.
#How to fix it
Create the collection when you declare it, for example state xs = array.new<float>(), or check with na(xs) before using it. See Collections.
#Example
//@chartscript 1
indicator("Stored closes")
state closes: float[] = na
closes.push(close)
plot(closes.size())Fixed
//@chartscript 1
indicator("Stored closes")
state closes: float[] = array.new<float>()
closes.push(close)
plot(closes.size())