Home/Dovee/Function reference

mask

Keep values where the condition is true; otherwise na.

Reference/Math & comparisons/Function

mask(series, condition)

Useful for split-color plots — for example green Supertrend in uptrend and red in downtrend without tinting the chart background.

Parameters

NameTypeDescription
seriesseriesValues to keep.
conditionbooleanWhen true, keep the value on that bar.

Return value

series

Example

st = supertrend(10, 3)
stUp = mask(st, close is above st)
stDown = mask(st, close is below st)
plot stUp as "Up" green
plot stDown as "Down" red

See also