Download MetaTrader 5
To add comments, please log in or register
All articles are available from MetaTrader 5. Contribute your own one!
Emiliano Graziosi
40
Emiliano Graziosi 2014.03.24 15:26 

Hi all,

I'm facing the following problem: when orders are opened/closed the arrows and lines are drawn above the label objects I've created (see attachment). I cannot find a way to specify that the arrows must be in the back while the label must be in front.

I'm using standard functions both for creating the rectangle label and for sending orders. Following the code:

RectLabelCreate(0,InpName,0,x,y,width,height,InpBackColor,InpBorder,InpCorner,InpColor,InpStyle,InpLineWidth,InpBack,InpSelection,InpHidden,InpZOrder);

OrderSend(Symbol(),OP_SELLLIMIT,Lots,Price,Slippage,0,0,IComment_2,ExpertID,0,DodgerBlue);

Any help would be really appreciated.

Thanks&Best regards

qjol
3243
qjol 2014.03.24 15:50  

TradingGrep:

[...](see attachment). [...]


don't see anything

how to attached

Emiliano Graziosi
40
Emiliano Graziosi 2014.03.24 15:52  

Here it is... i missed the small grey bottom note about how to insert a pic file :-)

qjol
3243
qjol 2014.03.24 16:31  
Emiliano Graziosi
40
Emiliano Graziosi 2014.03.24 16:43  

OBJPROP_BACK can be set for the Rectangle and for the Text Labels you see in the pictures, for both of them I've set it already to FALSE. Anyway the arrows created by default with the OrderSend function cannot have the properties changed (I even do not have the handle to make it).

Any other hint?

qjol
3243
qjol 2014.03.24 17:16  

just set the arrows and trandlines to true

TradingGrep:

Anyway the arrows created by default with the OrderSend function cannot have the properties changed (I even do not have the handle to make it).

for(int i = ObjectsTotal() - 1; i >= 0; i--)
   {
   if (StringFind(ObjectName(i), "#") == 0)
      {
      ObjectSet(ObjectName(i), OBJPROP_BACK, true);
      }
   }
Emiliano Graziosi
40
Emiliano Graziosi 2014.03.24 18:22  
qjol:

just set the arrows and trandlines to true


Not working.

I even extended the code:

int obj_total=ObjectsTotal();

string name, objdescription;

int obj_type;

for(int counter=0;counter<obj_total;counter++)

{

name = ObjectName(counter);

objdescription = ObjectDescription(counter);

obj_type = ObjectType(counter);

Print(counter," object - ",name," description - ",objdescription," type - ",obj_type);

ObjectSet(ObjectName(counter), OBJPROP_BACK, true);

}

As you can see what happens is that the arrows disappear (probably are put behind the circles), moreover in the Journal all the object have type "-1", so it's not possible to understand which are the arrows objects. The problem i see is that it's not possible to define a clear order in displaying. I would like to give the following displaying order (from foreground to background)

1. the information box (the rectangle label)

2. the orders objects: texts (i.e.: #2 buy 0.05...), arrows, lines, circles

In the end, I just would like to specify the the information box is in front of everything, then all the rest can stay as it is.



qjol
3243
qjol 2014.03.24 20:39  

obj_type = ObjectType(counter);

wrong

obj_type = ObjectType(ObjectName(counter));

see ObjectType

Emiliano Graziosi
40
Emiliano Graziosi 2014.03.24 23:27  
qjol:

obj_type = ObjectType(counter);

wrong

see ObjectType


You are right, my mistake. Putting in the correct code I can see that object types printed in the journal are: 2 and 22. I'm checking to which objects they are associated (line, arrow, ...).

Anyway, the problem about the circles around the arrow is still there, that is: if i set all the objects as background to TRUE, the arrows are put behind the circles (while it should be the opposite). It seems like the circles are not trapped as objects.

SYED NAUFAL GADDAFI
1401
SYED NAUFAL GADDAFI 2014.03.24 23:44  
TradingGrep:


Anyway, the problem about the circles around the arrow is still there, that is: if i set all the objects as background to TRUE, the arrows are put behind the circles (while it should be the opposite). It seems like the circles are not trapped as objects.


If I understand your problem correctly, the easiest way, to put the object in line by line order.

Means that, if I wrote it like this:


First line > ObjectCreate ....

Second line > ObjectCreate ...


Example:

   objCLabel("objname1stline","objname1stlineT",100,10,Yellow,"Wingdings",10);
   objCLabel("objname2ndline","objname2ndlineT",200,20,Yellow,"Wingdings",10);
   objCLabel("objname3rdline","objname3rdlineT",300,30,Yellow,"Wingdings",10);

objname1stline would always the last priority to be shown while objname3rdline would be the first priority to be shown.

Means that objname3rdline would always be on top of the others while objname1stline would always be under the others.

The last line always take the priority.

Emiliano Graziosi
40
Emiliano Graziosi 2014.03.25 00:07  
deysmacro:

If I understand your problem correctly, the easiest way, to put the object in line by line order.

Means that, if I wrote it like this:


First line > ObjectCreate ....

Second line > ObjectCreate ...


Example:

objname1stline would always the last priority to be shown while objname3rdline would be the first priority to be shown.

Means that objname3rdline would always be on top of the others while objname1stline would always be under the others.

The last line always take the priority.



Do you know if what you say works also with graphical objects created automatically by OrderSend/OrderClose functions?

As I wrote at the very beginning, some object are created by me using the ObjectCreate function (i.e.: the rectangular box and the text in the rectangular box), but the arrows, circles and lines in the chart are created automatically by OrderSend/OrderClose functions and I do not have control parameters on those. To apply your suggestion I should recreate the rectangular box and text in it soon after an OrderSend function is invoked, but I'm afraid it will imply a processing overload.

/ /12
To add comments, please log in or register