0

can't add prefix here

below is my code

// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Bao1984

//@version=5
indicator("ATR in Percentage", "D", format=format.percent)

lengthofAtr = input.int(5, "ATR length", minval=2, group = "Length setting", inline = "01")
lengthofWMA = input.int(10, "WMA optimized by ATR length", minval=2, group = "Length setting", inline = "02")
noholiday   = input.bool(true, "Using holiday periods", group = "user define", inline = "01")

atrInPercentage = ta.atr(lengthofAtr)/(hlcc4*0.01)
atrweightedWMA = (ta.wma(ta.atr(lengthofAtr), lengthofWMA))/(ohlc4*0.01)


plot(atrInPercentage, title = "ATR in Percentage" + str.tostring(atrInPercentage), color=color.teal, linewidth=1, trackprice=true)
plot(atrweightedWMA, title = "ATR weighted WMA", color=color.gray, linewidth=1 )

I want to see these two words display on status line of chart

1 Answer 1

0

you can only see plot series in status.
Try a table, below the status

enter image description here

f_printTable(_text) =>
    var table _printTable = table.new(position.top_left, 1, 1, force_overlay = true)
    table.cell(_printTable, 0, 0, _text, bgcolor = na, text_color = color.new(color.gray, 0))

t_txt        = "\nATR in Percentage: " + str.tostring(atrInPercentage,format.percent) +
               "\nATR weighted WMA: "  + str.tostring(atrweightedWMA,format.percent)

f_printTable(t_txt)
1
  • 1
    Thank you very much! I had been tried this for hours a few days ago... and couldn't find a appropriate method to print this out. I will try it later Recently I’m learning trading through tradingview. All the best! Commented Jul 11 at 11:00

Not the answer you're looking for? Browse other questions tagged or ask your own question.