'text'=series[string] to const string

Viewed 2222

I am trying to list the number of bullish or bearish candles in a row, for this I use plotshape and I keep a counter to count them, but I have a problem when writing the value

c = 1
if bull and bull[1]
    c := c + 1

plotshape(bull, style=shape.triangledown, location=location.abovebar, color=color.green, text = tostring(c))

How can I convert 'text'=series[string] to const string.

I found the function label.new(...) but I am looking for something to have over the whole sequence and the labels only appear in the last section of candles

1 Answers

You can do it with label.new(), try this approach:

if bull
    label.new(bar_index, high, text=tostring(c), style=label.style_label_down)
Related