'Pine Script - ternary operator in "display" parameter in plot call causes invalid argument error

//@version=5
strategy(title='Test',overlay=true)
i_hide_eq = input.bool(true, title='Hide Equity Curve')

plot(strategy.equity, display=i_hide_eq ? display.none : display.all)
plot(series=1.5, color=color.red, style=plot.style_linebr, title='Test Point')

Why does this code cause following error? I am using "Possible values".

Invalid argument 'display' in 'plot' call. Possible values: [display.none, display.all]



Solution 1:[1]

Make it in this way.

//@version=5
strategy(title='Test',overlay=true)
i_hide_eq = input.bool(true, title='Hide Equity Curve')
plot(i_hide_eq == true ? strategy.equity : na)
plot(series=1.5, color=color.red, style=plot.style_linebr, title='Test Point')

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 You Hang