Clearing the ChartPane
Author: thetraderman
Creation Date: 4/26/2011 10:44 AM
profile picture

thetraderman

#1
I searched using F11 (QuickRef) as well as the forum and couldn't find an answer; I was wondering if there is a global command in my script to clear all text, drawings, etc for the chartpane?
profile picture

Eugene

#2
No, there's not. But let's start with why would you want to do it? After all, it's your code that adds all those graphic objects to the PricePane/ChartPane.
profile picture

thetraderman

#3
To be clearer I use AnnotateBar to place text over and under the bar. Currently if I call it multiple times the text stacks as described in the Quickref. I would like it not to stack but overwrite what is already there. Is that possible? If not is there a way I can use DrawText and have it point to a specific bar rather than x-y coordinates? In short I want to put text under and over specific bars and change the text when I need to without stacking. I can't believe there isn't a way.
profile picture

Cone

#4
QUOTE:
In short I want to put text under and over specific bars and change the text when I need to without stacking.
You've missed Eugene's point. Each time a script runs, the chart is refreshed. The idea is to annotate only what you want to see on the chart. In other words, if you're going to write 10 things on bar 123, don't write the first 9 and annotate only the 10th thing. Understand?

Exactly how you do it depends on you. You could, for example store all the text in a List or Dictionary index by bar. As your script process, it adds the entries. But, if a record already exists for a particular bar, just replace it. When finish processing the bars, annotate with what remains in the list.
profile picture

thetraderman

#5
I actually thought of what you said about 10 minutes ago and implemented it. Just displayed the latest info works fine. Thanks.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).