I am using Tradingview Pinescript 4.0
My goal is to create a line that changes color (based on an input value). If "short" is chosen, it will print a red line of 20 bars in length. If "long" is chosen, then the bar would be green.
I tried the code below
x_color = color.yellow
x_transp = 100.0
if enter_long
x_color := color.teal
x_transp := 0
if enter_short
x_color := color.red
x_transp := 0
plot(i_entry_level, color=x_color, transp=x_transp, linewidth=2, title="Start Level")
But I get the following as an error message:
line 146: Cannot call 'plot' with arguments (input integer, color=series[color], transp=series[float], linewidth=literal integer, title=literal string); available overloads: plot(series[float], const string, series[color], input integer, input integer, input bool, input integer, input float, series[integer], input bool, series[float], const bool, input integer, const integer, string) => plot; plot(<arg_series_type>, const string, <arg_color_type>, input integer, input integer, input bool, input integer, input float, series[integer], input bool, series[float], const bool, input integer, const integer, string) => plot