MT5 Closing Chart - Please help

 

Hi. I want to close only the current chart if the given condition is met in the indicator after sending an alert. So, I tried the following code. But it gives the error message " 'ChartClose' - function declarations are allowed on global, namespace or class scope only". Could someone please help me to correct this. Thank you.

if(condition1==1)
{ 
   Alert(text," - Condition1 OK");
   bool ChartClose(long chart_id=0);
}

 
m.wijethunga:

Hi. I want to close only the current chart if the given condition is met in the indicator after sending an alert. So, I tried the following code. But it gives the error message " 'ChartClose' - function declarations are allowed on global, namespace or class scope only". Could someone please help me to correct this. Thank you.


bool check = ChartClose();
 
if(condition1==1)
{ 
   Alert(text," - Condition1 OK");
   ChartClose(0);
}
Reason: