Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 286

 
Nauris Zukas:

Didn't work, maybe there's a mistake in the code?

And how do you want to assign the "select" property to an object by dragging that object before it's selected???

You have to do that when you create the object. But you can cancel selection by dragging event as well.

 
Alexey Viktorov:

And how do you want to assign the "select" property to an object by dragging the object before it's selected?

You have to do that when the object is created. But you can unselect it with a dragging event as well.

Thank you, I've more or less understood the error. I will have to redo it.

 
Nauris Zukas:

Thank you, I more or less understand the mistake. I'll have to redo it.

There's not much to redo.
void SetHLine(color cl, string nm="", double p1=0, int st=0, int wd=1) {
  if (nm=="") nm=DoubleToStr(Time[0], 0);
  if (p1<=0) p1=Bid;
  if (ObjectFind(nm)<0) {
   ObjectCreate(nm, OBJ_HLINE, 0, 0,0);
   ObjectSetInteger(0,nm,OBJPROP_SELECTED,true);
  }
  ObjectSet(nm, OBJPROP_PRICE1, p1);
  ObjectSet(nm, OBJPROP_COLOR , cl);
  ObjectSet(nm, OBJPROP_STYLE , st);
  ObjectSet(nm, OBJPROP_WIDTH , wd);
}
 
Vitaly Muzichenko:
I don't need to redo it.

Vitaly, have you checked it in mql4? I got something in mql5 only in 3 lines not counting object creation.

   ObjectSetInteger(0, name, OBJPROP_HIDDEN, false);
   ObjectSetInteger(0, name, OBJPROP_SELECTABLE, true);
   ObjectSetInteger(0, name, OBJPROP_SELECTED, true);
By removing any of these lines the object is not selected.
 
Alexey Viktorov:

Vitaly, have you checked it in mql4? I got something in mql5 only in 3 lines not counting object creation.

By removing any of these lines the object is not selected.

It's in 5 you need the full set, in 4 each works separately

 

A hint, there is an indicator in a subwindow that uses 5 buffers, but three of them are hidden.

Question: how to remove the extra calculation readings, it displays all 5 but only needs 2


 
Vitaly Muzichenko:

A hint, there is an indicator in a subwindow that uses 5 buffers, but three of them are hidden.

Question: how to remove the extra calculation readings, it displays all 5 but only needs 2

If there is a source - DROW_NONE - absence of any drawing

 
Vitaly Muzichenko:
Not much need for rework

Thank you, everything works! Can you tell me how the Expert Advisor detects the price of a moved line?

 
Nauris Zukas:

Thank you, it all works! Can you tell me how the Expert Advisor identifies the price at which the line is moved?

One of the line properties is price as a coordinate on the vertical axis
 
STARIJ:
one of the line properties will be price as a vertical axis coordinate

Thank you, I found the properties function - ObjectGet.