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: 1273
Joined: 23 Nov 2010
Has thanked: 721 times
Been thanked: 222 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: 1589
Joined: 11 Feb 2009
Location: Portugal
Has thanked: 478 times
Been thanked: 509 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: 6583
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 970 times
Been thanked: 1907 times

Re: Draw a line and have Easylanguage display the coordinate

Postby TJ » 18 Jun 2011

arnie wrote: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”