Skip to content
ChartDeck ChartScript docs Account Open the terminal

CS2714

error A check must be a bool, but this is got.

#What it means

A check (settings.validate, or the validate argument of an input) must be a bool condition: true when the settings are fine.

#Typical cause

  • An input or a number passed on its own, as in settings.validate(len, ...).

#How to fix it

Write a comparison, such as len >= 2.

#Example

ChartScriptError: CS2714
//@chartscript 1
indicator("Checked length")
const len = input.int(14, "Length")
settings.validate(len, "Length must be set")
plot(ta.sma(close, len))

Fixed

ChartScriptOpen in editor
//@chartscript 1
indicator("Checked length")
const len = input.int(14, "Length")
settings.validate(len >= 2, "Length must be at least 2")
plot(ta.sma(close, len))
  • CS2712 — This is not a settings condition: use inputs, constants, timeframe.in_seconds(), timeframe.period and market.kind with logic, comparisons, + - * / and ?: (detail).
  • CS2726 — name is not an input of this script.

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