CS2710
error name can only be used at the top level of the script.
#What it means
settings.*, style.* and i18n.add describe the script's settings panel. They are read once, when the script is compiled, so they must sit at the top level, not inside a condition, loop or function.
#Typical cause
- A settings statement placed inside an
if, a loop or a function.
#How to fix it
Move the statement to the top level. To show or hide something depending on other inputs, use its visible_if argument. See Inputs.
#Example
//@chartscript 1
indicator("Note")
if (close > open) {
settings.note("Up bar")
}
plot(close)Fixed
//@chartscript 1
indicator("Note")
settings.note("Plots the close of every bar.")
plot(close)