CS1004
error Only one indicator(...) or library(...) declaration is allowed.
#What it means
A script can declare itself only once. It is either one indicator or one library.
#Typical cause
- Two scripts were pasted into one file.
- A second
indicator(...)was added to change the title or the overlay setting.
#How to fix it
Keep a single indicator(...) or library(...) call and put every setting you need into it. To show two separate things, save them as two scripts.
#Example
//@chartscript 1
indicator("Moving average", { overlay: true })
indicator("Moving average 2", { overlay: true })
plot(ta.sma(close, 20))Fixed
//@chartscript 1
indicator("Moving average", { overlay: true })
plot(ta.sma(close, 20))#Related
- CS1003 — The script must start with indicator(...) or library(...) after the header.