pine-scriptpine-script-v5tradingview-apiindicator

How can I plot indicator values in data window


How can I plot lres and lsup values that are in if statement in data window in this pinescript code:

if barstate.islast
        lres = line.new(x1=bar_index, y1=lvalue, x2=lindex, y2=lvalue, color=isBullish ? bearishColor : bullishColor, width=2, style=line.style_dashed, extend=extend.left)
        lsup = line.new(x1=bar_index, y1=llvalue, x2=llindex, y2=llvalue, color=isBullish ? bullishColor : bearishColor, width=2, style=line.style_dashed, extend=extend.left)
        lsup

Iam new to pinescript, please help this nooby :)

I've asked ChatGPT about this, unfortunately, it was a not good in pinescript, now the only way for me is stack overflow


Solution

  • lres and lsup are just lines. Their values are lvalue and llvalue respectively.

    So, just do

    plotchar(lvalue, "lvalue", "", display=display.data_window)
    plotchar(llvalue, "llvalue", "", display=display.data_window)