Download MetaTrader 5
To add comments, please log in or register
Sign up for MQL5.community to leave your comments!
Pavel Soukup
559
Pavel Soukup 2014.11.07 09:11 

Hi guys,

I have question:

Is possible any automatic definition new name of object which made on graph after select old object, press CTRL and duplicate object.

Example:

I have objects OBJ_ARROW_RIGHT_PRICE, name "ABC", I make duplicate this object press CTRL... new name this object is "ARROW +number". I would like new name object was "ABC+something text" Is possible it? Thank you.

whroeder1
13616
whroeder1 2014.11.07 16:25  
endy5: I would like new name object was "ABC+something text" Is possible it?
  1. And what would you expect would happen if you duplicated the new object? Get "ABC+something text+something text"?
  2. Not possible without code.
Pavel Soukup
559
Pavel Soukup 2014.11.10 08:23  

ad 1) ABC+number .th copy object, example: firsth duplicate object will be name "ABC1", other "ABC2" etc.

ad 2) yes, I know it. I can change desription of object but name?

Keith Watford
Moderator
7908
Keith Watford 2014.11.10 09:52  
You can change the name with ObjectSetString and OBJPROP_NAME
Pavel Soukup
559
Pavel Soukup 2014.11.10 12:03  
Ok, it is new information for me. So my problem now is "catch event" duplicate exist object on graph. Any idea?
Keith Watford
Moderator
7908
Keith Watford 2014.11.10 12:19  
endy5:
Ok, it is new information for me. So my problem now is "catch event" duplicate exist object on graph. Any idea?

You won't get duplicated object names, but you will get new objects created.

OnChartEvent

CHARTEVENT_OBJECT_CREATE

Pavel Soukup
559
Pavel Soukup 2014.11.11 12:29  
Hmm... It works good sometimes. Example: You have 2 objects OBJ_ARROW_RIGHT_PRICE, their names ABC1 and ABC2. When I doing duplicate object, new object will be name ARROW+any number (internal from MT). How get info which objects was duplicate? (object have the same color etc.)
Keith Watford
Moderator
7908
Keith Watford 2014.11.11 22:18  

Well, you could compare object properties with all the objects on the chart.

It would probably be better to write code to duplicate the object

Maybe store the name of the clicked object and then use a keydown event to duplicate it? 

Pavel Soukup
559
Pavel Soukup 2014.11.12 08:05  
I was thinkig about ... I need solution for hand duplicate object. So, maybe solution could be catch event clicked on master object and NEXT event would have to be CHARTEVENT_OBJECT_CREATE. Maybe... I try it.
Pavel Soukup
559
Pavel Soukup 2014.11.13 16:12  

Hmmm... I can not it :-( My idea from last post isn´t solution. Users can make a lot of other events between select master object and press CTRL key.

In addition to - after duplicate object by hand event click return name´s new object.

So - my question/problem staying: How get info (name of master object) which was duplicated?

Carl Schreiber
5946
Carl Schreiber 2014.11.13 17:03  
endy5:

Hmmm... I can not it :-( My idea from last post isn´t solution. Users can make a lot of other events between select master object and press CTRL key.

In addition to - after duplicate object by hand event click return name´s new object.

So - my question/problem staying: How get info (name of master object) which was duplicated?

Can it be that the approach you have in mind is not an ideal one for mt4 and what it is offering?

Can you start to think of another solution?

/
To add comments, please log in or register