Keywords
enum
Declares an enum of your own, as a braced block of members, one per line. A member may carry something after `=`. Note what that is: a title, not a value.
Syntax
enum <enum_name> {
<enum_field> [= <title>]
...
}
Example
//@lipi=2
indicator("enum Example", overlay=true)
// Each member may carry a title after =, shown in the settings dropdown
enum Signal {
buy = "Buy"
sell = "Sell"
neutral = "Neutral"
}
signal = close > open ? Signal.buy : close < open ? Signal.sell : Signal.neutral
bgcolor(signal == Signal.buy ? color.new(color.green, 0.15) : signal == Signal.sell ? color.new(color.red, 0.15) : na)