Open new charts and apply template using script not working

 

As such no error but not able to launch new charts via following script. already created and tested the template.  Script should open new charts and apply the associated template. template already has required ea and indicators.

void OnStart()             

{              

long iChartID_1   = ChartOpen("EURUSD",PERIOD_D1); ChartApplyTemplate(iChartID_1  ,"111.tpl");
long iChartID_2   = ChartOpen("EURUSD",PERIOD_D1); ChartApplyTemplate(iChartID_2  ,"222.tpl");
long iChartID_3   = ChartOpen("EURUSD",PERIOD_D1); ChartApplyTemplate(iChartID_3  ,"333.tpl");

}

or

void OnStart()             

{              

ChartApplyTemplate((ChartOpen("EURUSD",PERIOD_D1)),"111");

ChartApplyTemplate((ChartOpen("EURUSD",PERIOD_D1)),"222");

}
 
It takes time to open a chart. You can't apply the template until the chart opens.
Reason: