Using ChartOpen() with ChartApplyTemplate() removes my EA but loads template, c# mql4

 

Hello,

Can anyone explain me or have some solution for this.

I am coding this app in c#.

I loaded EA manually, make all to work, then i saved template file manually too, so i have template that works.

I have EA that is loaded when i call ChartOpen() function, and after that i call template file with ChartApplyTemplate(chartID, "template_name.tpl") but issue i have is in that moment i call template file it close my EA and loads template.

Is there any other way to fill data in EA before it loads, or to call template file that will load EA and fill data ?

How and is it possible to call ChartApplyTemplate() without chart id ?

I see ChartApplyTemplate() remarks says "The Expert Advisor will be unloaded and will not be able to continue operating in case of successful loading of a new template to the chart it is attached to." , this have no sense to me, why to remove EA, what if you need to change some settings while EA is running, or there is some error ?

 
This is also my question Id like to combine both ChartOpen() and ChartApplyTemplate()
 
ChartOpen() returns the ID of the newly opened chart.
 
Keith Watford:
ChartOpen() returns the ID of the newly opened chart.
I did not know that it was simple! Thank you very much it works!
Reason: