Download MetaTrader 5

Detecting an object (arrow) on current bar

To add comments, please log in or register
Shawn
192
Shawn  

Hi all, I would like to program my EA to detect if an object appears (an arrow... put there by an indicator) on the current bar of my chart. Is this possible?


Thanks!

Shawn

Viffer
614
Viffer  
Shawn
192
Shawn  


Thanks Viffer... can this find it on the current bar? Any thoughts on how I would do that?


Thanks!

Shawn

Viffer
614
Viffer  

Normally, to have drawn the arrow in the first place, it will have been given a name and ObjectFind() will look for the name. Presumably some where in your code, there will be the code that created the object. Normally it would be some combination of label and time to generate the name. You can then reference this with ObjectFind(). AFAIK, the only automatically drawn arrow would be the ones with order send. and you could reference these points with OrderSelect.

Does that help any?

V

Shawn
192
Shawn  
Viffer:

Normally, to have drawn the arrow in the first place, it will have been given a name and ObjectFind() will look for the name. Presumably some where in your code, there will be the code that created the object. Normally it would be some combination of label and time to generate the name. You can then reference this with ObjectFind(). AFAIK, the only automatically drawn arrow would be the ones with order send. and you could reference these points with OrderSelect.

Does that help any?

V



Well, the thing is there could be several of these arrows drawn on the chart and I only want to check to see if there is one drawn on the current bar only. Do you know if there's a way to check that?


(I don't care about the arrows drawn with "OrderSend"... they're not the ones I'm looking for. It's the big up and down pointing arrow objects that I want to detect)

Viffer
614
Viffer  

So if you right click on your chart, and select objects list, you will see that each of the arrows will have a name. It is this name that you need to detect it with ObjectFind. Afaik, there is no other way.. Normally, when programs name an object they use a consistant method, normally consisting of a lable and a time. The name might look like "Arrow" and a string of numbers. Normally that string of numbers would be the time for the bar where the arrow is drawn. It si wholly dependent on the code that was used to create and name the arrow in the first place. If it is a standardazed approach then you could use Objectfind() like this...

ObjectFind("Arrow"+Time[0]); 

As I say, this will be wholly dependent on the method used to name the arrow in the first place.

V

Shawn
192
Shawn  
Viffer:

So if you right click on your chart, and select objects list, you will see that each of the arrows will have a name. It is this name that you need to detect it with ObjectFind. Afaik, there is no other way.. Normally, when programs name an object they use a consistant method, normally consisting of a lable and a time. The name might look like "Arrow" and a string of numbers. Normally that string of numbers would be the time for the bar where the arrow is drawn. It si wholly dependent on the code that was used to create and name the arrow in the first place. If it is a standardazed approach then you could use Objectfind() like this...

As I say, this will be wholly dependent on the method used to name the arrow in the first place.

V


Thanks Viffer, I think with "ObjectFind("Arrow"+Time[0])" I should be able to do it!


Thanks

Shawn

Tusa Busi
32
Tusa Busi  
I can do this. Reply and I will help.
To add comments, please log in or register