Vijayanand Premnath
Vijayanand Premnath

Reputation: 3615

In Trading view I am using plotshape to show buy sell signal how do I add open price in the text

I tradingview platform I am using Version 2 script. I have a code which show Buy sell signal like this

plotshape(long_final, style=shape.labelup,
          location=location.belowbar, color=green,size=size.tiny,title="buy label",text="Buy",textcolor=white)
plotshape(short_final, style=shape.labeldown,
          location=location.abovebar, color=red,size=size.tiny,title="sell label",text="Sell",textcolor=white)

How I need to add Candle open value in it. If I change like below I get an error can you please help

plotshape(long_final, style=shape.labelup, location=location.belowbar, color=green,size=size.tiny,title="buy label",text="Buy"+tostring(open),textcolor=white)

Upvotes: 0

Views: 925

Answers (2)

Dolla Chandra Babu
Dolla Chandra Babu

Reputation: 3

label.new(x=bar_index, y=high, color=color.orange,  textcolor=color.blue, text=str.tostring(smavalue))

I use the above code to put the value into the text. Try label with str.tostring().

Upvotes: -1

Mahome
Mahome

Reputation: 132

I've tried the same as you did before and I couldn't. I don't think the PineScript fitted to use tostring() in plotshape function. Instead, Try to use label.new()

lab= label.new(
                      bar_index, close, 
                      text="Buy"+tostring(open),  
                      color=color.white, 
                      textcolor= color.blue,
                      size= size.auto,
                      style=  label.style_square,
                      yloc= yloc.abovebar)

Upvotes: 0

Related Questions