CS2723
error The unit unit does not apply to this input.
#What it means
A unit (bars, minutes, percent and so on) only makes sense on a number input. This input is not a number, or the unit does not fit it (px and pt do not apply to a price).
#Typical cause
unit =on a bool, string, colour or source input.
#How to fix it
Remove unit =, or move it to the number input it describes. See Inputs.
#Example
//@chartscript 1
indicator("Units")
const show = input.bool(true, "Show", { unit: unit.bars })
const len = input.int(14, "Length")
const avg = ta.sma(close, len)
plot(show ? avg : na)Fixed
//@chartscript 1
indicator("Units")
const show = input.bool(true, "Show")
const len = input.int(14, "Length", { unit: unit.bars })
const avg = ta.sma(close, len)
plot(show ? avg : na)#Related
- CS2014 — value is not one of the allowed values: options.