CS5001
error message
#What it means
The script was stopped with a message, shown as it is. Usually the script itself called runtime.error(...); a few built-ins also stop with their own message, such as a str.match pattern that is not supported.
#Typical cause
- A
runtime.errorcall in your code was reached, often to refuse settings that cannot work. - A built-in that refused its arguments, with the reason in the message.
#How to fix it
Read the message: it says what to change. If it comes from your own runtime.error, change the settings or the condition that leads to it. See Debugging.
#Example
//@chartscript 1
indicator("Guarded length")
const len = input.int(0, "Length")
if (len < 1) {
runtime.error("Length must be at least 1")
}
plot(ta.sma(close, math.max(len, 1)))Fixed
//@chartscript 1
indicator("Guarded length")
const len = input.int(14, "Length", { minval: 1 })
plot(ta.sma(close, len))#Related
- CS5501 — Internal runtime error: detail