'Hi,Why i get this error? Cannot call 'operator ?:' with argument 'expr0'='Candy'

//@version=5
indicator(title='Rsi color', shorttitle='RSI col', overlay=false)

theme = input.string(defval='Dark', title='Colors', options=['Candy', 'Dark', 'Light', 'Ocean'])

col_ln_up = theme == 'Dark' ? color.rgb(076, 175, 080, 000) : 'Candy' ? color.rgb(102, 187, 106, 000) : 'Light' ? color.rgb(076, 175, 080, 000) : color.rgb(250, 161, 164, 000)

col_ln_dn = theme == 'Dark' ? color.rgb(242, 054, 069, 000) : 'Candy' ? color.rgb(247, 082, 095, 000) : 'Light' ? color.rgb(149, 152, 161, 000) : color.rgb(178, 085, 190, 000)

rsi = ta.rsi(close,14)

plot(rsi, color = rsi >= 50 ? col_ln_up : col_ln_dn, linewidth=3, editable=false)


Solution 1:[1]

You need to add your condition theme == 'xxx' again for each argument.

col_ln_up = theme == 'Dark' ? color.rgb(076, 175, 080, 000) : theme == 'Candy' ? color.rgb(102, 187, 106, 000) : theme == 'Light' ? color.rgb(076, 175, 080, 000) : color.rgb(250, 161, 164, 000)

col_ln_dn = theme == 'Dark' ? color.rgb(242, 054, 069, 000) : theme == 'Candy' ? color.rgb(247, 082, 095, 000) : theme == 'Light' ? color.rgb(149, 152, 161, 000) : color.rgb(178, 085, 190, 000)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 vitruvius