Download MetaTrader 5

MQL5 - ObjectCreate OBJ_LABEL -

To add comments, please log in or register
luisaoisdead
20
luisaoisdead  

Hello....

I recently started experimenting with MQL5 and the following happens to me ...

Error

According to what I know ... it should be in 1, but it never leaves 2.

OnInit()

   ObjectCreate(StringToInteger(_Symbol),"1EstadoSuperiorLavel",OBJ_LABEL,0,0,0);

   ObjectSetString(0,"1EstadoSuperiorLavel",OBJPROP_TEXT,"hola");

.....

OnTick()

   ObjectMove(StringToInteger(_Symbol),"1EstadoSuperiorLavel",0,(PriceInformation[1].time),(PriceInformation[1].high+95*_Point));



Since this does not work, I saw a couple of videos and I came to this ...


but the same thing happens to me ...


the text remains in the upper part, with no possibility of moving ...


ideas?

void OnTick()
  {
   //get the Ask Price
   double Ask=NormalizeDouble(SymbolInfoDouble(_Symbol,SYMBOL_ASK),_Digits);
   //Set Label Text
   //Set Object Properties for a label
   ObjectCreate(0,"Label1",OBJ_LABEL,0,0,0);
   //Set Object Font
   ObjectSetString(0,"Label1",OBJPROP_FONT,"Arial");
   //Set Font Size
   ObjectGetInteger(0,"Label1",OBJPROP_FONTSIZE,50);


   ObjectSetString(0,"Label1",OBJPROP_TEXT,0,"Ask Price: "+Ask);
  //Static conunter
   static int i;

   //Set distance from left border
   ObjectGetInteger(0,"Label1",OBJPROP_XDISTANCE,i);
   //Set distance from upper border
   ObjectGetInteger(0,"Label1",OBJPROP_YDISTANCE,i);
   i++;
  
  }


Alain Verleyen
Moderator
36428
Alain Verleyen  

Please write in English on this site.

Too there is a Spanish section.

luisaoisdead
20
luisaoisdead  
Alain Verleyen:

Please write in English on this site.

Too there is a Spanish section.

Updated.. ;)
luisaoisdead
20
luisaoisdead  
No one? :(
whroeder1
17824
whroeder1  
  1. You can start with
    StringToInteger(_Symbol)
    EURUSD as an int is bogus. To create on the current chart use zero.

  2. luisaoisdead: the following happens to me ...

    it should be in 1, but it never leaves 2.

    What happens to you? There are no mind readers here and our crystal balls are cracked.

  3. What should be one and What never leaves two?

  4. luisaoisdead: Since this does not work,
    "Doesn't work" is meaningless - just like saying the car doesn't work. Doesn't start, won't go in gear, no electrical, missing the key, flat tires - meaningless. We can't see your broken code. There are no mind readers here and our crystal balls are cracked.

To add comments, please log in or register