Multi line text and location

Questions about MultiCharts and user contributed studies.
tozwp
Posts: 133
Joined: 15 Apr 2011
Has thanked: 15 times
Been thanked: 6 times

Multi line text and location

Postby tozwp » 01 Jun 2012

Is it possible to put text on a chart and keep it from being locked to a date? In other words, I'd like to put a note on a chart and as I scroll the chart, the text stays on the same place on the screen as the chart data is moved. Right now text is fixed to a date. Also, it would be very convenient to have multiple lines of text by hitting the carriage return. Currently to get multiple lines, I have to create separate text for each line. Then as the chart updates, I have to manually drag each text individually back to the right.

I watch several sectors and on each sector chart, I have text notes for various ETF's that I will trade. It is time consuming to keep moving each piece of text on each chart as the chart updates.

Stockcharts has the ability to lock or unlock the text location from the date. Metastock and ToS also give this option in addtion to multiple lines of text. It is pretty common. Maybe MC does it but if it does, its not clear to me how to do it.

User avatar
Roman MultiCharts
Posts: 50
Joined: 28 Nov 2011
Has thanked: 21 times
Been thanked: 67 times

Re: Multi line text and location

Postby Roman MultiCharts » 01 Jun 2012

Hello tozwp,

The following script will plot 3 lines of the text that will be alligned to the corner that you choose in the inputs. When you scroll the chart, the text will be still indicated in the corner.

Code: Select all

[RecoverDrawings = false];
Inputs:
Location(1),
ShiftY(12),
ShiftX(5),
FontSize(14),
FontColor(White),
FirstLineText("1st Line"),
SecondLineText("2nd Line"),
ThirdLineText("3rd Line");

vars: LX(0),LY(0),SX(0),SY(0), ADDTM(0),textstyle(0), Right(0);



 DisplayLocation(Location,LX,LY);
SX = 0;
 if (Location=0) or (Location=2) then begin
    SX = ShiftX;
    textstyle = 0;   
 end else if (Location=1) or (Location=3) then begin
    SX = ShiftX*(-1);
    textstyle = 1;   
 end;

 SY = 0;
 if (Location=0) or (Location=1) then begin
    SY = ShiftY*(-1);
 end else if (Location=2) or (Location=3) then begin
    SY = ShiftY;
 end;
 ADDTM = TimeADD(datetime2eltime(LX),SX,value30);

if CurDate =   Date then begin
           text_delete(value6);
           text_delete(value7);
           text_delete(value8);
           value6 = text_new(Date ,Time , Close , FirstLineText);
           value7 = text_new(Date ,Time , Close , SecondLineText);
           value8 = text_new(Date ,Time , Close , ThirdLineText);
           Text_setlocation( value6, JulianToDate(LX)+value30*100,ADDTM,LY+SY* 1 point );
           Text_setstyle(value6, textstyle, 0);
           Text_SetSize(value6,FontSize);
           Text_SetColor(value6,FontColor);
           Text_setlocation( value7, JulianToDate(LX)+value30*100,ADDTM,LY-1+SY* 1 point );
           Text_setstyle(value7, textstyle, 0);
           Text_SetSize(value7,FontSize);
           Text_SetColor(value7,FontColor);
           Text_setlocation( value8, JulianToDate(LX)+value30*100,ADDTM,LY-2+SY* 1 point );
           Text_setstyle(value8, textstyle, 0);
           Text_SetSize(value8,FontSize);
           Text_SetColor(value8,FontColor);

end;


This script can be modified that it will be indicating not only the string values, but also the numeric ones.
These users thanked the author Roman MultiCharts for the post (total 2):
vkingkiasom

vking
Posts: 235
Joined: 21 May 2009
Has thanked: 51 times
Been thanked: 41 times

Re: Multi line text and location

Postby vking » 01 Jun 2012

Thanks Roman. Is this full script? DisplayLocation, TimeAdd seems to be functions which are missing and also CurDate variable declaration missing. Would you please export in pla and attach?

Thanks

User avatar
Roman MultiCharts
Posts: 50
Joined: 28 Nov 2011
Has thanked: 21 times
Been thanked: 67 times

Re: Multi line text and location

Postby Roman MultiCharts » 01 Jun 2012

vking wrote:Thanks Roman. Is this full script? DisplayLocation, TimeAdd seems to be functions which are missing and also CurDate variable declaration missing. Would you please export in pla and attach?

Thanks


I'm sorry. Here is the .pla archive.
Attachments
Indicator.zip
(2.37 KiB) Downloaded 70 times
These users thanked the author Roman MultiCharts for the post:
vking

tozwp
Posts: 133
Joined: 15 Apr 2011
Has thanked: 15 times
Been thanked: 6 times

Re: Multi line text and location

Postby tozwp » 01 Jun 2012

Thanks Roman.

Will the ability to create multi line text and lock/unlock it from the date be something that is available in the future with the text drawing tool?

User avatar
Henry MultiСharts
Posts: 8473
Joined: 25 Aug 2011
Has thanked: 1211 times
Been thanked: 2718 times

Re: Multi line text and location

Postby Henry MultiСharts » 05 Jun 2012

tozwp wrote:Thanks Roman.

Will the ability to create multi line text and lock/unlock it from the date be something that is available in the future with the text drawing tool?

Hello Tozwp,

You can use "\n" command to plot the text on a new line.
To lock\unlock the drawing-make a right click on it->Lock\Unlock drawing.
Attachments
Text_Drawing.png
Text_Drawing.png (49.27 KiB) Viewed 381 times
These users thanked the author Henry MultiСharts for the post (total 3):
sptraderTJarnie

tozwp
Posts: 133
Joined: 15 Apr 2011
Has thanked: 15 times
Been thanked: 6 times

Re: Multi line text and location

Postby tozwp » 05 Jun 2012

Thanks Henry, didn't know that could be done with the \n modifyer.

Still haven't figured out how to leave the text in the same place on the screen though. Under Format Text, Properties, there is only a selection for the Date and Value. This means that as the data updates, the text will continue to be pegged to that date and move left over time. It would be really nice if it could be made to stay stationary.

Fabrice
Posts: 182
Joined: 14 Jun 2011
Has thanked: 44 times
Been thanked: 30 times

Re: Multi line text and location

Postby Fabrice » 05 Jun 2012

Hello,
Have a look at "Floating text" indicator. This indicator is far from being the right tool that one can expect, but it should do what you need.
Enhancing text writing on chart is a long time feature request. I have made one :
http://www.multicharts.com/pm/viewissue.php?issue_no=MC-606 (vote for it !).
TS Support cannot work on everything at the same time, but this would be nice to have. This problem will soon find an answer anyway with MC.Net, which should allow us to code more easily than with EL what is missing in the user interface.
Regards.

User avatar
JoshM
Posts: 2084
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1525 times
Been thanked: 1483 times
Contact:

Re: Multi line text and location

Postby JoshM » 06 Jun 2012

tozwp wrote:Still haven't figured out how to leave the text in the same place on the screen though. Under Format Text, Properties, there is only a selection for the Date and Value. This means that as the data updates, the text will continue to be pegged to that date and move left over time. It would be really nice if it could be made to stay stationary.

As a temporarily work around, until this is implemented, you can make an indicator that plots the Input text in a text box pegged to a chart location (with the use of GetAppInfo's aiRightDispDateTime, aiLeftDispDateTime and aiHighestDispValue, aiLowestDispValue) and that's get updated on every bar close. That way, if the chart moves left, the text box will remain in the same location. Just an idea. :)


Return to “MultiCharts”