Skip to content
ChartDeck ChartScript docs Account Open the terminal

CS5104

error A string can be at most max characters.

#What it means

A string built while the script ran became longer than the limit given in the message (currently 4,096 characters).

#Typical cause

  • Text that is added to on every bar and never reset.
  • str.repeat or array.join producing a very long text.

#How to fix it

Keep strings short: build only the part you show, and reset text that accumulates.

#Example

ChartScriptOpen in editor
//@chartscript 1
indicator("Long text")
const txt = str.repeat("ab", 3000)
plot(str.length(txt))

Fixed

ChartScriptOpen in editor
//@chartscript 1
indicator("Long text")
const txt = str.repeat("ab", 100)
plot(str.length(txt))
  • CS1023 — This string is longer than max characters.
  • CS5103 — A collection can hold at most max elements.

The ChartScript documentation is in English for now; translations will follow.