0
votes

I tried the following code in my script, but it doesn't work, becuase of error: Cannot use 'plotshape' in local scope.

for i = 0 to counter_buy
    plotshape(high + counter_buy, style = shape.circle, location=location.absolute, color = color.green, size = size.auto)

What I'm trying to do: There is a counter in my script (counter_buy) I want to draw a circle for each value of "1" above the current bar. So if the counter is "3" I want to draw 3 circles above the current bar. Each circle above the other, like this example:

 o
 o
 o
BAR

Is there a way to archive this? Thanks, Mag

2

2 Answers

0
votes

You can't use plot statements in for loops or any other local block in a script. There are 2 ways to go about this, depending on your requirements: either with multiple plotshape() calls or with labels.

  1. Is it important that you see those circles on ALL the dataset's bars where they should appear or are you OK with only the last ~50 occurrences showing?

  2. What's the max value for counter_buy?

0
votes

thanks for your response. My solution were counters in my script that gets higher or lower at specific situations, like crossovers. Then I plot arrows above or below the current bar, with values of my counters.

plotarrow(counter1, colorup=color.green, colordown=color.red,  transp=30, maxheight=50)
plotarrow(counter2, colorup=color.blue,  colordown=color.blue, transp=30, maxheight=30)