WindowFind() returns -1 if custom indicator searches itself when init() function works. ???

Back to topics list  | 1 2 To post a new topic, please log in or register
avatar
2644
phy 2009.11.11 21:58 #
 

Seems to work in some code, not work in others. I haven't figured it out either.

When it refuses to work i put an extern for the window number to specify the window.

 
avatar
98
JPS 2010.11.23 12:28 #
 
whitebloodcell:

Was this problem ever resolved? For the life of me I can't get WindowFind to work correctly. Always returns as -1. Yet I am positive I am inputting the name correctly.



Any ideas?

I know this an old thread, but an answer was never given, so I'll post here for others that come across the same problems.

After running some extensive testing to locate the reason, it appears that WindowFind() can only locate indicators inside the sub chart window.

If the indicator you are looking for is on your main chart window, it seems to always return a value of -1.


 
avatar
98
JPS 2010.11.23 12:35 #
 

I think the reasoning is there is no text on the chart and that is what MT4 is searching for - indicator short name.

A possible solution may be to have the indicator draw a hidden object (place it outside the chart boundaries).

Then use ObjectFind("hidden object") to know your indicator is attached.

 
avatar
18
12BPRO2 2013.06.09 12:13 #
 

Hi Guys,

I hope this would help...

https://book.mql4.com/functions/charts

avatar
14167
RaptorUK 2013.06.09 12:16 #
 
12BPRO2:

Hi Guys,

I hope this would help...

https://book.mql4.com/functions/charts

You waited 5 years to post that ?  Please do not dredge up old thread unless you have a very, very good reason,  you don't.

 

Thread start date:   2008.02.09

 
avatar
10
LukeB 2016.02.02 04:25 #
 
RaptorUK:

You waited 5 years to post that ?  Please do not dredge up old thread unless you have a very, very good reason,  you don't.

 

Thread start date:   2008.02.09

Thread is old, but surprisingly, I found no actual commentary that helped on Saturday, Jan 30, 2016.
I made the attached tool to learn what is going on.  This is what I think I have learned:

1) WindowFind does not work on the weekend.  It seemed to return -1 no matter what I did all day Saturday, and apparently started working Sunday night.  I'll check again this coming Saturday. 

2) WindowFind is not just another version of ObjectFind.  ObjectFind will not find the indicator short name, and WindowFind will not find objects in the objects list.

Here is a utility / experimental / indicator I made to show what is going on.  I hope it helps anyone else looking to understand what is going on get the answers a little easier. Click on the yellow text.

Attached files:
  windownumexperiment.mq4  (12.44 KB)
Back to topics list   | 1 2  

To add comments, please log in or register