CODESCRIPT

Keywords

6 entries. What each one takes, what it returns, and a working example.

and

A boolean that is true only when both boolean expressions are true.

NOTE

The logical AND connective (a language keyword, not a function). Combines two conditions; works bar-by-bar over series. Used to fold several filters into a single condition.

CODESCRIPT
plot(iff(close > open and rsi(close, 14) > 50, 1, 0))

Plots 1 when the candle is up and RSI is above 50, otherwise 0.

false

The boolean constant that is always false.

NOTE

The boolean false literal (a language keyword). Used as a checkbox default or to temporarily switch off a branch.

CODESCRIPT
plot(iff(false, close, open))

Since the condition is always false, open is plotted.

na

The empty value meaning "no value".

NOTE

The special value marking missing/undefined data (a language keyword). Warm-up empty bar results are na; also used to intentionally leave a value empty or create a gap in a plot. The na() function tests whether a value is na.

CODESCRIPT
plot(iff(barIndex < 20, na, close))

Leaves the first 20 bars empty (na) and plots price afterwards.

not

The negation of a boolean expression (true↔false).

NOTE

The logical NOT operator (a language keyword). Inverts a condition; works bar-by-bar over series.

CODESCRIPT
plot(iff(not (close < open), 1, 0))

Plots 1 when the candle is not down (i.e. up/equal).

or

A boolean that is true when at least one of the two boolean expressions is true.

NOTE

The logical OR connective (a language keyword). The result is true when either condition holds; works bar-by-bar over series.

CODESCRIPT
plot(iff(close > open or volume > sma(volume, 20), 1, 0))

Plots 1 when it is an up candle or volume is above its average.

true

The boolean constant that is always true.

NOTE

The boolean true literal (a language keyword). Used as a checkbox default or to temporarily pin a condition on.

CODESCRIPT
plot(iff(true, close, open))

Since the condition is always true, close is plotted.