Remove markers above / below PAST bars ?

Spin

Well-known member
Joined
May 22, 2019
Posts
477
Likes
191
Hello fellow coders,

I was wondering if there was a way to remove Markers (that have been plotted above or below a bar by a study) on specific bars in the past ?

Something along these lines:

Java:
IF (currentBar > some value)

     {delete all the Markers above the last X bars in the past}

I know there is such a thing as 'clearFigures();', but this deletes ALL the Markers on a chart, which is not what I want. I am looking for a more 'granular' approach. Until now my investigations into the SDK API reference manual came up empty :)

Thanks in advance for your input !
 

igor.s

Well-known member
Joined
May 22, 2019
Posts
283
Likes
152
Have you look at this method:

removeFigure(Figure figure) ?

perhaps you could create your own object with a price level as a key and Figure as a value. Then when you add a marker to the chart you also add a new object (price, Figure) to a collection. Then you could go through a collection and remove figures according to your condition. Just a rough idea.

Good luck,
Igor
 

Spin

Well-known member
Joined
May 22, 2019
Posts
477
Likes
191
Thanks for the tip, igor.s ! (y)

Although your idea sounds perfectly doable, I am not going to implement it right away.
Too much other stuff going on.

But I will surely look into it ! One day ... ;)
 
Top