Download MetaTrader 5
To add comments, please log in or register
Share your programs. That will improve your rating.
corfurio
22
corfurio 2017.01.07 16:24 
Goodmorning everyone.
I'd be trying to finish my indicator, but I can not understand, what are the functions, in order to create the labels, similar to those that are generated automatically when you open a trade (those on the left of the graph, which are anchored. If moves forward, backward graph, the label is always visible.
You know advise me or indicari that function is to be used?
Thank you all
Files:
LABEL.JPG 57 kb
whroeder1
14201
whroeder1 2017.01.07 17:00  
corfurio: what are the functions, in order to create the labels,
  1. Perhaps you should read the manual.
  2. You create objects using ObjectCreate - Object Functions - MQL4 Reference
  3. If you create a OBJ_LABEL - Object Types - Objects Constants - Standard Constants, Enumerations and Structures - MQL4 Reference it is fixed to the window by pixel coordinate.
  4. If you create a OBJ_TEXT - Object Types - Objects Constants - Standard Constants, Enumerations and Structures - MQL4 Reference it is fixed to a bar and moves with the chart.
corfurio
22
corfurio 2017.01.10 10:37  
whroeder1:
  1. Perhaps you should read the manual.
  2. You create objects using ObjectCreate - Object Functions - MQL4 Reference
  3. If you create a OBJ_LABEL - Object Types - Objects Constants - Standard Constants, Enumerations and Structures - MQL4 Reference it is fixed to the window by pixel coordinate.
  4. If you create a OBJ_TEXT - Object Types - Objects Constants - Standard Constants, Enumerations and Structures - MQL4 Reference it is fixed to a bar and moves with the chart.
THANK whroeder1
I tried these days but I could not.
What causes me confusion, and that the labels, (remember that they should have the same properties as those that are generated automatically when you open a trade), are still at a price, (since, citing the example above, these are anchor, to the level where the open position), but .. and here, and that is the problem, the labels you scroll with the mouse on the chart, do not move (forward or backward) but only up or down. And then as if they were anchored, but how and can do this?

I know create labels, I think a detail escapes to me, why I write, maybe you can help me.

Thanks for the support
honest_knave
Moderator
1805
honest_knave 2017.01.10 10:55  
corfurio
22
corfurio 2017.01.10 11:14  
honest_knave:

Hello!
Of course, you are right, in fact I try to do "Label - symbol T"
As you see in the picture, with those labels, if you scroll the chart, the words "do not move horizontally", they are locked!
As they move if larger, in or out the graph, since they are anchored to the price.
When I try to do this, I anchor, but only to a value of (X-Y), not price, so I find myself are locked, but I can not block them at the price level, which is necessary to me, in my case, the open operations.
and the problem that I can not solve

 

honest_knave
Moderator
1805
honest_knave 2017.01.10 11:18  

Those are not OBJ_LABEL or OBJ_TEXT

They are descriptions:

 

 

Example using code: 

   ChartSetInteger(0,CHART_SHOW_OBJECT_DESCR,true);
   string name="MyLine";
   ObjectCreate(0,name,OBJ_HLINE,0,0,Ask);
   ObjectSetString(0,name,OBJPROP_TEXT,"This is my line");  
corfurio
22
corfurio 2017.01.10 11:25  

 

This is what I'm trying to do myself, perhaps with a written, is easier, make my mistakes.

Grai yet, extremely kind, do not know what I am trying to solve this problem.

   ObjectCreate(0,"Âname",OBJ_LABEL,0,OrderOpenPrice(),0);
   ObjectSetInteger(0,"Âname",OBJPROP_XDISTANCE,0);
   ObjectSetInteger(0,"Âname",OBJPROP_YDISTANCE,0);
   ObjectSetInteger(0,"Âname",OBJPROP_CORNER,CORNER_LEFT_UPPER);
   ObjectSetString(0,"Âname",OBJPROP_FONT,"Arial");
   ObjectSetInteger(0,"Âname",OBJPROP_FONTSIZE,10);
   ObjectSetDouble(0,"Âname",OBJPROP_ANGLE,0.0);
   ObjectSetInteger(0,"Âname",OBJPROP_ANCHOR,ANCHOR_LEFT_UPPER);
   ObjectSetInteger(0,"Âname",OBJPROP_COLOR,clrRed);
   ObjectSetInteger(0,"Âname",OBJPROP_BACK,false);
   ObjectSetInteger(0,"Âname",OBJPROP_SELECTABLE,false);
   ObjectSetInteger(0,"Âname",OBJPROP_SELECTED,false);
   ObjectSetInteger(0,"Âname",OBJPROP_HIDDEN,true);
   ObjectSetInteger(0,"Âname",OBJPROP_ZORDER,0);

 

I tried your code and it works ok.

But I'm trying to create "written", not lines.

Written, placed on the price level, it opens the operation. 

corfurio
22
corfurio 2017.01.10 11:32  
Excuse me ... I now noticed the word .. very good !!!!!!!!!! exactly what I would like ... maybe with the possibility to change the corner, put it on the other side, and without speaking, but for what I can put a null color background.ohhhh nice to finally ...;))you are a genius
/
To add comments, please log in or register