Skip to content
ChartDeck ChartScript docs Account Open the terminal

CS1050

error name is not used in ChartScript: use hint.

#What it means

The word is not part of ChartScript. var declares nothing here: a variable that keeps its value from bar to bar is state, and an ordinary variable is let (or const). varip is live state, a variable that keeps its value between the updates of the live bar.

#Typical cause

  • var x = ... written from JavaScript or another charting language.
  • varip x = ... from another charting language.

#How to fix it

Use state for a value kept across bars, let for a value calculated fresh on each bar, and live state instead of varip. The editor offers each as a quick fix. See Variables.

#Example

ChartScriptError: CS1050
//@chartscript 1
indicator("Bar count")
var count = 0
count += 1
plot(count)

Fixed

ChartScriptOpen in editor
//@chartscript 1
indicator("Bar count")
state count = 0
count += 1
plot(count)
  • CS1027 — name is reserved and cannot be used as a name.
  • CS2401 — name is not declared; declare it with decl before assigning to it.

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