0
votes

I am trying to convert a version 2 script that draws a higher timeframe indicator onto a lower timeframe chart into Pinescript version 4 to see due to the indicator being drawn under v2 script was not accurate.

I have used other posts here to try and work out my errors, but have one that I can't work out. Shown below"

line 21: Cannot call plot with arguments (series[float], title=literal string, color=literal color, offset=literal integer, linewidth=literal integer, style=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, string) => plot; plot(fun_arg__, const string, fun_arg__, input integer, input integer, input bool, input integer, input float, series[integer], input bool, series[float], const bool, input integer, string) => plot

Could you explain what this error message means?

I have worked through all my other error messages, but I am new to pine-script and am struggling with this. Your help is truly appreciated.

study("Purple Line", overlay=true)
//@version=4

//inputs
useCurrentRes = input(true, title="Use Current Chart Timeframe?")
resCustom = input(title="Use Different Timeframe? Uncheck Box Above", type=input.resolution, defval="D")

teethLength = 8
teethOffset = 5

res = useCurrentRes ? input.resolution : resCustom

smma(src, length) =>
    smma =  0.0
    smma := na(smma[1]) ? sma(src, length) : (smma[1] * (length - 1) + src) / length
    smma

smmaT = smma(hl2, teethLength)

teeth1 = security(syminfo.tickerid, res, smmaT[1], lookahead = barmerge.lookahead_on)
plot(teeth1, title="Teeth", color=#800080, offset=5, linewidth=2, style=line.style_dotted)
1

1 Answers

0
votes

Read the documentation (Ctrl + Click (PC) or Cmd + Click (Mac) on the function).

style parameter of plot() takes one of the following:

style (input integer) Type of the plot. Possible values are:

  • plot.style_line,
  • plot.style_stepline,
  • plot.style_histogram,
  • plot.style_cross,
  • plot.style_area,
  • plot.style_columns,
  • plot.style_circles.
  • Default value is plot.style_line.

Change plot() to something like this:

plot(teeth1, title="Teeth", color=#800080, offset=5, linewidth=2, style=plot.style_line)