Lock drawing in EL?

Questions about MultiCharts and user contributed studies.
Posts: 87
Joined: 02 Apr 2012
Has thanked: 36 times
Been thanked: 22 times

Lock drawing in EL?

Postby seneca » 18 Feb 2013

I wonder if drawings can be locked by EL code, instead of using the chart window's context menu.
For example, I use the following code (which I've found in Project Management) to display a horizontal price line which updates on each tick:

Code: Select all

vars: intrabarpersist need_delete_this_bar(false);

if lastbaronchart then begin

   value10 = TL_New(date, time-2400, close, date, time, close);
   Value1  = TL_SetColor (value10, white);
   value1  = TL_SetExtRight (value10, true);
   value1  = TL_SetExtLeft (value10, false);
   value1  = TL_setsize (value10, 1);
   value1  = TL_Setstyle (value10, 2);

   need_delete_this_bar = not need_delete_this_bar and value10[1] > 0 AND value10 <> value10[1];
   value11 = tl_getfirst(1);

   if tl_getnext(value11, 1) > 0 and need_delete_this_bar then value1 = TL_Delete(value11);
   if barstatus = 2 then need_delete_this_bar = false;

The price line can be manually locked via context menu, but as soon as the price is updated (and the price line moves), the line is unlocked again.

When the chart is grabbed in order to drag it along the time axis, it easily happens that you accidently grab the price line and move it.

So is there a reserved word in EL to lock drawings, or to be more precise, to prevent manually dragging them?

User avatar
Henry MultiСharts
Posts: 8503
Joined: 25 Aug 2011
Has thanked: 1213 times
Been thanked: 2731 times

Re: Lock drawing in EL?

Postby Henry MultiСharts » 20 Feb 2013

Hello seneca,

Thank you for your suggestion. There is no such resserved word at the moment, but we will add it in MultiCharts 9.
These users thanked the author Henry MultiСharts for the post (total 3):

Return to “MultiCharts”