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
| Name | Type | Description |
|---|---|---|
series | series | Values to keep. |
condition | boolean | When 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