Very well done, it doesn't handle subwindow indicators that have settings in their shortname more than once and there's no error printouts, ie custom indicators, else it works fine. I contributed with discussing the issues n use requirements, gave 2 demonstrations of options, maybe too harshly but you never gave out anything to base your claim that it's doable - I'm sure you can appreciate the difference in functionality of the first file you posted and this recent one. It's not the first time this kind of request has come up, and addressed not by my dopey self either.
I've been testing my own something that would eventually appear as desired(single clicking), but with dlls of course, that acceses the template file outisde the file sandbox and copies out segments of the template file that store the selected subwindow, regardless of it being a built in indicator or some other custom indicator and everything else in the window. So splicing it out, storing it inside the indicator, then splicing it back into the template file in any desired window order. At least that's how I'd see it being done, but with dlls.
Anyway the file isn't big and it doesn't make templates even though it causes the deinit reason of template change, and doesn't seem to be making files anywhere either. So please do gloat and educate me, it would be very welcomed, I've provided many files here, even a few that I were told by the user they couldn't get done anywhere else, but all with mql4, so your file that needs no dlls would increase by toolbox. I'm surprised it's all in the ex4, is it just mql4 or you've managed to compile in other stuff?