MC: New Line in text plot on chart?

Questions about MultiCharts and user contributed studies.
User avatar
Henrik
Posts: 140
Joined: 13 Apr 2010
Has thanked: 25 times
Been thanked: 11 times

MC: New Line in text plot on chart?

Postby Henrik » 10 Jul 2010

Hi!
I want to plot a text on a chart.
Want to see on chart:
Netto: XXX
Last Trade: XXX


But how?

Documataton says: Add "+ NewLine" to a string expression.

But it doesn't work for the Chart? :(
Code for see all in ONE Line:

Code: Select all

var0 = Text_New ( Date, Time, Close, "Netto:"+text(NetProfit)+ " // Letzte Posi:"+text(PositionProfit(1))) ;



Code for see all in 2 Lines on chart?

Code: Select all

var0 = Text_New ( Date, Time, Close, "Netto:"+text(NetProfit)+NewLine+ " // Letzte Posi:"+text(PositionProfit(1))) ;


+NewLine doesnt work.
Is there a solution for my problem?

See on picture: I want instead of the // a new line!
Attachments
lastposi.JPG
lastposi.JPG (13.74 KiB) Viewed 210 times

User avatar
Henrik
Posts: 140
Joined: 13 Apr 2010
Has thanked: 25 times
Been thanked: 11 times

Postby Henrik » 10 Jul 2010

Thank you, TJ.
But there is no new line :cry:
It's easier to see the parameters on several lines, not in one line.

User avatar
TJ
Posts: 6521
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 957 times
Been thanked: 1883 times

Postby TJ » 10 Jul 2010

Code: Select all

id.txt.1 = Text_New( D, T, C, "Netto:"+text(NetProfit)) ;
id.txt.2 = Text_New( D, T, C, "Letzte Posi:"+text(PositionProfit(1))) ;

text_setstyle(id.txt.1, 0, 1);
text_setstyle(id.txt.2, 0, 0);

Last edited by TJ on 10 Jul 2010, edited 1 time in total.

User avatar
Henrik
Posts: 140
Joined: 13 Apr 2010
Has thanked: 25 times
Been thanked: 11 times

Postby Henrik » 10 Jul 2010

Thank you, TJ.
I will try this 8)

User avatar
Henrik
Posts: 140
Joined: 13 Apr 2010
Has thanked: 25 times
Been thanked: 11 times

Postby Henrik » 11 Jul 2010

Here we go:

Code: Select all


Variables:
   id.txt(-1),
   id.txt2(-1),
   txt.data1(""),
   txt.data2(""),
   bottomprice(0),
   upperprice(0);

bottomprice = getappinfo(ailowestdispvalue);
upperprice = getappinfo(aihighestdispvalue);


txt.data1 = "Netto Summe:"+text(NetProfit);
txt.data2 = "Letzte Posi:"+text(PositionProfit(1))
      + ";  Offene Posi:"+text(PositionProfit(0))
      + ";  Anzahl Trades:"+text(TotalTrades )
      +  ";  Profitabel"+text(PercentProfit)+"%";



if currentbar=1 then
begin
   id.txt = text_new(d , t, bottomprice+((upperprice-bottomprice)*.05), txt.data1);
   Text_SetStyle (id.txt , 1, 1);
   Text_Setcolor (id.txt , black);
   text_setsize (id.txt , 12);
   Text_SetBGColor(id.txt, LightGray);
   text_setattribute (id.txt, 1, true);
   
   id.txt2 = text_new(d, t,  bottomprice+((upperprice-bottomprice)*.05), txt.data2);
   Text_SetStyle (id.txt2 , 1, 0);
   Text_Setcolor (id.txt2 , black);
   text_setsize (id.txt2 , 12);
   Text_SetBGColor(id.txt2, LightGray);
   text_setattribute (id.txt2, 1, true);
end;

text_SetString(id.txt, txt.data1);
text_setlocation(id.txt, d, t ,  bottomprice+((upperprice-bottomprice)*.05));
text_SetString(id.txt2, txt.data2);
text_setlocation(id.txt2, d, t,  bottomprice+((upperprice-bottomprice)*.05));


Use it at a own "Strategy" :D
Thank TJ for help!
Attachments
profitanzeige.JPG
profitanzeige.JPG (84.34 KiB) Viewed 213 times

User avatar
TJ
Posts: 6521
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 957 times
Been thanked: 1883 times

Postby TJ » 11 Jul 2010

...
Use it at a own "Strategy" :D
Thank TJ for help!


Henrik:
You are welcome.
Thanks for sharing your code.


Return to “MultiCharts”