The two Boolean literals, true and false, which have no namespace.
true and false are the only values of the bool type. Comparisons, crossovers and logical operators all produce them, and if, while, ternary conditions and plotshape series consume them.
In Pine v6 a bool is never na: a condition is either true or false, and the na-handling functions have no effect on it. A series that must stay empty on some bars should be a number, not a bool.
Constants
| Name | Value | Description |
|---|---|---|
true | true | The Boolean value for yes. |
false | false | The Boolean value for no. |
Remarks
- In v6, an if or ternary condition must be a bool. A number used as a condition is an error; compare it first, for example x != 0.
- On Sidechair: a number or na used as a condition does not fail; non-zero numbers count as true and na as false.
Example
//@version=6
indicator("Booleans", overlay = true)
bullish = close > open
bool strongClose = bullish and close > high[1]
plotshape(strongClose, "Strong close", shape.triangleup, location.belowbar, color.green)
bgcolor(bullish == false ? color.new(color.red, 92) : na)See also
Runs on Sidechair