CS4112
error share.series("id") detail.
#What it means
share.series declares one shared value per bar, like a plot. The list of shared series is fixed when the script is compiled, so each one is written once, at the top level, not inside a condition, loop or function.
#Typical cause
share.seriesinside anif, to share only on some bars.- Two
share.serieslines with the same id.
#How to fix it
Move it to the top level and put the condition in the value: share na on the bars that have nothing. For something that happens now and then, use share.event. See Linking scripts.
#Example
//@chartscript 1
indicator("Shares")
if (close > open) {
share.series("up_close", close)
}
plot(close)Fixed
//@chartscript 1
indicator("Shares")
share.series("up_close", close > open ? close : na)
plot(close)