On chart text not deleting  [SOLVED]

Questions about MultiCharts and user contributed studies.
AMarsland
Posts: 28
Joined: 30 Sep 2010
Has thanked: 5 times
Been thanked: 1 time

On chart text not deleting  [SOLVED]

Postby AMarsland » 17 Feb 2016

hi there,
I'm using this code to add an ATR value to my daily chart which updates on each tic:

if LastBarOnChart then begin
value30 = text_new(date,time,highest(high,50),"Yesterday's 5 Day ATR = " + printText);
value31 = text_setColor(value30,white);
end
else begin
value32 = text_delete(value30);
end;

Every now and then the text is not deleted and I get multiple texts all mushed over the top of each other... Do I need to alter my code?

Thanks,
Anthony

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: On chart text not deleting

Postby TJ » 17 Feb 2016

hi there,
I'm using this code to add an ATR value to my daily chart which updates on each tic:

if LastBarOnChart then begin
value30 = text_new(date,time,highest(high,50),"Yesterday's 5 Day ATR = " + printText);
value31 = text_setColor(value30,white);
end
else begin
value32 = text_delete(value30);
end;

Every now and then the text is not deleted and I get multiple texts all mushed over the top of each other... Do I need to alter my code?

Thanks,
Anthony

Try this

Code: Select all

var:
text.atr(-1);

if LastBarOnChart then begin
text.atr = text_new(date,time,highest(high,50),"Yesterday's 5 Day ATR = " + printText);
text_setColor( text.atr ,white);

if barstatus = 2 then text_delete( text.atr );
end;

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: On chart text not deleting

Postby TJ » 17 Feb 2016

ps. See post #1 & #2
[FAQ] How to Post Codes (... so that people can read)
viewtopic.php?f=16&t=11713


Return to “MultiCharts”