Try the attached. It compiles without any errors. All I did was include the user32.dll import.
Establish the templateIndex parameter accordingly. The primary template at MT4's dropdown list (menu: Charts Template ...) is 0, the next is 1, the third is 2, and so on. So if you wanted the fifth template from the list to be implemented, kind 4.
Your designated template will be applied to all charts. It worked for me (I'm running Win XP Home SP2 / br0ker FXDD / MT4 build 402).
David