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

 
Порт-моне тв:

didn't help. And I realised that the square values are not taken from two as they should be, but from the last one. I don't know how to beat that. I wouldn't have guessed it myself. I'm not fluent in mql, that's why I'm asking you here and you're offering me combs.

You've already been told above that each object should be unique (name, colour).

 
Alekseu Fedotov:

You have already been told above that each object should be unique (name, colour)

Comrades! HOW TO DO IT, THIS UNIQUENESS???? I draw and then EA should take its values based on what has been drawn (square 1 and square 2) and continue trading. Example by a piece of code, may be the colour or a "NAME"? Sometimes you stumble on some elementary mistakes and can not win. Haven't you ever had one of these?

 
Порт-моне тв:

... I draw...

at this point you have to write the name, by yourself, by pressing the keys

 
Iurii Tokman:

at this point you need to write the name, by yourself, by pressing the keys

show me where to write it in code OBJ_NAME or whatever... or something else to unique I'm stuck on this, third day. HEEEEELP

PS I'm sorry but I'm already hysterical, out of desperation I'm going to storm the Capitol now

 
Порт-моне тв:

show me where to write OBJ_NAME or something... or something else to unique it I'm stuck on this, third day. HEEEEELP

PS I'm sorry but I'm already hysterical, out of desperation I'm going to storm the Capitol now

If you are drawing by yourself, then in the properties of the square specify the name (e.g. BUY),

and specify it in the indicator.

   if(ObjectFind(0,"BUY")==0)

This is just in case


 
Порт-моне тв:

show me where to write OBJ_NAME or something... or something else to unique it I'm stuck on this, third day. HEEEEELP

PS I'm sorry but I'm already hysterical, out of desperation I'm going to storm the Capitol now

So call the objects (square 1 and square 2 )

The code to find the right object will look like this:

   int obj_total=ObjectsTotal();
   string name;
   for(int i=0; i<obj_total; i++)
     {
      name = ObjectName(i);
      if(ObjectType(name)==OBJ_RECTANGLE)
        {
         if(StringCompare(name,"квадрат 1")==0)
           {
           Alert("",name);
           }
        }
     }
 
Alekseu Fedotov:

Call the objects by that name (Square 1 and Square 2 )

The code to find the right object will look like this

he doesn't need that much code

only

 if(ObjectFind(0,"BUY")==0)

or

 if(ObjectFind(0,"SELL")==0)
 
MakarFX:

he doesn't need that much code

only

or

This is also possible, but 1 parameter will not be 0, but the name

 
Alekseu Fedotov:

Call the objects by that name (Square 1 and Square 2 )

The code for finding the right object will look like this


HOORAY! YOUR OPTION WORKED, dear @Alekseu Fedotov!!!!!

 if(StringCompare(name,"квадрат 1")==0)


@MakarFX Yours didn't work, and I've tried it before and can't remember! Anyway, thanks to all. Have a good trade!

if(ObjectFind(0,"BUY")==0
MakarFX
MakarFX
  • www.mql5.com
Профиль трейдера
 
Alekseu Fedotov:

This is also possible, but 1 parameter will not be 0, but the name

no

if(ObjectFind(0,"BUY")==0)

the 0 parameter indicates that it belongs to this graph

Reason: