4
//@version=4

study(shorttitle="try", title="line", overlay=true, resolution="")

line.new(x1=bar_index[10], y1=close[10], x2=bar_index, y2=close)

I want to draw a simple line in trading view chart using pine scripts. I am getting resolution error. Am I missing anything?

Error: line 5: The 'resolution' argument is incompatible with functions that have side effects. Script 'crcheck' has been saved

PineCoders-LucF
  • 8,288
  • 2
  • 12
  • 21
bhpwork
  • 41
  • 1
  • 2
  • If you're the one who asked the same question in Pine Script chat, don't ask the same question in multiple forums. You risk getting different volunteers helping you concurrently. – PineCoders-LucF Sep 18 '20 at 00:56
  • It seems the "label" or "line" function is causing the problem mainly. It's a bug. Since the feature is officially implemented in the late 2020 and it is quite new, I hope this should be fixed in near future. – ー PupSoZeyDe ー Jul 05 '21 at 11:16

2 Answers2

5

Remove

, resolution=""

then it should work.

DiVa
  • 51
  • 1
  • 2
0

Wording is obscure because of space constraints, but it means you're using stuff that can't be calculated/rendered on other TFs. Doesn't mean it's impossible to code in Pine; you will most often be able to code it using security(); just means it can't be handled with the resolution method, whose purpose is to provide a simple way to provide MTF functionality for simple scripts. It does not deprecate security().

PineCoders-LucF
  • 8,288
  • 2
  • 12
  • 21