Draw a line and have Easylanguage display the coordinate

Studies that have been contributed to the community by other users. If you’ve got something useful to share, that’s great!
arjfca
Posts: 1292
Joined: 23 Nov 2010
Has thanked: 725 times
Been thanked: 223 times

Draw a line and have Easylanguage display the coordinate

Postby arjfca » 17 Jun 2011

Hello

How to get information using EyLanguage of a line that have been draw manually over a chart.
An interesting video that I just look at and i wanted to share with the forum.

I suppose that it could be use also to expand a line automatically or for my need, a rectangular.

http://www.markplex.com/cgi-bin/dada/ma ... 048723507/

I'm not in any manner linked nor promote this site.

Martin

User avatar
arnie
Posts: 1594
Joined: 11 Feb 2009
Location: Portugal
Has thanked: 481 times
Been thanked: 514 times

Re: Draw a line and have Easylanguage display the coordinate

Postby arnie » 18 Jun 2011

Yes, it is a very nice way to plot the value for manual trendlines.

But it seems that it doesn't work as it should in MC.

We move the line, but the text doesn't follow. We delete the trendline, but the text isn't delete.
Did I miss something?

Code: Select all

// http://www.markplex.com/tutorial64-easylanguage-drawing-tool-line.php

inputs:
decimals (2);

variables:
endLineDate (0),
endLineTime (0),
endLineVal (0),
drawToolLineRef (0),
endLineTxtRef (-1);

if barnumber = 1 or lastbaronchart then drawToolLineRef = tl_getfirst(7);

if drawToolLineRef >= 1 then begin
endLineDate = tl_getenddate(drawToolLineRef);
endLineTime = tl_getendtime(drawToolLineRef);
endLineVal = tl_getendval(drawToolLineRef);

if Text_Exist(endLineTxtRef) = false then
endLineTxtRef = text_new(endLineDate, endLineTime, endLineVal, numtostr(endLineVal, decimals))
else begin
text_setlocation(endLineTxtRef, endLineDate, endLineTime, endLineVal);
text_setstring(endLineTxtRef, numtostr(endLineVal, decimals));
end;

end;

if drawToolLineRef < 1 and Text_Exist(endLineTxtRef) then
text_delete(endLineTxtRef);

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

Re: Draw a line and have Easylanguage display the coordinate

Postby TJ » 18 Jun 2011

Yes, it is a very nice way to plot the value for manual trendlines.

But it seems that it doesn't work as it should in MC.

We move the line, but the text doesn't follow. We delete the trendline, but the text isn't delete.
Did I miss something?

Code: Select all

// http://www.markplex.com/tutorial64-easylanguage-drawing-tool-line.php

inputs:
decimals (2);

variables:
endLineDate (0),
endLineTime (0),
endLineVal (0),
drawToolLineRef (0),
endLineTxtRef (-1);

if barnumber = 1 or lastbaronchart then drawToolLineRef = tl_getfirst(7);

if drawToolLineRef >= 1 then begin
endLineDate = tl_getenddate(drawToolLineRef);
endLineTime = tl_getendtime(drawToolLineRef);
endLineVal = tl_getendval(drawToolLineRef);

if Text_Exist(endLineTxtRef) = false then
endLineTxtRef = text_new(endLineDate, endLineTime, endLineVal, numtostr(endLineVal, decimals))
else begin
text_setlocation(endLineTxtRef, endLineDate, endLineTime, endLineVal);
text_setstring(endLineTxtRef, numtostr(endLineVal, decimals));
end;

end;

if drawToolLineRef < 1 and Text_Exist(endLineTxtRef) then
text_delete(endLineTxtRef);

are you doing this offline?

MultiCharts is an event driven program,
it requires a new tick to update the indicators.

Look up RecalcLastBarAfter for offline test.


Return to “User Contributed Studies and Indicator Library”