Page 1 of 1

Draw a line and have Easylanguage display the coordinate

Posted: 17 Jun 2011
by arjfca
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

Re: Draw a line and have Easylanguage display the coordinate

Posted: 18 Jun 2011
by arnie
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);

Re: Draw a line and have Easylanguage display the coordinate

Posted: 18 Jun 2011
by TJ
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.