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.
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.
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.
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.
I hope this would help...
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 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.
To add comments, please log in or register