PureBytes Links
Trading Reference Links
|
Dan wrote:
> I am working on code that displays the actual value of the indicator on
> the chart instead of having to invoke the data window. (Ex. displaying
> actual level of support/resistance)
>
> The problem I'm having is that I can't get rid of the old values
> displayed on the screen. This makes for quite a garbled mess. So ideally
> I would like to see the currentbar's indicator value and erase the
> previous values that have been printed on the screen.
The trick is to just write the text once, for example when currentbar=1
or when you draw a new trendline, and then use the text_setlocation and
text_setstring commands to modify it bar by bar. Use the function wizard
and the online help to help keep the syntax straight. Here's an example
indicator that plots an xaverage along with text.....
var: av(0), txt_str(""), txt(0);
av = xaverage(c,10);
txt_str = numtostr(av,2);
if currentbar = 1 then begin
txt = text_new(date,time,av+1,txt_str);
text_setstyle(txt,1,1);
text_setcolor(txt,tool_green);
end else begin
text_setlocation(txt,date,time,av+1);
text_setstring(txt,txt_str);
end;
plot1(av,"Average");
--
Dennis
|