Copying an object

 

Hi, 

We are not aware of what kind of objects  can be drawn by user on the chart manually.

Let's assume sometimes we need to copy some of them.  

Because they are in different types so we have to say if it was a vertical line get the time1 , thickness, color etc.

If  it was a rectangle get price 1 and 2 , time 1 and 2 etc.

But there are many different types.

Also different type of object create functions needed to be used. 

My target is to delete some objects and draw exactly the same with no change.

Is there any simple way to copy an on object, or do you know any prepared code for it?

The reason of why I'm asking this question is, I'm trying to  help a friend to solve a problem like what you see in this page.

Thanks.

How to disable the backspace key event.
How to disable the backspace key event.
  • 2016.02.29
  • www.mql5.com
i have create some objects on chart. but if i press the backspace button on keyboard. these objects will be deleted on chart...
 
Reza nasimi:

We are not aware of what kind of objects  can be drawn by user on the chart manually.

Is there any simple way to copy an on object, or do you know any prepared code for it?
  1. All of them
  2. Select one, control-Drag.
  3. To move all of them to other charts, create a template.
 
William Roeder:
  1. All of them
  2. Select one, control-Drag.
  3. To move all of them to other charts, create a template.

Thanks  William Roeder

It sees to me that it was clear that I'm asking about coding and not manual copying, but, sorry if it wasn't clear enough .

So the question is how to copy the objects and (after deleting them ) re-create them with no change.

The process will/can be one by one, get all the info of an object, delete it, re-create it and go to the next object. ( it May seem stupid but in this way I'm trying to make the objects which are not created by my EA newer than the ones made by my EA).

in other words actually I want to make my EA's objects older than the other objects.

So, I can make a function and say if it was a OBJ_TREND collect x,,x,x,x,x, values and if it was an arrow collect y,y,y,y,y, values and continue going for all of the types which exist for objects.
but it will be a long coding and it isn't worth for me to spend time on it.
Then I want to know if there is an easier way to grammatically copy an object.

Thanks

 
  1. There is no copy.
  2. It does "seem stupid."
  3. If the ordering of the non-EA symbols is unimportant, count down in the object select loop.
  4. If it is, count up, remember all the object's information. Then outside the loop delete and recreate them in original order.
 
William Roeder:
  1. There is no copy.
  2. It does "seem stupid."
  3. If the ordering of the non-EA symbols is unimportant, count down in the object select loop.
  4. If it is, count up, remember all the object's information. Then outside the loop delete and recreate them in original order.

1. Thanks, that's what I was asking for.

2. I said it may seem stupid, because I didn't say the reason of why I wanted to do  it, but I explained a part of the reason just 1 word after that and it is totally not stupid.

You won't lose anything by trying to speak nicer.

I truly appreciate all your helps, I learned a lot by reading the answers you have written on any question in this forum.

Thanks.

Reason: