Skip to content
ChartDeck ChartScript docs Account Open the terminal

CS2712

error This is not a settings condition: use inputs, constants, timeframe.in_seconds(), timeframe.period and market.kind with logic, comparisons, + - * / and ?: (detail).

#What it means

Conditions such as visible_if, enabled_if and validate are worked out in the settings panel, without running the script. They may only use inputs, constants, timeframe.in_seconds(), timeframe.period, timeframe.isintraday, market.kind and chart.theme, combined with &&, ||, !, comparisons, + - * / and ?:. The part in brackets at the end of the message is what was not allowed.

#Typical cause

  • Bar values such as close in a settings condition.
  • Other built-ins, such as timeframe.multiplier or market.tick, or function calls.

#How to fix it

Rewrite the condition with the allowed pieces, for example timeframe.in_seconds() > 60 instead of timeframe.multiplier > 1. See Inputs.

#Example

ChartScriptError: CS2712
//@chartscript 1
indicator("Smoothing")
const len = input.int(14, "Length", { visible_if: timeframe.multiplier > 1 })
plot(ta.sma(close, len))

Fixed

ChartScriptOpen in editor
//@chartscript 1
indicator("Smoothing")
const len = input.int(14, "Length", { visible_if: timeframe.in_seconds() > 60 })
plot(ta.sma(close, len))
  • CS2714 — A check must be a bool, but this is got.
  • CS2710 — name can only be used at the top level of the script.

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