Issues while converting series to const string for plotshape text

Viewed 163

I have been trying to print the current volume as a plotshape text label using the following code...

plotshape(EntryCondition, style=shape.labelup, title="Buy flag", location=location.belowbar, color=color.lime, text=str.tostring(volume)) 

but I keep getting this error..

Cannot call 'plotshape' with argument 'text'='call 'str.tostring' (series string)'. An argument of 'series string' type was used but a 'const string' is expected

Any advice on how to fix this?

1 Answers

There is no way to force the plotshape() to accept series string, unfortunately. Use the label.new() function instead, which allows to plot and change the text dynamically.

if longCondition
    label.new(bar_index, low, str.tostring(volume), color = color.lime, style = label.style_label_up)
Related